@@ -15,31 +15,46 @@ jobs:
15
15
16
16
steps :
17
17
- uses : actions/checkout@v3
18
+
18
19
- uses : actions-rs/toolchain@v1
19
20
with :
20
- toolchain : nightly
21
+ toolchain : stable
21
22
override : true
22
- - name : Build
23
- run : cargo build --verbose
24
- - name : Run tests
25
- run : cargo test
26
- # env:
27
- # CARGO_INCREMENTAL: "0"
28
- # RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
29
- # RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
30
- - name : rust-grcov
31
- # You may pin to the exact commit or the version.
32
- # uses: actions-rs/grcov@bb47b1ed7883a1502fa6875d562727ace2511248
33
- uses :
actions-rs/[email protected]
34
- - name : Codecov
35
- # You may pin to the exact commit or the version.
36
- # uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378
37
- uses : codecov/codecov-action@v4
23
+ components : llvm-tools-preview
24
+
25
+ - name : Add llvm-tools to PATH
26
+ run : echo "${HOME}/.rustup/toolchains/$(rustup show active-toolchain | cut -d' ' -f1)/bin" >> $GITHUB_PATH
27
+
28
+ - name : Install grcov
29
+ run : cargo install grcov
30
+
31
+ - name : Clean Build Artifacts
32
+ run : cargo clean
33
+
34
+ - name : Run tests with coverage
38
35
env :
39
- CODECOV_TOKEN : ${{ secrets.CODECOV_ORG_TOKEN }}
36
+ CARGO_INCREMENTAL : " 0"
37
+ RUSTFLAGS : " -C instrument-coverage -C codegen-units=1 -C debuginfo=0"
38
+ LLVM_PROFILE_FILE : " coverage-%p-%m.profraw"
39
+ run : |
40
+ cargo test --all --verbose
41
+
42
+ - name : Generate coverage report
43
+ run : |
44
+ grcov . \
45
+ --binary-path ./target/debug/ \
46
+ -s . \
47
+ -t lcov \
48
+ --branch \
49
+ --ignore-not-existing \
50
+ --llvm \
51
+ -o lcov.info
52
+
53
+ - name : Upload coverage to Codecov
54
+ uses : codecov/codecov-action@v4
40
55
with :
41
- # Repository upload token - get it from codecov.io. Required only for private repositories
42
- # token: # optional
43
- # Specify whether the Codecov output should be verbose
44
- verbose : true
56
+ files : lcov.info
45
57
fail_ci_if_error : true
58
+ verbose : true
59
+ env :
60
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
0 commit comments