.github/ workflows/ ci.yml
.github/ workflows/ ci.yml
.github/ workflows/ ci.yml
name: Laravel CI/CD on: push: branches: [main, develop] pull_request: branches: [main] env: PHP_VERSION: '8.4' NODE_VERSION: '20'
name: Laravel CI/CD on: push: branches: [main, develop] pull_request: branches: [main] env: PHP_VERSION: '8.4' NODE_VERSION: '20'
name: Laravel CI/CD on: push: branches: [main, develop] pull_request: branches: [main] env: PHP_VERSION: '8.4' NODE_VERSION: '20'
jobs: build-and-test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ env.PHP_VERSION }} extensions: mbstring, xml, ctype, json, bcmath, pdo_sqlite coverage: none
jobs: build-and-test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ env.PHP_VERSION }} extensions: mbstring, xml, ctype, json, bcmath, pdo_sqlite coverage: none
jobs: build-and-test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ env.PHP_VERSION }} extensions: mbstring, xml, ctype, json, bcmath, pdo_sqlite coverage: none
- name: Cache Composer packages uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install Composer dependencies run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: 'npm' - name: Install NPM dependencies run: npm ci
- name: Cache Composer packages uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install Composer dependencies run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: 'npm' - name: Install NPM dependencies run: npm ci
- name: Cache Composer packages uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install Composer dependencies run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: 'npm' - name: Install NPM dependencies run: npm ci
- name: Copy environment file run: cp .env.example .env.ci - name: Generate application key run: php artisan key:generate --env=ci - name: Set directory permissions run: chmod -R 755 storage bootstrap/cache
- name: Copy environment file run: cp .env.example .env.ci - name: Generate application key run: php artisan key:generate --env=ci - name: Set directory permissions run: chmod -R 755 storage bootstrap/cache
- name: Copy environment file run: cp .env.example .env.ci - name: Generate application key run: php artisan key:generate --env=ci - name: Set directory permissions run: chmod -R 755 storage bootstrap/cache
APP_ENV=testing
APP_KEY=
DB_CONNECTION=sqlite
DB_DATABASE=:memory:
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_CONNECTION=sync
MAIL_MAILER=array
APP_ENV=testing
APP_KEY=
DB_CONNECTION=sqlite
DB_DATABASE=:memory:
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_CONNECTION=sync
MAIL_MAILER=array
APP_ENV=testing
APP_KEY=
DB_CONNECTION=sqlite
DB_DATABASE=:memory:
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_CONNECTION=sync
MAIL_MAILER=array
- name: Check code style with Pint run: vendor/bin/pint --test
- name: Check code style with Pint run: vendor/bin/pint --test
- name: Check code style with Pint run: vendor/bin/pint --test
composer require nunomaduro/larastan --dev
composer require nunomaduro/larastan --dev
composer require nunomaduro/larastan --dev
includes: - vendor/nunomaduro/larastan/extension.neon parameters: paths: - app level: 5 ignoreErrors: - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder#'
includes: - vendor/nunomaduro/larastan/extension.neon parameters: paths: - app level: 5 ignoreErrors: - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder#'
includes: - vendor/nunomaduro/larastan/extension.neon parameters: paths: - app level: 5 ignoreErrors: - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder#'
- name: Run static analysis run: vendor/bin/phpstan analyse --memory-limit=512M --no-progress
- name: Run static analysis run: vendor/bin/phpstan analyse --memory-limit=512M --no-progress
- name: Run static analysis run: vendor/bin/phpstan analyse --memory-limit=512M --no-progress
- name: Run tests env: DB_CONNECTION: sqlite DB_DATABASE: ':memory:' run: vendor/bin/pest --parallel
- name: Run tests env: DB_CONNECTION: sqlite DB_DATABASE: ':memory:' run: vendor/bin/pest --parallel
- name: Run tests env: DB_CONNECTION: sqlite DB_DATABASE: ':memory:' run: vendor/bin/pest --parallel
- name: Build assets with Vite run: npm run build
- name: Build assets with Vite run: npm run build
- name: Build assets with Vite run: npm run build
deploy: needs: build-and-test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - name: Trigger Forge deployment run: curl -s "${{ secrets.FORGE_DEPLOY_HOOK }}"
deploy: needs: build-and-test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - name: Trigger Forge deployment run: curl -s "${{ secrets.FORGE_DEPLOY_HOOK }}"
deploy: needs: build-and-test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - name: Trigger Forge deployment run: curl -s "${{ secrets.FORGE_DEPLOY_HOOK }}"
- name: Deploy via SSH uses: appleboy/ssh-action@master with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /var/www/myapp git pull origin main composer install --no-dev --optimize-autoloader php artisan migrate --force php artisan config:cache php artisan route:cache php artisan view:cache php artisan queue:restart
- name: Deploy via SSH uses: appleboy/ssh-action@master with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /var/www/myapp git pull origin main composer install --no-dev --optimize-autoloader php artisan migrate --force php artisan config:cache php artisan route:cache php artisan view:cache php artisan queue:restart
- name: Deploy via SSH uses: appleboy/ssh-action@master with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /var/www/myapp git pull origin main composer install --no-dev --optimize-autoloader php artisan migrate --force php artisan config:cache php artisan route:cache php artisan view:cache php artisan queue:restart
- name: Deploy with Scotty uses: appleboy/ssh-action@master with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /var/www/myapp git pull origin main ./vendor/bin/scotty run deploy
- name: Deploy with Scotty uses: appleboy/ssh-action@master with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /var/www/myapp git pull origin main ./vendor/bin/scotty run deploy
- name: Deploy with Scotty uses: appleboy/ssh-action@master with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /var/www/myapp git pull origin main ./vendor/bin/scotty run deploy
- name: Run tests env: DB_CONNECTION: sqlite DB_DATABASE: ':memory:' STRIPE_SECRET: ${{ secrets.STRIPE_SECRET }} run: vendor/bin/pest --parallel
- name: Run tests env: DB_CONNECTION: sqlite DB_DATABASE: ':memory:' STRIPE_SECRET: ${{ secrets.STRIPE_SECRET }} run: vendor/bin/pest --parallel
- name: Run tests env: DB_CONNECTION: sqlite DB_DATABASE: ':memory:' STRIPE_SECRET: ${{ secrets.STRIPE_SECRET }} run: vendor/bin/pest --parallel



