ci: run seo-production on PRs as informational #118
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| url: | |
| description: URL to audit (defaults to the PRODUCTION_URL repo variable) | |
| required: false | |
| jobs: | |
| quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| - name: Check formatting (Pint) | |
| run: vendor/bin/pint --test | |
| - name: Static analysis (Larastan) | |
| run: vendor/bin/phpstan analyse --no-progress --memory-limit=1G | |
| tests: | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: swinn-test | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| env: | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: swinn-test | |
| DB_USERNAME: root | |
| DB_PASSWORD: root | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| with: | |
| coverage: pcov | |
| frontend: 'true' | |
| - name: Copy .env | |
| run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
| - name: Generate App Key | |
| run: php artisan key:generate | |
| - name: Directory Permissions | |
| run: chmod -R 777 storage bootstrap/cache | |
| - name: Wait for MySQL | |
| run: | | |
| until mysqladmin ping -h 127.0.0.1 -uroot -proot --silent; do | |
| echo "Waiting for MySQL..." | |
| sleep 2 | |
| done | |
| - name: Run Migrations | |
| run: php artisan migrate --force | |
| - name: Install Passport | |
| run: php artisan passport:install --no-interaction | |
| - name: Run Tests | |
| run: vendor/bin/phpunit --coverage-clover coverage.xml | |
| - name: SEO check (local build) | |
| if: github.event_name == 'pull_request' | |
| uses: ikidnapmyself/seo-checkup@v1 | |
| with: | |
| serve: php artisan migrate --force && php artisan serve | |
| serve-url: http://localhost:8000 | |
| fail-on: recommended | |
| - name: Upload Coverage to Coveralls | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| file: coverage.xml | |
| format: clover | |
| seo-production: | |
| if: github.event_name != 'push' || github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| continue-on-error: ${{ github.event_name == 'pull_request' }} | |
| steps: | |
| - uses: ikidnapmyself/seo-checkup@v1 | |
| with: | |
| url: ${{ inputs.url || vars.PRODUCTION_URL }} | |
| fail-on: recommended |