1- # This doesn't work currently there is a bug in the output of grcov
21on :
32 push :
43 branches :
54 - main
6- - trying
5+ pull_request :
6+
7+ env :
8+ CI_TWITCH_API_FEATURES : " twitch_oauth2/all all unsupported deny_unknown_fields ureq"
79
810name : Code Coverage
911jobs :
1012 coverage :
1113 name : Run test coverage
1214 runs-on : ubuntu-latest
1315 continue-on-error : true
14- # cov is broken upstream, see https://github.com/rust-lang/rust/issues/79645, fix in https://github.com/rust-lang/rust/issues/93054
15- if : " false"
1616 steps :
1717 - uses : actions/checkout@v4
1818 with :
@@ -23,27 +23,32 @@ jobs:
2323 toolchain : nightly
2424 components : llvm-tools-preview
2525 - uses : Swatinem/rust-cache@v2
26+
2627 - name : Install cargo-llvm-cov
2728 run : curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
29+
2830 - name : Generate code coverage for tests
29- run : cargo llvm-cov --no-report --tests --features "twitch_oauth2/all all unsupported deny_unknown_fields trace_unknown_fields"
31+ run : cargo llvm-cov --no-report --tests --features "${{ env.CI_TWITCH_API_FEATURES }} _all trace_unknown_fields"
3032 - name : Generate code coverage for tests without any features
3133 run : cargo llvm-cov --no-report --tests
3234 - name : Generate code coverage for examples
33- run : cargo llvm-cov --no-report --examples --features "twitch_oauth2/all all unsupported deny_unknown_fields trace_unknown_fields"
34- # - name: Generate code coverage for docs
35- # run: cargo llvm-cov --no-report --doc --features "twitch_oauth2/all all unsupported deny_unknown_fields trace_unknown_fields"
35+ run : cargo llvm-cov --no-report --examples --features "${{ env.CI_TWITCH_API_FEATURES }} _all trace_unknown_fields"
36+ # doctests take too long to complete
37+ # - name: Generate code coverage for docs
38+ # run: cargo llvm-cov --no-report --doc --features "${{ env.CI_TWITCH_API_FEATURES }} _all"
39+
3640 - name : Merge lcov.info
37- run : cargo llvm-cov --no-run --lcov --ignore-filename-regex "twitch_oauth2" --output-path lcov.info
38- - name : Determine PR number
39- if : ${{ github.ref == 'refs/heads/trying' }}
40- run : git log -1 --pretty=format:"%s" | awk '{ print "PR_NUMBER=" substr($NF,2,length($NF)-2) }' >> $GITHUB_ENV
41+ run : cargo llvm-cov report --lcov --ignore-filename-regex "twitch_oauth2" --output-path lcov.info
42+
43+ # - name: Determine PR number
44+ # if: ${{ github.event_name == 'pull_request' }}
45+ # run: git log -1 --pretty=format:"%s" | awk '{ print "PR_NUMBER=" substr($NF,2,length($NF)-2) }' >> $GITHUB_ENV
4146 # - name: Determine actual commit
4247 # if: ${{ github.ref == 'refs/heads/trying' }}
4348 # run: git rev-parse HEAD~1 | awk '{ print "ACTUAL_COMMIT_SHA=" $NF }' >> $GITHUB_ENV
4449 - name : Upload to codecov.io
4550 uses : codecov/codecov-action@v4
4651 with :
4752 files : ./lcov.info
48- override_pr : ${{ env.PR_NUMBER}}
49- # override_commit : ${{env.ACTUAL_COMMIT_SHA }}
53+ env :
54+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
0 commit comments