From f1713ac35431f5d9f0336ec006ad41f65f81a66a Mon Sep 17 00:00:00 2001 From: Rot127 <45763064+Rot127@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:41:56 +0000 Subject: [PATCH] Use Codecov action to upload coverage data every PR. (#5057) * Enable CodeCov actions in the CI for every PR. * Just disable all parsing errors, since we seem to hit plenty. --- .github/workflows/ci.yml | 22 +++++++++++++++++----- codecov.yml | 13 ++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e8cf18113..11d29d705f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,7 +126,7 @@ jobs: run_tests: true meson_options: -Dbuildtype=debug -Db_coverage=true --werror coverage: true - enabled: ${{ github.event_name != 'pull_request' && needs.changes.outputs.edited == 'true' }} + enabled: ${{ needs.changes.outputs.edited == 'true' }} timeout: 60 allow_failure: false - name: capstone-sys @@ -189,6 +189,9 @@ jobs: - name: Install meson and ninja if: matrix.build_system == 'meson' && matrix.enabled run: pip3 install --user meson ninja PyYAML + - name: Install meson and ninja + if: matrix.coverage && matrix.enabled + run: pip3 install --user gcovr - name: Checkout rzpipe if: matrix.enabled uses: actions/checkout@v4 @@ -299,10 +302,19 @@ jobs: ASAN: ${{ matrix.asan }} ASAN_OPTIONS: ${{ matrix.asan_options }} CC: ${{ matrix.compiler }} - - name: Upload coverage info - if: matrix.coverage == '1' && matrix.enabled - working-directory: build - run: bash <(curl -s https://codecov.io/bash) -Q github-action -n -F + - name: Generate coverage data + if: matrix.coverage + run: | + gcovr --version + gcovr --gcov-ignore-parse-errors=all --txt build/coverage.txt --cobertura build/coverage.xml build + - name: Upload coverage to Codecov + if: matrix.coverage + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: build/ + fail_ci_if_error: true + verbose: true - name: Run fuzz tests if: matrix.run_tests && matrix.enabled && (github.event_name != 'pull_request' || contains(github.event.pull_request.head.ref, 'fuzz')) run: | diff --git a/codecov.yml b/codecov.yml index f60f8f8ad9..df12ca5743 100644 --- a/codecov.yml +++ b/codecov.yml @@ -6,19 +6,22 @@ coverage: - dev - 'release-*' if_not_found: failure - if_ci_failed: error - informational: true + target: auto + threshold: 0.1% patch: default: if_not_found: success - if_ci_failed: success - informational: true + target: auto + threshold: 0.1% ignore: - "binrz/rz-test" + - ".github" - "doc" - "man" - "mk" - "sys" - "test" -comment: false +comment: + layout: "header, files, components, footer" + require_changes: true