Skip to content

Commit 78877a1

Browse files
authored
Merge pull request #92 from cakebaker/ci_fix_code_coverage
ci: use `-Cinstrument-coverage` instead of `-Zprofile`
2 parents 623c626 + 9b266bc commit 78877a1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,22 @@ jobs:
7575
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
7676
outputs TOOLCHAIN
7777
# target-specific options
78-
# * CARGO_FEATURES_OPTION
79-
CARGO_FEATURES_OPTION='--all -- --check' ; ## default to '--all-features' for code coverage
8078
# * CODECOV_FLAGS
8179
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
8280
outputs CODECOV_FLAGS
8381
8482
- name: rust toolchain ~ install
8583
uses: dtolnay/rust-toolchain@nightly
84+
with:
85+
components: llvm-tools-preview
8686
- name: Test
87-
run: cargo test ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-fail-fast
87+
run: cargo test --no-fail-fast
8888
env:
8989
CARGO_INCREMENTAL: "0"
9090
RUSTC_WRAPPER: ""
91-
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
91+
RUSTFLAGS: "-Cinstrument-coverage -Zcoverage-options=branch -Ccodegen-units=1 -Copt-level=0 -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
9292
RUSTDOCFLAGS: "-Cpanic=abort"
93+
LLVM_PROFILE_FILE: "parse_datetime-%p-%m.profraw"
9394
- name: "`grcov` ~ install"
9495
id: build_grcov
9596
shell: bash
@@ -117,13 +118,12 @@ jobs:
117118
COVERAGE_REPORT_FILE="${COVERAGE_REPORT_DIR}/lcov.info"
118119
mkdir -p "${COVERAGE_REPORT_DIR}"
119120
# display coverage files
120-
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
121+
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
121122
# generate coverage report
122-
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\()"
123+
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\()"
123124
echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
124125
- name: Upload coverage results (to Codecov.io)
125126
uses: codecov/codecov-action@v4
126-
# if: steps.vars.outputs.HAS_CODECOV_TOKEN
127127
with:
128128
token: ${{ secrets.CODECOV_TOKEN }}
129129
file: ${{ steps.coverage.outputs.report }}

0 commit comments

Comments
 (0)