Skip to content

Commit

Permalink
ci: add code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
greatislander committed Nov 25, 2024
1 parent 6d2781f commit b5489ba
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none
coverage: pcov

- name: Setup problem matchers
run: |
Expand All @@ -53,3 +53,32 @@ jobs:

- name: Execute tests
run: vendor/bin/pest --ci
if: matrix.php != 8.2 || matrix.stability != 'prefer-stable'

- name: Execute tests with coverage
run: vendor/bin/pest --ci --coverage-clover coverage.xml
if: matrix.php == 8.2 && matrix.stability == 'prefer-stable'

- name: Save code coverage to artifact
uses: actions/upload-artifact@v4
if: matrix.php == 8.2 && matrix.stability == 'prefer-stable'
with:
name: code-coverage
path: "coverage.xml"
retention-days: 5

upload-coverage:
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- name: Fetch code coverage artifact
uses: actions/download-artifact@v4
with:
name: code-coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

0 comments on commit b5489ba

Please sign in to comment.