Skip to content

Commit 2c4a5dd

Browse files
authored
Merge pull request #263 from cakebaker/ci_fix_code_coverage
ci: use `-Cinstrument-coverage` instead of `-Zprofile`
2 parents bc66596 + e9a4a1d commit 2c4a5dd

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,16 @@ jobs:
6969
7070
- name: rust toolchain ~ install
7171
uses: dtolnay/rust-toolchain@nightly
72-
- name: set RUSTFLAGS
73-
shell: bash
74-
run: |
75-
if [ "$RUNNER_OS" == "Windows" ]; then
76-
# -Clink-dead-code conflicts with sysinfo crate and leads to STATUS_DLL_NOT_FOUND error, so we don't use it on Windows
77-
echo "RUSTFLAGS=-Zprofile -Ccodegen-units=1 -Copt-level=0 -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" >> $GITHUB_ENV
78-
else
79-
echo "RUSTFLAGS=-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" >> $GITHUB_ENV
80-
fi
72+
with:
73+
components: llvm-tools-preview
8174
- name: Test
8275
run: cargo test --no-fail-fast
8376
env:
8477
CARGO_INCREMENTAL: "0"
8578
RUSTC_WRAPPER: ""
79+
RUSTFLAGS: "-Cinstrument-coverage -Zcoverage-options=branch -Ccodegen-units=1 -Copt-level=0 -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
8680
RUSTDOCFLAGS: "-Cpanic=abort"
81+
LLVM_PROFILE_FILE: "procps-%p-%m.profraw"
8782
- name: "`grcov` ~ install"
8883
id: build_grcov
8984
shell: bash
@@ -111,9 +106,9 @@ jobs:
111106
COVERAGE_REPORT_FILE="${COVERAGE_REPORT_DIR}/lcov.info"
112107
mkdir -p "${COVERAGE_REPORT_DIR}"
113108
# display coverage files
114-
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
109+
grcov . --binary-path="${COVERAGE_REPORT_DIR}" --output-type files --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
115110
# generate coverage report
116-
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\()"
111+
grcov . --binary-path="${COVERAGE_REPORT_DIR}" --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\()"
117112
echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
118113
- name: Upload coverage results (to Codecov.io)
119114
uses: codecov/codecov-action@v4

0 commit comments

Comments
 (0)