on: push: branches: [main, develop] pull_request: branches: [main]
on: push: branches: [main, develop] pull_request: branches: [main]
on: push: branches: [main, develop] pull_request: branches: [main]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
name: Laravel CI/CD on: push: branches: [main, develop] pull_request: branches: [main] env: PHP_VERSION: '8.4' NODE_VERSION: '20' jobs: build-and-test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ env.PHP_VERSION }} extensions: mbstring, xml, ctype, json, bcmath, pdo_sqlite coverage: none - name: Cache Composer packages uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install Composer dependencies run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: 'npm' - name: Install NPM dependencies run: npm ci - name: Copy environment file run: cp .env.example .env.ci - name: Generate application key run: php artisan key:generate --env=ci - name: Set directory permissions run: chmod -R 755 storage bootstrap/cache - name: Check code style with Pint run: vendor/bin/pint --test - name: Run static analysis run: vendor/bin/phpstan analyse --memory-limit=512M --no-progress - name: Run tests env: DB_CONNECTION: sqlite DB_DATABASE: ':memory:' run: vendor/bin/pest --parallel - name: Build assets run: npm run build deploy: needs: build-and-test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - name: Deploy # Choose one of the deployment options above and add it here run: curl -s "${{ secrets.FORGE_DEPLOY_HOOK }}"
name: Laravel CI/CD on: push: branches: [main, develop] pull_request: branches: [main] env: PHP_VERSION: '8.4' NODE_VERSION: '20' jobs: build-and-test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ env.PHP_VERSION }} extensions: mbstring, xml, ctype, json, bcmath, pdo_sqlite coverage: none - name: Cache Composer packages uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install Composer dependencies run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: 'npm' - name: Install NPM dependencies run: npm ci - name: Copy environment file run: cp .env.example .env.ci - name: Generate application key run: php artisan key:generate --env=ci - name: Set directory permissions run: chmod -R 755 storage bootstrap/cache - name: Check code style with Pint run: vendor/bin/pint --test - name: Run static analysis run: vendor/bin/phpstan analyse --memory-limit=512M --no-progress - name: Run tests env: DB_CONNECTION: sqlite DB_DATABASE: ':memory:' run: vendor/bin/pest --parallel - name: Build assets run: npm run build deploy: needs: build-and-test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - name: Deploy # Choose one of the deployment options above and add it here run: curl -s "${{ secrets.FORGE_DEPLOY_HOOK }}"
name: Laravel CI/CD on: push: branches: [main, develop] pull_request: branches: [main] env: PHP_VERSION: '8.4' NODE_VERSION: '20' jobs: build-and-test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ env.PHP_VERSION }} extensions: mbstring, xml, ctype, json, bcmath, pdo_sqlite coverage: none - name: Cache Composer packages uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install Composer dependencies run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: 'npm' - name: Install NPM dependencies run: npm ci - name: Copy environment file run: cp .env.example .env.ci - name: Generate application key run: php artisan key:generate --env=ci - name: Set directory permissions run: chmod -R 755 storage bootstrap/cache - name: Check code style with Pint run: vendor/bin/pint --test - name: Run static analysis run: vendor/bin/phpstan analyse --memory-limit=512M --no-progress - name: Run tests env: DB_CONNECTION: sqlite DB_DATABASE: ':memory:' run: vendor/bin/pest --parallel - name: Build assets run: npm run build deploy: needs: build-and-test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - name: Deploy # Choose one of the deployment options above and add it here run: curl -s "${{ secrets.FORGE_DEPLOY_HOOK }}" - --no-interaction: prevents prompts that would hang the CI runner
- --prefer-dist: downloads zip archives instead of git clones, faster
- --optimize-autoloader: generates an optimized classmap
- --no-progress: cleaner output in CI logs - SSH_HOST: your server's IP or domain
- SSH_USER: the deploy user (create a dedicated non-root user)
- SSH_PRIVATE_KEY: the private key whose public key is in the server's authorized_keys