File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 env :
88 CARGO_TERM_COLOR : always
99 RUSTFLAGS : " -C instrument-coverage"
10- LLVM_PROFILE_FILE : " cargo-test-%p-%m.profraw"
10+ LLVM_PROFILE_FILE : " profraw/ cargo-test-%p-%m.profraw"
1111 MONGODB_URI : ${{ secrets.MONGODB_URI }}
1212 DB_NAME_TEST : ${{ secrets.DB_NAME_TEST }}
1313 DB_NAME_PRODUCTION : ${{ secrets.DB_NAME_PRODUCTION }}
3333
3434 - name : Run Tests with Coverage
3535 run : |
36+ mkdir -p profraw
3637 cargo test --verbose
3738 # Generate coverage report
38- grcov . \
39+ grcov profraw/ \
3940 --binary-path ./target/debug/deps/ \
4041 -s . \
4142 -t lcov \
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ Cargo.lock
55# Coverage
66coverage /
77* .profraw
8+ profraw /
89coverage.lcov
910
1011# Environment
Original file line number Diff line number Diff line change 44cargo clean
55rm -rf coverage/
66rm -f * .profraw
7+ mkdir -p coverage/profraw
78
89# Set environment variables for coverage
910export CARGO_INCREMENTAL=0
1011export RUSTFLAGS=" -C instrument-coverage"
11- export LLVM_PROFILE_FILE=" cargo-test-%p-%m.profraw"
12+ export LLVM_PROFILE_FILE=" coverage/profraw/ cargo-test-%p-%m.profraw"
1213
1314# Run tests with coverage
1415echo " Running tests with coverage..."
1516cargo test
1617
1718# Generate coverage report
1819echo " Generating coverage report..."
19- grcov . \
20+ grcov coverage/profraw/ \
2021 --binary-path ./target/debug/deps/ \
2122 -s . \
2223 -t html \
@@ -31,7 +32,7 @@ grcov . \
3132 -o coverage/
3233
3334# Generate lcov for Codecov
34- grcov . \
35+ grcov coverage/profraw/ \
3536 --binary-path ./target/debug/deps/ \
3637 -s . \
3738 -t lcov \
@@ -45,6 +46,9 @@ grcov . \
4546 --ignore ' src/openapi.rs' \
4647 -o coverage.lcov
4748
49+ # Clean up profraw files
50+ rm -rf coverage/profraw/
51+
4852echo " Coverage report generated at coverage/index.html"
4953echo " LCOV report generated at coverage.lcov"
5054
You can’t perform that action at this time.
0 commit comments