From 725519516d356e6b1ba06a6be1b76c6a7fbc77c3 Mon Sep 17 00:00:00 2001 From: ZeFeng Yin Date: Fri, 10 Apr 2026 11:37:24 +0800 Subject: [PATCH] Ci: fix coverage (#331) --- .github/workflows/nightly_coverage.yml | 12 +++++++++--- cmake/bazel.cmake | 1 + scripts/gcov.sh | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nightly_coverage.yml b/.github/workflows/nightly_coverage.yml index 629a3b9..1279496 100644 --- a/.github/workflows/nightly_coverage.yml +++ b/.github/workflows/nightly_coverage.yml @@ -24,7 +24,7 @@ jobs: - name: Checkout code uses: actions/checkout@v6 with: - ref: main # Always use main for nightly + ref: main # Always use main for nightly submodules: recursive - name: Set up Python @@ -45,9 +45,16 @@ jobs: echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH shell: bash + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y lcov + shell: bash + - name: Install dependencies run: | python -m pip install --upgrade pip \ + pybind11==3.0 \ cmake==3.30.0 \ ninja==1.11.1 \ pytest \ @@ -64,8 +71,7 @@ jobs: CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \ python -m pip install -v . \ --no-build-isolation \ - --config-settings="cmake.build-type=COVERAGE" \ - --config-settings='cmake.define.ENABLE_ZEN3="ON"' + --config-settings="cmake.build-type=COVERAGE" shell: bash - name: Run Python Tests with Coverage diff --git a/cmake/bazel.cmake b/cmake/bazel.cmake index 8299482..4fb1e58 100644 --- a/cmake/bazel.cmake +++ b/cmake/bazel.cmake @@ -463,6 +463,7 @@ set( "$<$:$<$:--coverage>>" "$<$:$<$:--coverage>>" "$<$:$<$:--coverage>>" + "$<$:-fprofile-update=atomic>" ) # C/C++ strict compile flags diff --git a/scripts/gcov.sh b/scripts/gcov.sh index 3625b6e..64e810b 100755 --- a/scripts/gcov.sh +++ b/scripts/gcov.sh @@ -26,8 +26,8 @@ while getopts t:p:o:zk option; do done # Process sources -lcov -c -b "$source_base" -d . -o $project_name.lcov.info --gcov-tool=$gcov_tool --no-external || exit 1 -eval $(echo lcov -r $project_name.lcov.info -o $project_name-filtered.lcov.info $filter_list) || exit 1 +lcov -c -b "$source_base" -d . -o $project_name.lcov.info --gcov-tool=$gcov_tool --no-external --keep-going --ignore-errors unused,mismatch || exit 1 +eval $(echo lcov -r $project_name.lcov.info -o $project_name-filtered.lcov.info $filter_list --ignore-errors unused,mismatch) || exit 1 # Gather HTML files genhtml -t "$project_name" -o $output_name $project_name-filtered.lcov.info || exit 1