Skip to content

Commit

Permalink
Merge pull request #374 from CPS-IT/task/coverage-report
Browse files Browse the repository at this point in the history
[TASK] Stabilize test coverage reporting in CI
  • Loading branch information
eliashaeussler authored Nov 9, 2023
2 parents e60bc71 + c4f9cbf commit b88e457
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,50 @@ jobs:
- name: Run Unit tests with coverage
run: composer test:unit:coverage

# Report coverage
# Upload artifact
- name: Fix coverage path
working-directory: .build/coverage
run: sed -i 's#/home/runner/work/project-builder/project-builder#${{ github.workspace }}#g' clover.xml
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
with:
name: coverage
path: .build/coverage/clover.xml
retention-days: 7

coverage-report:
name: Report test coverage
runs-on: ubuntu-latest
needs: coverage
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Download artifact
- name: Download coverage artifact
id: download
uses: actions/download-artifact@v3
with:
name: coverage

# CodeClimate
- name: CodeClimate report
uses: paambaati/codeclimate-action@v5.0.0
if: env.CC_TEST_REPORTER_ID
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{ github.workspace }}/.build/coverage/clover.xml:clover
${{ steps.download.outputs.download-path }}/clover.xml:clover
# codecov
- name: codecov report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: .build/coverage
files: |
${{ steps.download.outputs.download-path }}/clover.xml
fail_ci_if_error: true
verbose: true

Expand Down

0 comments on commit b88e457

Please sign in to comment.