Simplify cache configuration #1437
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: | |
| pull_request: | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - '.github/workflows/tests.yml' | |
| - 'composer.json' | |
| - 'phpstan.neon.dist' | |
| push: | |
| branches: ['8.x'] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| - '.github/workflows/tests.yml' | |
| - 'composer.json' | |
| - 'phpstan.neon.dist' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| name: "PHP ${{ matrix.php }}, ${{ matrix.dependencies }} deps" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: | |
| - "8.3" | |
| - "8.4" | |
| - "8.5" | |
| dependencies: | |
| - "lowest" | |
| - "highest" | |
| env: | |
| extensions: grpc | |
| key: cache-v1 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: ${{ env.extensions }} | |
| key: ${{ env.key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v5.0.2 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: ${{ env.extensions }} | |
| tools: composer, pecl | |
| coverage: xdebug | |
| - uses: "ramsey/composer-install@v3" | |
| with: | |
| composer-options: "${{ matrix.composer-options }}" | |
| dependency-versions: "${{ matrix.dependencies }}" | |
| - name: Setup problem matchers for PHP | |
| run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
| - name: Setup Problem Matchers for PHPUnit | |
| run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
| - name: Run PHPUnit | |
| run: vendor/bin/phpunit --testsuite=unit --coverage-clover=coverage.xml --log-junit=test-report.xml --testdox | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: unit | |
| report_type: test_results | |
| fail_ci_if_error: false | |
| - name: Upload coverage to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: unit | |
| fail_ci_if_error: false |