This repository was archived by the owner on Aug 15, 2026. It is now read-only.
Add test coverage, PHPCS lint, and CI lint/coverage jobs #20
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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| validate: | |
| name: Validate Composer | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| - run: composer validate --strict | |
| # composer.lock is gitignored, so install before auditing. | |
| - run: composer install --prefer-dist --no-progress | |
| - run: composer audit | |
| test: | |
| name: PHP ${{ matrix.php }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.1', '8.2', '8.3', '8.4'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock', '**/composer.json') }} | |
| restore-keys: composer-${{ matrix.php }}- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run tests | |
| run: vendor/bin/phpunit | |
| lint: | |
| name: Lint (PHPCS) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| coverage: none | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: composer-8.3-${{ hashFiles('**/composer.lock', '**/composer.json') }} | |
| restore-keys: composer-8.3- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run PHPCS | |
| run: vendor/bin/phpcs | |
| coverage: | |
| name: Coverage (PHP 8.3) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| coverage: pcov | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor | |
| key: composer-8.3-${{ hashFiles('**/composer.lock', '**/composer.json') }} | |
| restore-keys: composer-8.3- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Run tests with coverage | |
| run: vendor/bin/phpunit --coverage-text |