v1.0.2 #7
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: [ master, main, develop ] | |
| pull_request: | |
| branches: [ master, main, develop ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: PHP ${{ matrix.php }} Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['7.4', '8.0', '8.1', '8.2', '8.3'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: json | |
| 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 dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install Perfbase | |
| run: bash -c "$(curl -fsSL https://cdn.perfbase.com/install.sh)" | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-suggest | |
| - name: Run PHPUnit tests | |
| run: ./vendor/bin/phpunit --coverage-clover coverage.xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: ./coverage.xml | |
| flags: php-${{ matrix.php }} | |
| name: php-${{ matrix.php }} | |
| fail_ci_if_error: false | |
| code-quality: | |
| name: Code Quality Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.2 | |
| extensions: json | |
| tools: composer:v2 | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-suggest | |
| - name: Run PHPStan | |
| run: composer phpstan | |
| - name: Run PHPCS | |
| run: composer phpcs || true # Don't fail on coding standards (yet) | |
| test-matrix-status: | |
| name: Test Matrix Status | |
| runs-on: ubuntu-latest | |
| needs: [test, code-quality] | |
| if: always() | |
| steps: | |
| - name: Check test matrix status | |
| run: | | |
| if [ "${{ needs.test.result }}" == "failure" ] || [ "${{ needs.code-quality.result }}" == "failure" ]; then | |
| echo "Tests failed!" | |
| exit 1 | |
| fi | |
| echo "All tests passed!" |