|
28 | 28 | coverage: pcov
|
29 | 29 | tools: composer:v2
|
30 | 30 |
|
31 |
| - - name: Adjust composer dependencies based on PHP version |
32 |
| - run: php php-version-deps-adjust.php |
| 31 | + - name: Adjust composer dependencies for older PHP versions |
| 32 | + if: contains(matrix.php-version, '8.0, 8.1') |
| 33 | + run: | |
| 34 | + php php-version-deps-adjust.php |
| 35 | + composer update --no-progress --no-interaction |
33 | 36 |
|
34 | 37 | - name: Cache Composer packages
|
35 | 38 | id: composer-cache
|
|
41 | 44 | ${{ runner.os }}-php-${{ matrix.php-version }}-
|
42 | 45 |
|
43 | 46 | - name: Install dependencies
|
44 |
| - run: composer install --prefer-dist --no-progress |
| 47 | + run: composer install --no-progress --no-interaction |
| 48 | + |
| 49 | + - name: Run test suites for older PHP versions |
| 50 | + if: contains(matrix.php-version, '8.0, 8.1, 8.2, 8.3') |
| 51 | + run: composer run-script test-all |
| 52 | + |
| 53 | + - name: Run test suites with coverage for latest PHP version |
| 54 | + if: matrix.php-version == '8.4' |
| 55 | + run: | |
| 56 | + mkdir -p var/coverage |
| 57 | + php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-text --coverage-clover=var/coverage/clover.xml | tee var/coverage/coverage.txt |
| 58 | +
|
| 59 | + - name: Extract Line Coverage |
| 60 | + if: matrix.php-version == '8.4' |
| 61 | + id: coverage |
| 62 | + run: echo "COVERAGE=$(grep -oP '(?<=Lines:\s+)[\d\.]+' coverage.txt | tail -1)" >> $GITHUB_ENV |
45 | 63 |
|
46 |
| - - name: Run test suite with coverage |
| 64 | + - name: Update GitHub Status |
| 65 | + if: matrix.php-version == '8.4' |
47 | 66 | run: |
|
48 |
| - composer run-script test-coverage |
49 |
| - codecov -f var/coverage/html-report/index.html |
| 67 | + curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ |
| 68 | + -H "Accept: application/vnd.github.v3+json" \ |
| 69 | + https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \ |
| 70 | + -d "{\"state\":\"success\",\"context\":\"Code Coverage\",\"description\":\"Line Coverage: ${{ env.COVERAGE }}%\",\"target_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" |
0 commit comments