Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade the lcov version in github ci #311

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .codecov.yml → .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -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/::/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok,Here change root source path ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, use the relative path instead, the origin result uses the absolute path which makes the vsag/ directory deeper and meaningless in the pages of codecov.io


coverage:
precision: 2
round: down
Expand All @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/lcov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
19 changes: 14 additions & 5 deletions scripts/collect_cpp_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check the coverage under the tools directory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we just run unittest and functest in CI, so there is no coverage result about the codes in tools/

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)
Expand Down
Loading