Skip to content

Commit

Permalink
Merge pull request #209 from eliashaeussler/task/coverage-report
Browse files Browse the repository at this point in the history
[TASK] Stabilize coverage reporting in CI
  • Loading branch information
eliashaeussler authored Nov 2, 2023
2 parents a3549dd + fadab6c commit c67bc1c
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
- main
- 'renovate/**'
pull_request:
branches:
- '**'
- '!renovate/**'

jobs:
tests:
Expand Down Expand Up @@ -36,7 +33,6 @@ jobs:
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: ${{ matrix.composer-options }}

# Run tests
- name: Run tests
Expand Down Expand Up @@ -68,21 +64,49 @@ jobs:
- name: Run tests with coverage
run: composer test:coverage

# Report coverage
# Upload artifact
- name: Fix coverage path
working-directory: .build/coverage
run: sed -i 's#/home/runner/work/cpanel-requests/cpanel-requests#${{ 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

0 comments on commit c67bc1c

Please sign in to comment.