Skip to content

Commit 02aee3d

Browse files
committed
Use the instrumentation-based code coverage implementation
1 parent b815162 commit 02aee3d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/ci.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
111111
- name: rust toolchain ~ install
112112
uses: dtolnay/rust-toolchain@nightly
113+
- run: rustup component add llvm-tools-preview
113114
- name: install GNU patch on MacOS
114115
if: runner.os == 'macOS'
115116
run: brew install gpatch
@@ -122,8 +123,9 @@ jobs:
122123
env:
123124
CARGO_INCREMENTAL: "0"
124125
RUSTC_WRAPPER: ""
125-
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
126+
RUSTFLAGS: "-Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
126127
RUSTDOCFLAGS: "-Cpanic=abort"
128+
LLVM_PROFILE_FILE: "diffutils-%p-%m.profraw"
127129
- name: "`grcov` ~ install"
128130
id: build_grcov
129131
shell: bash
@@ -151,9 +153,9 @@ jobs:
151153
COVERAGE_REPORT_FILE="${COVERAGE_REPORT_DIR}/lcov.info"
152154
mkdir -p "${COVERAGE_REPORT_DIR}"
153155
# display coverage files
154-
grcov . --output-type files --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
156+
grcov . --output-type files --binary-path "${COVERAGE_REPORT_DIR}" | sort --unique
155157
# generate coverage report
156-
grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"
158+
grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --binary-path "${COVERAGE_REPORT_DIR}" --branch
157159
echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
158160
- name: Upload coverage results (to Codecov.io)
159161
uses: codecov/codecov-action@v4

0 commit comments

Comments
 (0)