@@ -4,8 +4,8 @@ on: [push, workflow_dispatch]
44
55env :
66 CARGO_TERM_COLOR : always
7- # causes CI to fail on any warning
8- RUSTFLAGS : -D warnings
7+ # `-D warnings` causes CI to fail on any warning
8+ RUSTFLAGS : -D warnings -C instrument-coverage -C link-dead-code
99 RUSTDOCFLAGS : -D warnings
1010
1111jobs :
3636 rustup install nightly
3737 rustup override set nightly
3838 rustup component add --toolchain nightly rustfmt clippy
39+ cargo install cargo-binutils
40+ rustup component add llvm-tools-preview
3941 - name : install oj-verify submodule
4042 run : |
4143 git submodule init
4648 # clear submodule afterwards to not run tests in verification-helper
4749 git submodule deinit --all -f
4850 - name : run tests
49- # regarging `--tle 2`: the oj-verify tool only allows testing in release mode
50- #
5151 # regarding `--jobs 4`: github CI runs with 4 cores
5252 # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
5353 #
6161 # since all tests are rerun on every commit anyways, there's no need for
6262 # the .verify-helper/timestamps.remote.json file
6363 run : oj-verify all --tle 10 --jobs 4 --timeout 21600
64+ # https://doc.rust-lang.org/rustc/instrument-coverage.html
65+ - name : code coverage
66+ run : |
67+ cargo profdata -- merge -sparse default_*.profraw -o json5format.profdata
68+ cargo cov -- report --use-color --ignore-filename-regex='/.cargo/registry' --instr-profile=json5format.profdata $(find target/debug/examples -type f -executable)
69+ cargo cov -- export --ignore-filename-regex='/.cargo/registry' --instr-profile=json5format.profdata $(find target/debug/examples -type f -executable) | python -c "import sys, json; l=json.load(sys.stdin)['data'][0]['totals']['lines']; assert(l['count'] == l['covered'])"
0 commit comments