From 155bb549a4612e5a64aadf04170dfdd1692f3203 Mon Sep 17 00:00:00 2001 From: Oleksandr Havryliak Date: Wed, 18 Dec 2024 12:28:45 +0200 Subject: [PATCH 1/2] PBM coverage report for functional tests --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++- .github/workflows/codecov.yml | 1 + 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a6d1d3cc..9602b5fdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: PBM_BRANCH: ${{ github.event.inputs.pbm_branch || 'main' }} GO_VER: ${{ github.event.inputs.go_ver || '1.22-bullseye' }} PR_NUMBER: ${{ github.event.number|| github.event.inputs.pr_ver }} - + MAKE_TARGET: 'build-cover' steps: - name: Checkout testing repo uses: actions/checkout@v4 @@ -58,8 +58,50 @@ jobs: docker compose run test pytest -s --junitxml=junit.xml -k ${{ matrix.test }} working-directory: psmdb-testing/pbm-functional/pytest + - name: Fetch coverage files + run: | + docker compose run --rm golang_reports cp -r /gocoverdir/reports /test + sudo chmod -R 777 reports + working-directory: psmdb-testing/pbm-functional/pytest + if: success() || failure() + + - name: Upload coverage reports + uses: actions/upload-artifact@v4 + with: + name: reports-${{ matrix.test }}-${{ matrix.psmdb }} + path: psmdb-testing/pbm-functional/pytest/reports/ + if: success() || failure() + - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: success() || failure() with: report_paths: "**/junit.xml" + + coverage: + if: ${{ always() }} + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + - name: Download all coverage reports + uses: actions/download-artifact@v4 + with: + path: reports + pattern: reports-* + merge-multiple: true + - name: Merge coverage reports + run: | + go tool covdata textfmt -i=./reports -o ./coverage.txt + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + files: ./coverage.txt + flags: integration + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 3fcca0256..df2ef15e6 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -21,5 +21,6 @@ jobs: uses: codecov/codecov-action@v4 with: file: cover.out + flags: unittests fail_ci_if_error: false token: ${{ secrets.CODECOV_TOKEN }} From 352d5f99b98fad9da3cd4da06e424ddfb64e5d80 Mon Sep 17 00:00:00 2001 From: Oleksandr Havryliak Date: Wed, 18 Dec 2024 15:02:35 +0200 Subject: [PATCH 2/2] PBM add codecov flag for unittests --- .github/workflows/reviewdog.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index b8e95541f..9b9543056 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -16,6 +16,7 @@ jobs: uses: codecov/codecov-action@v4 with: file: cover.out + flags: unittests fail_ci_if_error: false token: ${{ secrets.CODECOV_TOKEN }}