|
5 | 5 | pull_request: |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - tests: |
9 | | - name: Tests on PHP ${{ matrix.php-version }} |
10 | | - runs-on: ubuntu-latest |
11 | | - |
12 | | - strategy: |
13 | | - fail-fast: false |
14 | | - matrix: |
15 | | - php-version: [ '8.4', '8.5', '8.6' ] |
| 8 | + upload-codecov: |
| 9 | + name: Upload coverage to Codecov |
| 10 | + runs-on: self-arm |
16 | 11 |
|
17 | 12 | steps: |
18 | 13 | # https://github.com/marketplace/actions/checkout |
|
21 | 16 | with: |
22 | 17 | fetch-depth: 0 |
23 | 18 |
|
24 | | - # https://github.com/marketplace/actions/setup-php-action |
25 | | - - name: Setup PHP |
26 | | - uses: shivammathur/setup-php@v2 |
27 | | - with: |
28 | | - php-version: ${{ matrix.php-version }} |
29 | | - extensions: mbstring, xml, json, iconv, dom, simplexml, tokenizer, random, curl, xmlreader, gmp |
30 | | - tools: composer:v2 |
31 | | - coverage: pcov |
32 | | - |
33 | | - # https://github.com/marketplace/actions/cache |
34 | | - - name: Cache Composer dependencies |
35 | | - uses: actions/cache@v4 |
36 | | - with: |
37 | | - path: | |
38 | | - ~/.composer/cache |
39 | | - vendor/ |
40 | | - key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }} |
41 | | - restore-keys: | |
42 | | - ${{ runner.os }}-composer-${{ matrix.php-version }}- |
43 | | -
|
44 | | - - name: Validate composer.json and composer.lock |
45 | | - run: composer validate |
46 | | - |
47 | | - - name: Install Composer dependencies |
48 | | - run: composer install --prefer-dist --no-progress --no-interaction --optimize-autoloader |
49 | | - |
50 | | - - name: Check for security advisories |
51 | | - run: | |
52 | | - if composer audit --no-dev --locked; then |
53 | | - echo "✅ No security vulnerabilities found in production dependencies" |
54 | | - else |
55 | | - echo "❌ Security vulnerabilities found!" |
56 | | - exit 1 |
57 | | - fi |
58 | | -
|
59 | | - - name: Run tests with PHPUnit |
60 | | - run: php -d xdebug.mode=coverage vendor/bin/phpunit |
61 | | - |
| 19 | + # https://github.com/marketplace/actions/codecov |
62 | 20 | - name: Upload coverage to Codecov |
63 | | - if: matrix.php-version == '8.5' |
64 | 21 | uses: codecov/codecov-action@v5 |
65 | 22 | env: |
66 | 23 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
|
70 | 27 | verbose: true |
71 | 28 |
|
72 | 29 | - name: Upload test results to Codecov |
73 | | - if: matrix.php-version == '8.5' && !cancelled() |
74 | 30 | uses: codecov/test-results-action@v1 |
75 | 31 | with: |
76 | 32 | token: ${{ secrets.CODECOV_TOKEN }} |
77 | 33 | files: .coverage/junit.xml |
78 | | - |
79 | | - - name: Upload coverage reports to GitHub |
80 | | - uses: actions/upload-artifact@v5 |
81 | | - if: always() |
82 | | - with: |
83 | | - name: coverage-report-php-${{ matrix.php-version }} |
84 | | - path: | |
85 | | - .coverage/clover.xml |
86 | | - retention-days: 1 |
0 commit comments