chore: Update Composer QA tooling dependencies (#472) #257
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: Unit Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '.github/actions/release-please/**' | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| should-run: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run: ${{ steps.check.outputs.run }} | |
| steps: | |
| - name: Skip for release-please | |
| id: check | |
| run: | | |
| if [ "${{ github.event.pull_request.user.id }}" = "41898282" ]; then | |
| echo "run=false" >> $GITHUB_OUTPUT | |
| echo "::notice::Skipping unit tests - this a release-please bot's interaction" | |
| else | |
| echo "run=true" >> $GITHUB_OUTPUT | |
| echo "::notice::Unit tests will execute - the actor is not the release-please bot" | |
| fi | |
| unit-tests: | |
| needs: should-run | |
| if: needs.should-run.outputs.run == 'true' | |
| runs-on: ubuntu-latest | |
| name: "PHP ${{ matrix.php }} + Doctrine ORM ${{ matrix.doctrine-orm }} + Doctrine Lexer ${{ matrix.doctrine-lexer }}" | |
| strategy: | |
| fail-fast: ${{ github.event_name == 'pull_request' }} | |
| matrix: | |
| php: ['8.1', '8.2', '8.3', '8.4', '8.5'] | |
| doctrine-lexer: ['2.1', '3.0', 'latest'] | |
| doctrine-orm: ['2.14', '2.18', '3.0', 'latest'] | |
| include: | |
| - php: '8.1' | |
| doctrine-orm: '2.14' | |
| doctrine-lexer: '1.2' | |
| - php: '8.5' # Run coverage report only based on the latest dependencies | |
| doctrine-lexer: 'latest' | |
| doctrine-orm: 'latest' | |
| calculate-code-coverage: true | |
| exclude: | |
| - doctrine-orm: '2.14' | |
| doctrine-lexer: '3.0' | |
| - doctrine-orm: '3.0' | |
| doctrine-lexer: '2.1' | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: Set up PHP with PECL extension | |
| uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: ${{ matrix.calculate-code-coverage == true && 'xdebug' || 'none' }} | |
| extensions: ctype, json, mbstring | |
| tools: composer | |
| - name: Get composer cache directory | |
| id: composer-cache-dir | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache Composer packages | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: | | |
| ${{ steps.composer-cache-dir.outputs.dir }} | |
| vendor | |
| key: ${{ runner.os }}-php-${{ matrix.php }}-orm-${{ matrix.doctrine-orm }}-lexer-${{ matrix.doctrine-lexer }}-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php-${{ matrix.php }}-orm-${{ matrix.doctrine-orm }}-lexer-${{ matrix.doctrine-lexer }}- | |
| ${{ runner.os }}-php-${{ matrix.php }}- | |
| - name: Install Doctrine Lexer dependency | |
| run: | | |
| if [ "${{ matrix.doctrine-lexer }}" = "1.2" ]; then | |
| composer require doctrine/lexer "~1.2" --dev --prefer-dist --no-interaction --no-progress | |
| elif [ "${{ matrix.doctrine-lexer }}" = "2.1" ]; then | |
| composer require doctrine/lexer "~2.1" --dev --prefer-dist --no-interaction --no-progress | |
| elif [ "${{ matrix.doctrine-lexer }}" = "3.0" ]; then | |
| composer require doctrine/lexer "~3.0" --dev --prefer-dist --no-interaction --no-progress | |
| else | |
| composer update --prefer-dist --no-interaction --no-progress | |
| fi | |
| - name: Install Doctrine ORM dependency | |
| run: | | |
| if [ "${{ matrix.doctrine-orm }}" = "2.14" ]; then | |
| composer require doctrine/orm "~2.14" --prefer-dist --no-interaction --no-progress --with-all-dependencies | |
| elif [ "${{ matrix.doctrine-orm }}" = "2.18" ]; then | |
| composer require doctrine/orm "~2.18" --prefer-dist --no-interaction --no-progress --with-all-dependencies | |
| elif [ "${{ matrix.doctrine-orm }}" = "3.0" ]; then | |
| composer require doctrine/orm "~3.0" --prefer-dist --no-interaction --no-progress --with-all-dependencies | |
| else | |
| composer update --prefer-dist --no-interaction --no-progress | |
| fi | |
| - name: Run static analysis | |
| run: composer run-static-analysis | |
| continue-on-error: ${{ matrix.continue-on-error || false }} | |
| - name: Run unit test suite | |
| run: | | |
| if [ "${{ matrix.calculate-code-coverage }}" = "true" ]; then | |
| XDEBUG_MODE=coverage composer run-unit-tests | |
| else | |
| composer run-unit-tests -- --no-coverage | |
| fi | |
| - name: Upload coverage results to Coveralls | |
| if: matrix.calculate-code-coverage == true | |
| uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2 | |
| env: | |
| COVERALLS_SERVICE_NAME: github | |
| COVERALLS_SERVICE_NUMBER: ${{ github.sha }} | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| file: ./var/logs/test-coverage/unit/clover.xml | |
| parallel: true | |
| flag-name: "Unit" | |
| fail-on-error: false |