feat: upgrade to Pest v4 and implement testing improvements #3
Workflow file for this run
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: Coverage | |
| on: | |
| # Run testing on all push and pull requests that have committed changes in PHP files | |
| push: | |
| paths: | |
| - '**/*.php' | |
| pull_request: | |
| paths: | |
| - '**/*.php' | |
| # Make it possible to run the workflow manually | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| name: Code coverage report | |
| steps: | |
| #- name: Configure operating system | |
| # run: sudo apt-get update && sudo apt-get install -y locales locales-all | |
| - name: Checkout code | |
| uses: actions/checkout@v6.0.2 | |
| with: | |
| ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Cache Playwright browsers | |
| id: playwright-cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-latest | |
| restore-keys: | | |
| playwright-${{ runner.os }}-latest | |
| playwright-${{ runner.os }}- | |
| - name: Install and update Playwright | |
| run: | | |
| if [ ! -d ~/.cache/ms-playwright ]; then | |
| npm install playwright@latest | |
| npx playwright install --with-deps | |
| fi | |
| - name: Validate composer.json and composer.lock | |
| run: composer validate --strict | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v5.0.5 | |
| with: | |
| path: vendor | |
| key: coverage-${{ hashFiles('**/composer.lock') }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| coverage: xdebug | |
| extensions: mbstring, gd, intl, pcntl | |
| - name: Install dependencies | |
| run: composer update --prefer-dist --no-progress --prefer-stable | |
| - name: Setup testbench environment | |
| run: | | |
| cp workbench/.env.example workbench/.env | |
| sed -i 's/APP_KEY=/APP_KEY=base64:ZQvPGC7uVADkjOgtGIIuCI8u3\/Pzu+VaRObIbHsgjCc=/' workbench/.env | |
| sed -i 's/APP_ENV=local/APP_ENV=testing/' workbench/.env | |
| grep "APP_KEY=base64:" workbench/.env | |
| npm install | |
| php vendor/bin/testbench vendor:publish --tag='filament-shield-config' | |
| php vendor/bin/testbench filament:assets | |
| php vendor/bin/testbench package:sync-skeleton | |
| - name: Run test suite with coverage | |
| run: vendor/bin/pest --coverage-clover ./coverage.xml | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v6.0.0 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| files: ./coverage.xml | |
| verbose: true |