From c4f9cbf16007d9d6b87a4328add2e77b8eb21cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=A4u=C3=9Fler?= Date: Thu, 9 Nov 2023 17:10:57 +0100 Subject: [PATCH] [TASK] Stabilize test coverage reporting in CI --- .github/workflows/tests.yaml | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b125f57d..be26436d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -69,10 +69,34 @@ 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 @@ -80,12 +104,15 @@ jobs: 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