Skip to content

build(deps-dev): bump the npm_and_yarn group across 2 directories with 2 updates #662

build(deps-dev): bump the npm_and_yarn group across 2 directories with 2 updates

build(deps-dev): bump the npm_and_yarn group across 2 directories with 2 updates #662

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
# Lint and test the application
test:
name: Run Tests
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: aiplatform_test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:7.0
ports:
- 6379:6379
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, xml, ctype, json, tokenizer, pdo_mysql, bcmath, gd, zip, intl, redis, pcntl
coverage: xdebug
tools: composer:v2
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer packages
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Dependencies
run: |
composer install --prefer-dist --no-progress --no-suggest
npm ci
- name: Prepare the application
run: |
cp .env.example .env
php artisan key:generate
php -r "file_put_contents('.env', str_replace('DB_DATABASE=aiplatform', 'DB_DATABASE=aiplatform_test', file_get_contents('.env')));"
php -r "file_put_contents('.env', str_replace('REDIS_HOST=127.0.0.1', 'REDIS_HOST=127.0.0.1\nDB_HOST=127.0.0.1\nDB_USERNAME=root\nDB_PASSWORD=root', file_get_contents('.env')));"
php artisan config:clear
- name: Create Database
run: |
mysql -h 127.0.0.1 -u root -proot -e "CREATE DATABASE IF NOT EXISTS aiplatform_test;"
- name: Run Migrations
run: php artisan migrate:fresh --seed --env=testing --force
- name: Generate Application Key
run: php artisan key:generate
- name: Execute Tests
run: |
mkdir -p storage/framework/views
php artisan test --coverage-clover=coverage.xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
# Build and deploy to staging environment
deploy-staging:
name: Deploy to Staging
needs: test
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
environment: staging
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, xml, ctype, json, tokenizer, pdo_mysql, bcmath, gd, zip, intl, redis, pcntl
tools: composer:v2
- name: Install Dependencies
run: |
composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader --no-dev
npm ci --production
- name: Build assets
run: |
npm run build
- name: Deploy to Staging Server
uses: appleboy/ssh-action@v1.2.2
with:
host: ${{ secrets.STAGING_HOST }}
username: ${{ secrets.STAGING_USERNAME }}
key: ${{ secrets.STAGING_SSH_KEY }}
script: |
cd /var/www/aiplatform
git fetch origin develop
git reset --hard origin/develop
composer install --optimize-autoloader --no-dev
npm ci --production
npm run build
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan queue:restart
sudo systemctl reload php8.3-fpm
# Deploy to production
deploy-production:
name: Deploy to Production
needs: [test, deploy-staging]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, xml, ctype, json, tokenizer, pdo_mysql, bcmath, gd, zip, intl, redis, pcntl
tools: composer:v2
- name: Install Dependencies
run: |
composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader --no-dev
npm ci --production
- name: Build assets
run: |
npm run build
- name: Deploy to Production Server
uses: appleboy/ssh-action@v1.2.2
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_SSH_KEY }}
script: |
cd /var/www/aiplatform
git fetch origin main
git reset --hard origin/main
composer install --optimize-autoloader --no-dev
npm ci --production
npm run build
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan queue:restart
sudo systemctl reload php8.3-fpm