File tree 1 file changed +49
-0
lines changed
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 90
90
91
91
- run : cargo check ${{ matrix.RUST.FLAGS }}
92
92
93
+ coverage :
94
+ runs-on : ubuntu-latest
95
+ steps :
96
+ - uses : actions/checkout@v3
97
+ with :
98
+ persist-credentials : false
99
+
100
+ - uses : dtolnay/rust-toolchain@1ce4a7352a1efe5dede2e52c75512b34256e4f44
101
+ with :
102
+ toolchain : nightly
103
+ components : llvm-tools-preview
104
+
105
+ - run : sudo apt-get install -y lcov
106
+
107
+ - uses : actions/cache@v3
108
+ id : cargo-cache
109
+ with :
110
+ path : |
111
+ ~/.cargo/bin/
112
+ ~/.cargo/registry/index/
113
+ ~/.cargo/registry/cache/
114
+ ~/.cargo/git/db/
115
+ target/
116
+ key : ${{ runner.os }}-cargo-4-${{ hashFiles('**/Cargo.toml') }}
117
+
118
+ - run : cargo install cargo-binutils
119
+ if : steps.cargo-cache.outputs.cache-hit != 'true'
120
+
121
+ - run : cargo test
122
+ env :
123
+ RUSTFLAGS : " -Cinstrument-coverage"
124
+ LLVM_PROFILE_FILE : " rust-cov/cov-%m-%p.profraw"
125
+
126
+ - run : |
127
+ set -xe
128
+ cargo profdata -- merge -sparse rust-cov/*.profraw -o cargo-test-rust-cov.profdata
129
+ cargo cov -- export \
130
+ $(env RUSTFLAGS="-Cinstrument-coverage" cargo test --tests --no-run --message-format=json | jq -r "select(.profile.test == true) | .filenames[]") \
131
+ -instr-profile=cargo-test-rust-cov.profdata \
132
+ --ignore-filename-regex='/.cargo/registry' \
133
+ --ignore-filename-regex='/rustc/' \
134
+ --ignore-filename-regex='/.rustup/toolchains/' --format=lcov > cargo-test.lcov
135
+
136
+ genhtml cargo-test.lcov -o coverage-html
137
+
138
+ with :
139
+ name : coverage-html
140
+ path : coverage-html
141
+
93
142
fuzz :
94
143
runs-on : ubuntu-latest
95
144
strategy :
You can’t perform that action at this time.
0 commit comments