File tree Expand file tree Collapse file tree 3 files changed +60
-1
lines changed Expand file tree Collapse file tree 3 files changed +60
-1
lines changed Original file line number Diff line number Diff line change
1
+ coverage :
2
+ status :
3
+ project :
4
+ default :
5
+ enabled : yes
6
+ target : auto # auto compares coverage to the previous base commit
7
+ # adjust accordingly based on how flaky your tests are
8
+ # this allows a 1% drop from the previous base commit coverage
9
+ threshold : 1%
10
+ patch :
11
+ default :
12
+ target : 25% # the required coverage value in each patch
13
+
14
+ comment :
15
+ layout : " reach, diff, flags, files"
16
+ behavior : default
17
+ require_changes : false # if true: only post the comment if coverage changes
18
+
19
+ codecov :
20
+ require_ci_to_pass : false
21
+ notify :
22
+ wait_for_ci : false
23
+
24
+ # When modifying this file, please validate using
25
+ # curl -X POST --data-binary @codecov.yml https://codecov.io/validate
Original file line number Diff line number Diff line change @@ -141,6 +141,26 @@ jobs:
141
141
run : |
142
142
make ut
143
143
144
+ nydus-unit-test-coverage :
145
+ runs-on : ubuntu-latest
146
+ env :
147
+ CARGO_TERM_COLOR : always
148
+ steps :
149
+ - uses : actions/checkout@v3
150
+ - name : Rust Cache
151
+
152
+ with :
153
+ cache-on-failure : true
154
+ - name : Install cargo-llvm-cov
155
+ uses : taiki-e/install-action@cargo-llvm-cov
156
+ - name : Generate code coverage
157
+ run : make coverage-codecov
158
+ - name : Upload coverage to Codecov
159
+ uses : codecov/codecov-action@v3
160
+ with :
161
+ files : codecov.json
162
+ fail_ci_if_error : true
163
+
144
164
nydus-cargo-deny :
145
165
name : cargo-deny
146
166
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ INSTALL_DIR_PREFIX ?= "/usr/local/bin"
15
15
DOCKER ?= "true"
16
16
17
17
CARGO ?= $(shell which cargo)
18
+ RUSTUP ?= $(shell which rustup)
18
19
CARGO_BUILD_GEARS = -v ~/.ssh/id_rsa:/root/.ssh/id_rsa -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry
19
20
SUDO = $(shell which sudo)
20
21
CARGO_COMMON ?=
@@ -111,6 +112,19 @@ install: release
111
112
ut : .release_version
112
113
TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX ) RUST_BACKTRACE=1 ${CARGO} test --workspace $(EXCLUDE_PACKAGES ) $(CARGO_COMMON ) $(CARGO_BUILD_FLAGS ) -- --skip integration --nocapture --test-threads=8
113
114
115
+ # install test dependencies
116
+ pre-coverage :
117
+ ${CARGO} +stable install cargo-llvm-cov --locked
118
+ ${RUSTUP} component add llvm-tools-preview
119
+
120
+ # print unit test coverage to console
121
+ coverage : pre-coverage
122
+ TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX ) ${CARGO} llvm-cov --workspace $(EXCLUDE_PACKAGES ) $(CARGO_COMMON ) $(CARGO_BUILD_FLAGS ) -- --skip integration --nocapture --test-threads=8
123
+
124
+ # write unit teset coverage to codecov.json, used for Github CI
125
+ coverage-codecov :
126
+ TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX ) ${CARGO} llvm-cov --codecov --output-path codecov.json --workspace $(EXCLUDE_PACKAGES ) $(CARGO_COMMON ) $(CARGO_BUILD_FLAGS ) -- --skip integration --nocapture --test-threads=8
127
+
114
128
smoke-only :
115
129
make -C smoke test
116
130
@@ -214,4 +228,4 @@ docker-example: all-static-release
214
228
@docker exec $$ cid /run.sh
215
229
@EXIT_CODE=$$?
216
230
@docker rm -f $$ cid
217
- @exit $$ EXIT_CODE
231
+ @exit $$ EXIT_CODE
You can’t perform that action at this time.
0 commit comments