@@ -113,125 +113,6 @@ jobs:
113
113
with :
114
114
files : lcov.info
115
115
116
- - name : Get total coverage
117
- run : |
118
- grcov . --binary-path ./target/debug/ -s . -t covdir --branch \
119
- --token YOUR_COVDIR_TOKEN --ignore-not-existing --ignore "/*" \
120
- --ignore "../*" > covdir.json
121
-
122
- - name : Evaluate code coverage value
123
- shell : bash
124
- run : |
125
- # Retrieve code coverage associated to the repository
126
- FLOAT_COVERAGE=$(jq '.coveragePercent' covdir.json)
127
- # Round the float value to the nearest value
128
- COVERAGE_OUTPUT=$(printf "%.0f" $FLOAT_COVERAGE)
129
- # If code coverage >= 80, green traffic light
130
- if [ $COVERAGE_OUTPUT -ge 80 ]
131
- then
132
- echo "$COVERAGE_OUTPUT > 80 --> Green"
133
- # If code coverage is >=60 but < 80, orange traffic light
134
- elif [ $COVERAGE_OUTPUT -ge 60 ]
135
- then
136
- echo "60 <= $COVERAGE_OUTPUT < 80 --> Orange"
137
- # Otherwise, red traffic light
138
- else
139
- echo "$COVERAGE_OUTPUT < 60 --> Red"
140
- exit 1
141
- fi
142
-
143
- static-code-analysis :
144
-
145
- runs-on : ubuntu-latest
146
-
147
- steps :
148
- - uses : actions/checkout@v3
149
-
150
- - name : Install rust-code-analysis
151
- env :
152
- RCA_LINK : https://github.com/mozilla/rust-code-analysis/releases/download
153
- RCA_VERSION : v0.0.23
154
- run : |
155
- mkdir -p $HOME/.local/bin
156
- curl -L "$RCA_LINK/$RCA_VERSION/rust-code-analysis-linux-cli-x86_64.tar.gz" |
157
- tar xz -C $HOME/.local/bin
158
- echo "$HOME/.local/bin" >> $GITHUB_PATH
159
-
160
- - name : Run rust-code-analysis
161
- run : |
162
- mkdir $HOME/rca-json
163
- # FIXME: Update rca version to analyze the entire directory of a repo
164
- rust-code-analysis-cli --metrics -O json --pr -o "$HOME/rca-json" -p src/
165
-
166
- - name : Upload rust-code-analysis json
167
- uses : actions/upload-artifact@v3
168
- with :
169
- name : rca-json-ubuntu
170
- path : ~/rca-json
171
-
172
- weighted-code-coverage :
173
-
174
- runs-on : ubuntu-latest
175
-
176
- steps :
177
- - uses : actions/checkout@v3
178
-
179
- - name : Install stable
180
- uses : actions-rs/toolchain@v1
181
- with :
182
- profile : minimal
183
- toolchain : stable
184
- override : true
185
-
186
- - name : Install grcov
187
- env :
188
- GRCOV_LINK : https://github.com/mozilla/grcov/releases/download
189
- GRCOV_VERSION : v0.8.7
190
- GRCOV_BINARY : grcov-x86_64-unknown-linux-musl.tar.bz2
191
- run : |
192
- curl -L "$GRCOV_LINK/$GRCOV_VERSION/$GRCOV_BINARY" |
193
- tar xj -C $HOME/.cargo/bin
194
-
195
- - name : Install weighted-code-coverage
196
- env :
197
- WCC_LINK : https://github.com/giovannitangredi/weighted-code-coverage/releases/download
198
- WCC_VERSION : v0.1.0
199
- WCC_BINARY : weighted-code-coverage-0.1.0-x86_64-unknown-linux-gnu.tar.gz
200
- run : |
201
- curl -L "$WCC_LINK/$WCC_VERSION/$WCC_BINARY" |
202
- tar xz -C $HOME/.cargo/bin
203
-
204
- - name : Install llvm-tools-preview
205
- run : |
206
- rustup component add llvm-tools-preview
207
-
208
- # Not necessary on a newly created image, but strictly advised
209
- - name : Run cargo clean
210
- run : |
211
- cargo clean
212
-
213
- - name : Run tests
214
- env :
215
- RUSTFLAGS : " -Cinstrument-coverage"
216
- LLVM_PROFILE_FILE : " datta-%p-%m.profraw"
217
- run : |
218
- cargo test --verbose
219
-
220
- - name : Run grcov
221
- run : |
222
- grcov . --binary-path ./target/debug/ -t coveralls -s . --token YOUR_COVERALLS_TOKEN > coveralls.json
223
-
224
- - name : Run weighted-code-coverage
225
- run : |
226
- mkdir $HOME/wcc-output
227
- weighted-code-coverage -p src/ -j coveralls.json -c --json $HOME/wcc-output/out.json
228
-
229
- - name : Upload weighted-code-coverage data
230
- uses : actions/upload-artifact@v3
231
- with :
232
- name : weighted-code-coverage-ubuntu
233
- path : ~/wcc-output/out.json
234
-
235
116
dependency-check :
236
117
237
118
runs-on : ubuntu-latest
0 commit comments