From 621a668c1c032f792a87d4b3a6a0748f11cae8f2 Mon Sep 17 00:00:00 2001 From: Xiangyu Wang Date: Fri, 10 Jan 2025 07:33:56 +0000 Subject: [PATCH] use lcov v2.3 in github ci Signed-off-by: Xiangyu Wang --- .codecov.yml => .github/codecov.yml | 6 +++++- .github/workflows/lcov.yml | 7 +++++-- scripts/collect_cpp_coverage.sh | 19 ++++++++++++++----- 3 files changed, 24 insertions(+), 8 deletions(-) rename .codecov.yml => .github/codecov.yml (82%) diff --git a/.codecov.yml b/.github/codecov.yml similarity index 82% rename from .codecov.yml rename to .github/codecov.yml index 09c1e6b8..4b3efbc6 100644 --- a/.codecov.yml +++ b/.github/codecov.yml @@ -1,10 +1,14 @@ # Configuration for CodeCov codecov: + max_report_age: off require_ci_to_pass: no notify: require_ci_to_pass: no wait_for_ci: false +fixes: + - "/__w/vsag/::/" + coverage: precision: 2 round: down @@ -22,7 +26,7 @@ coverage: if_ci_failed: error comment: - layout: "reach, diff, flags, files" + layout: "header, diff, files, footer" behavior: default require_changes: false branches: diff --git a/.github/workflows/lcov.yml b/.github/workflows/lcov.yml index c42bb020..7a4e413c 100644 --- a/.github/workflows/lcov.yml +++ b/.github/workflows/lcov.yml @@ -19,7 +19,7 @@ jobs: apt update apt install -y libcapture-tiny-perl libdatetime-perl curl jq git clone https://github.com/linux-test-project/lcov.git - cd lcov && git checkout v2.2 && make install + cd lcov && git checkout v2.3 && make install lcov --version - name: Compile with Coverage Flags run: make cov @@ -28,12 +28,15 @@ jobs: ./scripts/test_parallel_bg.sh ./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD} - name: Collect Coverage Info - run: bash scripts/collect_cpp_coverage.sh + run: | + bash scripts/collect_cpp_coverage.sh + head -n10 coverage/coverage.info - name: Upload Coverage to Codecov uses: codecov/codecov-action@v5 with: fail_ci_if_error: true files: coverage/coverage.info + disable_search: true flags: cpp token: ${{ secrets.CODECOV_TOKEN }} verbose: true diff --git a/scripts/collect_cpp_coverage.sh b/scripts/collect_cpp_coverage.sh index 195c8210..7788b457 100644 --- a/scripts/collect_cpp_coverage.sh +++ b/scripts/collect_cpp_coverage.sh @@ -4,7 +4,8 @@ set -e set -x SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -ROOT_DIR="${SCRIPTS_DIR}/../" +ROOT_DIR="$( cd "${SCRIPTS_DIR}/../" && pwd )" +PARENT_DIR="$( cd "${ROOT_DIR}/../" && pwd )" COVERAGE_DIR="${ROOT_DIR}/coverage" if [ -d "${COVERAGE_DIR}" ]; then @@ -13,17 +14,25 @@ else mkdir -p "${COVERAGE_DIR}" fi +pushd "${PARENT_DIR}" lcov --rc branch_coverage=1 \ --rc geninfo_unexecuted_blocks=1 \ --parallel 8 \ - --directory . \ + --directory vsag \ --capture \ + --substitute "s#${PARENT_DIR}/##g" \ --ignore-errors mismatch,mismatch \ --ignore-errors count,count \ --output-file ${COVERAGE_DIR}/coverage.info - -lcov --remove ${COVERAGE_DIR}/coverage.info '/usr/*' '*/build/*' '*/vsag/tests/*' --ignore-errors inconsistent,inconsistent --output-file ${COVERAGE_DIR}/coverage.info -lcov --list ${COVERAGE_DIR}/coverage.info --ignore-errors inconsistent,inconsistent +lcov --remove ${COVERAGE_DIR}/coverage.info \ + '/usr/*' \ + 'vsag/build/*' \ + 'vsag/tests/*' \ + --ignore-errors inconsistent,inconsistent \ + --output-file ${COVERAGE_DIR}/coverage.info +lcov --list ${COVERAGE_DIR}/coverage.info \ + --ignore-errors inconsistent,inconsistent +popd pushd "${COVERAGE_DIR}" coverages=$(ls coverage.info)