From 7f40dd8b5b2b9e917c06f5cf15f5d050655009d3 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 28 Jul 2024 13:58:26 -0400 Subject: [PATCH] CI: Fix codecov upload --- .github/workflows/coverage.yml | 4 +++- nodist/code_coverage | 15 +++++++++------ nodist/fastcov.py | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a9e25c4ed..997a95e4b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -100,4 +100,6 @@ jobs: - name: Upload coverage data to Codecov env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: ( cd nodist/obj_dir/upload && ../../../ci/codecov -v do-upload -Z --sha ${{ github.sha }} -f ../../../nodist/obj_dir/coverage/app_total.info ) + run: | + find . -name '*.gcno' -exec rm {} \; + ./ci/codecov -v do-upload -Z --sha ${{ github.sha }} -f nodist/obj_dir/coverage/app_total.info diff --git a/nodist/code_coverage b/nodist/code_coverage index 5d2f6f126..645b0ce9a 100755 --- a/nodist/code_coverage +++ b/nodist/code_coverage @@ -181,14 +181,17 @@ def test(): ci_fold_start("upload") print("Stage 18: Upload") # curl -Os https://cli.codecov.io/latest/linux/codecov ; sudo chmod +x codecov - # --disable-search does not seem to work, so we use a temp directory + # --disable-search does not seem to work + # -d with false directory does not seem to work + # So, remove gcno files before calling codecov upload_dir = "nodist/obj_dir/upload" os.makedirs(upload_dir, exist_ok=True) - cmd = ("( cd " + upload_dir + - " && ../../../ci/codecov -v do-upload --fail-on-error" + - " -f ../../../" + cc_dir + "/app_total.info )") - print("print: Not running: export CODECOV_TOKEN=") - print("print: Not running: " + cmd) + cmd = ("ci/codecov -v upload-process -Z" + + " -f " + cc_dir + "/app_total.info )") + print("print: Not running:") + print(" export CODECOV_TOKEN=") + print(" find . -name '*.gcno' -exec rm {} \;") + print(" " + cmd) ci_fold_end() if Args.stage_enabled[19]: diff --git a/nodist/fastcov.py b/nodist/fastcov.py index 68bbb26dd..3fb5c66e9 100755 --- a/nodist/fastcov.py +++ b/nodist/fastcov.py @@ -675,7 +675,7 @@ def distillLine(line_raw, lines, branches, include_exceptional_branches): count = int(line_raw["count"]) if count < 0: if "function_name" in line_raw: - logging.warning("Ignoring negative count found in %s.", line_raw["function_name"]) + logging.warning("Ignoring negative count found in '%s'.", line_raw["function_name"]) else: logging.warning("Ignoring negative count.") count = 0