chore: pin GitHub Actions to full-length commit SHAs #22
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: Agent CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| - release/** | |
| permissions: | |
| contents: read | |
| # Cancel in progress workflows on pull_requests. | |
| # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| name: Tests (${{ matrix.os }}, ${{ matrix.php.version }}, ${{ matrix.dependencies }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - windows-latest | |
| php: | |
| - { version: '7.2', phpunit: '^8.5.52' } | |
| - { version: '7.3', phpunit: '^9.6.33' } | |
| - { version: '7.4', phpunit: '^9.6.33' } | |
| - { version: '8.0', phpunit: '^9.6.33' } | |
| - { version: '8.1', phpunit: '^9.6.33' } | |
| - { version: '8.2', phpunit: '^9.6.33' } | |
| - { version: '8.3', phpunit: '^9.6.33' } | |
| - { version: '8.4', phpunit: '^9.6.33' } | |
| - { version: '8.5', phpunit: '^9.6.33' } | |
| dependencies: | |
| - lowest | |
| - highest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@728c6c6b8cf02c2e48117716a91ee48313958a19 # v2 | |
| with: | |
| php-version: ${{ matrix.php.version }} | |
| coverage: xdebug | |
| - name: Setup Problem Matchers for PHPUnit | |
| run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
| - name: Determine Composer cache directory | |
| id: composer-cache | |
| run: echo "directory=$(composer config cache-dir)" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.directory }} | |
| key: ${{ runner.os }}-${{ matrix.php.version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-${{ matrix.php.version }}-${{ matrix.dependencies }}-composer- | |
| - name: Remove unused dependencies | |
| run: composer config --unset platform.php | |
| working-directory: ./agent | |
| # These dependencies are not used running the tests but can cause deprecation warnings so we remove them before running the tests | |
| - name: Remove unused dependencies | |
| run: composer remove phpstan/phpstan --dev --no-interaction --no-update | |
| working-directory: ./agent | |
| - name: Set phpunit/phpunit version constraint | |
| run: composer require phpunit/phpunit:'${{ matrix.php.phpunit }}' --dev --no-interaction --no-update | |
| working-directory: ./agent | |
| - name: Install highest dependencies | |
| run: composer update --no-progress --no-interaction --prefer-dist | |
| if: ${{ matrix.dependencies == 'highest' }} | |
| working-directory: ./agent | |
| - name: Install lowest dependencies | |
| run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest | |
| if: ${{ matrix.dependencies == 'lowest' }} | |
| working-directory: ./agent | |
| - name: Run unit tests | |
| run: vendor/bin/phpunit --testsuite unit --coverage-clover=coverage.xml | |
| working-directory: ./agent |