-
Notifications
You must be signed in to change notification settings - Fork 6
294 lines (245 loc) · 8.59 KB
/
av1-grain-ubuntu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
name: av1-grain-ubuntu
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check --verbose
- name: Run cargo clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --tests --benches -- -D warnings
- name: Build
run: cargo build --verbose --tests --benches
- name: Run tests
run: cargo test --verbose
- name: Generate docs
run: cargo doc --no-deps
code-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install grcov
env:
GRCOV_LINK: https://github.com/mozilla/grcov/releases/download
GRCOV_VERSION: v0.8.7
run: |
curl -L "$GRCOV_LINK/$GRCOV_VERSION/grcov-x86_64-unknown-linux-musl.tar.bz2" |
tar xj -C $HOME/.cargo/bin
- name: Install llvm-tools-preview
run: |
rustup component add llvm-tools-preview
# Not necessary on a newly created image, but strictly advised
- name: Run cargo clean
run: |
cargo clean
- name: Run tests
env:
CARGO_INCREMENTAL: 0
LLVM_PROFILE_FILE: "av1-grain-%p-%m.profraw"
RUSTFLAGS: >
-Cinstrument-coverage -Ccodegen-units=1 -Clink-dead-code
-Coverflow-checks=off
RUSTDOCFLAGS: >
-Cinstrument-coverage -Ccodegen-units=1 -Clink-dead-code
-Coverflow-checks=off
run: |
cargo test --verbose
- name: Get coverage data for coveralls
run: |
grcov . --binary-path ./target/debug/ -s . -t lcov --branch \
--ignore-not-existing --ignore "/*" --ignore "../*" -o lcov.info
- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
# - name: Get total coverage
# run: |
# grcov . --binary-path ./target/debug/ -t covdir -s . \
# --token YOUR_COVDIR_TOKEN > covdir.json
#
# - name: Evaluate code coverage value
# shell: bash
# run: |
# # Retrieve code coverage associated to the repository
# FLOAT_COVERAGE=$(jq '.coveragePercent' covdir.json)
# # Round the float value to the nearest value
# COVERAGE_OUTPUT=$(printf "%.0f" $FLOAT_COVERAGE)
# # If code coverage >= 80, green traffic light
# if [ $COVERAGE_OUTPUT -ge 80 ]
# then
# echo "$COVERAGE_OUTPUT > 80 --> Green"
# # If code coverage is >=60 but < 80, orange traffic light
# elif [ $COVERAGE_OUTPUT -ge 60 ]
# then
# echo "60 <= $COVERAGE_OUTPUT < 80 --> Orange"
# # Otherwise, red traffic light
# else
# echo "$COVERAGE_OUTPUT < 60 --> Red"
# exit 1
# fi
memory-and-threads-dynamic-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install valgrind
run: |
sudo apt-get install valgrind
# FIXME Use binaries
- name: Install cargo-valgrind
run: |
cargo install cargo-valgrind
# Usage of the `help` command as base command, please replace it
# with the effective command that valgrind has to analyze
- name: Run cargo-valgrind
run: |
cargo valgrind run -- --help
undefined-behaviour-fuzzy-dynamic-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache produced data
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.toml') }}
- name: Install Rust nightly and miri
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: miri
override: true
# FIXME Use binaries
- name: Install cargo-fuzz
run: |
cargo install cargo-fuzz --force
- name: Run miri
env:
# -Zrandomize-layout makes sure not to rely on the layout of anything
# that might change
RUSTFLAGS: -Zrandomize-layout
# -Zmiri-check-number-validity enables checking of integer and float
# validity (e.g., they must be initialized and not carry
# pointer provenance) as part of enforcing validity invariants.
# -Zmiri-tag-raw-pointers enables a lot of extra UB checks relating
# to raw pointer aliasing rules.
# -Zmiri-symbolic-alignment-check makes the alignment check more strict.
MIRIFLAGS: >
-Zmiri-check-number-validity -Zmiri-tag-raw-pointers
-Zmiri-symbolic-alignment-check
run: cargo miri test
# FIXME Create a template with a dummy series of fuzzy tests
- name: Init cargo-fuzz
run: cargo fuzz init
- name: Run cargo-fuzz
run: cargo fuzz build
static-code-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install rust-code-analysis
env:
RCA_LINK: https://github.com/mozilla/rust-code-analysis/releases/download
RCA_VERSION: v0.0.23
run: |
mkdir -p $HOME/.local/bin
curl -L "$RCA_LINK/$RCA_VERSION/rust-code-analysis-linux-cli-x86_64.tar.gz" |
tar xz -C $HOME/.local/bin
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run rust-code-analysis
run: |
mkdir $HOME/rca-json
# FIXME: Update rca version to analyze the entire directory of a repo
rust-code-analysis-cli --metrics -O json --pr -o "$HOME/rca-json" -p src/
- name: Upload rust-code-analysis json
uses: actions/upload-artifact@v3
with:
name: rca-json-ubuntu
path: ~/rca-json
weighted-code-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install grcov
env:
GRCOV_LINK: https://github.com/mozilla/grcov/releases/download
GRCOV_VERSION: v0.8.7
GRCOV_BINARY: grcov-x86_64-unknown-linux-musl.tar.bz2
run: |
curl -L "$GRCOV_LINK/$GRCOV_VERSION/$GRCOV_BINARY" |
tar xj -C $HOME/.cargo/bin
- name: Install weighted-code-coverage
env:
WCC_LINK: https://github.com/giovannitangredi/weighted-code-coverage/releases/download
WCC_VERSION: v0.1.0
WCC_BINARY: weighted-code-coverage-0.1.0-x86_64-unknown-linux-gnu.tar.gz
run: |
curl -L "$WCC_LINK/$WCC_VERSION/$WCC_BINARY" |
tar xz -C $HOME/.cargo/bin
- name: Install llvm-tools-preview
run: |
rustup component add llvm-tools-preview
# Not necessary on a newly created image, but strictly advised
- name: Run cargo clean
run: |
cargo clean
- name: Run tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "av1-grain-%p-%m.profraw"
run: |
cargo test --verbose
- name: Run grcov
run: |
grcov . --binary-path ./target/debug/ -t coveralls -s . --token YOUR_COVERALLS_TOKEN > coveralls.json
- name: Run weighted-code-coverage
run: |
mkdir $HOME/wcc-output
weighted-code-coverage -p src/ -j coveralls.json -c --json $HOME/wcc-output/out.json
- name: Upload weighted-code-coverage data
uses: actions/upload-artifact@v3
with:
name: weighted-code-coverage-ubuntu
path: ~/wcc-output/out.json