-
Notifications
You must be signed in to change notification settings - Fork 252
523 lines (492 loc) · 17.1 KB
/
rav1e.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
name: rav1e
on:
push:
branches:
- master
- 0.*
pull_request:
branches:
- master
- 0.*
jobs:
rustfmt-clippy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ilammy/setup-nasm@v1
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Run rustfmt
run: |
cargo fmt -- --check --verbose
- name: Run clippy
uses: clechasseur/rs-clippy-check@v3
with:
args: -- -D warnings
msrv:
runs-on: ubuntu-22.04
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: '-Dwarnings'
steps:
- uses: actions/checkout@v4
# Minimum version in build.rs
- name: Install NASM 2.15
uses: ilammy/setup-nasm@v1
with:
version: 2.15
# Minimum version in Cargo.toml
- name: Install Rust 1.74.0
uses: dtolnay/[email protected]
with:
targets: wasm32-unknown-unknown, wasm32-wasi
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
- name: Run cargo check
run: cargo check
- name: Run cargo check (wasm32)
run: >
cargo check
--target wasm32-unknown-unknown
--no-default-features
-F wasm
- name: Run cargo check (wasi)
run: >
cargo check
--target wasm32-wasi
--no-default-features
wasi:
runs-on: ubuntu-22.04
needs: [rustfmt-clippy, msrv]
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: '-Dwarnings'
CARGO_TARGET_WASM32_WASI_RUNNER: wasmtime
steps:
- uses: actions/checkout@v4
- name: Install wasmtime
uses: taiki-e/install-action@wasmtime
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-wasi
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: >
cargo test
--target wasm32-wasi
--no-default-features
build-unix:
strategy:
matrix:
conf:
- beta-build
- 1.74.0-tests
- aom-tests
- dav1d-tests
- no-asm-tests
- grcov-codecov
- bench
- doc
- cargo-c
- check-no-default
- check-extra-feats
- check-unstable-feats
- fuzz
include:
- conf: beta-build
toolchain: beta
- conf: 1.74.0-tests
toolchain: 1.74.0
- conf: aom-tests
toolchain: stable
- conf: dav1d-tests
toolchain: stable
- conf: dav1d-tests-arm64
toolchain: stable
- conf: no-asm-tests
toolchain: stable
- conf: grcov-codecov
toolchain: stable
- conf: bench
toolchain: stable
- conf: doc
toolchain: stable
- conf: cargo-c
toolchain: stable
- conf: check-no-default
toolchain: stable
- conf: check-extra-feats
toolchain: stable
- conf: check-unstable-feats
toolchain: stable
- conf: fuzz
toolchain: stable
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 300M
SCCACHE_DIR: /home/runner/.cache/sccache
SCCACHE_IDLE_TIMEOUT: 0
runs-on: ubuntu-22.04
needs: [rustfmt-clippy, msrv]
steps:
- uses: actions/checkout@v4
- name: Set no-asm-tests env vars
if: matrix.conf == 'no-asm-tests'
run: |
echo "name=RAV1E_CPU_TARGET::rust" >> $GITHUB_ENV
- name: Install sccache
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: 0.2.15
run: |
SCCACHE_FILE=sccache-v$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/v$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
chmod +x $SCCACHE_FILE/sccache
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
if: matrix.conf != 'dav1d-tests-arm64'
run: |
sudo sed -i 's/jammy/lunar/g' /etc/apt/sources.list
sudo rm /etc/apt/sources.list.d/*.list
sudo apt update
sudo apt install nasm libaom-dev meson ninja-build nasm
- name: Install cargo-c
if: matrix.conf == 'cargo-c'
env:
LINK: https://github.com/lu-zero/cargo-c/releases/latest/download
run: |
curl -L "$LINK/cargo-c-x86_64-unknown-linux-musl.tar.gz" |
tar xz -C $HOME/.cargo/bin
- name: Install grcov
if: matrix.conf == 'grcov-codecov'
env:
LINK: https://github.com/mozilla/grcov/releases/latest/download
run: |
curl -L "$LINK/grcov-x86_64-unknown-linux-musl.tar.bz2" |
tar xj -C $HOME/.cargo/bin
- name: Install Intel SDE
if: matrix.conf == 'grcov-codecov'
uses: petarpetrovt/[email protected]
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Install llvm-tools-preview
if: matrix.conf == 'grcov-codecov'
run: |
rustup component add llvm-tools-preview
- name: Install aarch64 toolchain, qemu-user and libdav1d deps
if: matrix.conf == 'dav1d-tests-arm64'
env:
LINK: http://ports.ubuntu.com/ubuntu-ports/pool
run: |
rustup target add aarch64-unknown-linux-gnu
{ echo 'deb [arch=amd64] http://azure.archive.ubuntu.com/ubuntu lunar main universe'
echo 'deb [arch=amd64] http://azure.archive.ubuntu.com/ubuntu lunar-updates main universe'
echo 'deb [arch=arm64] http://azure.ports.ubuntu.com/ lunar main universe'
} | sudo tee /etc/apt/sources.list
sudo dpkg --add-architecture arm64
sudo apt update
sudo apt install qemu-user gcc-aarch64-linux-gnu meson ninja-build nasm
- name: Generate Cargo.version for cache key
run: |
cargo --version > Cargo.version
- name: Cache cargo registry
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/.cargo/registry/cache
key: ${{ runner.os }}-${{ matrix.conf }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.conf }}-cargo-registry-
- name: Cache sccache output
uses: actions/cache@v4
continue-on-error: true
with:
path: /home/runner/.cache/sccache
key: ${{ runner.os }}-${{ matrix.conf }}-sccache-${{ hashFiles('**/Cargo.*') }}
restore-keys: |
${{ runner.os }}-${{ matrix.conf }}-sccache-
- name: Start sccache server
run: |
sccache --start-server
- name: Run 1.74.0 tests
if: matrix.toolchain == '1.74.0' && matrix.conf == '1.74.0-tests'
run: |
cargo test --workspace --verbose \
--features=decode_test,decode_test_dav1d,quick_test,capi
- name: Run aom tests
if: matrix.toolchain == 'stable' && matrix.conf == 'aom-tests'
run: |
cargo test --workspace --verbose --release \
--features=decode_test \
--color=always -- --color=always --ignored
- name: Run dav1d tests
if: matrix.toolchain == 'stable' && (matrix.conf == 'dav1d-tests' || matrix.conf == 'no-asm-tests')
run: |
cargo test --workspace --verbose --release \
--features=decode_test_dav1d \
--color=always -- --color=always --ignored
- name: Run dav1d tests (arm64)
if: matrix.conf == 'dav1d-tests-arm64'
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER: qemu-aarch64 -L /usr/aarch64-linux-gnu
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS: -Clinker=aarch64-linux-gnu-gcc
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
PKG_CONFIG_SYSROOT_DIR: /
run: |
cargo test --lib --verbose --release --target=aarch64-unknown-linux-gnu \
--no-default-features --features=asm,decode_test_dav1d -- \
--include-ignored
- name: Run build
if: matrix.conf == 'beta-build'
run: |
cargo build --verbose
- name: Run bench
if: matrix.toolchain == 'stable' && matrix.conf == 'bench'
run: |
cargo bench --features=bench --no-run --verbose
- name: Run doc
if: matrix.toolchain == 'stable' && matrix.conf == 'doc'
run: |
cargo doc --verbose --no-deps
- name: Check no default features
if: matrix.toolchain == 'stable' && matrix.conf == 'check-no-default'
run: |
cargo check --no-default-features
- name: Check extra features
if: matrix.toolchain == 'stable' && matrix.conf == 'check-extra-feats'
run: |
cargo check --features=check_asm,capi,dump_lookahead_data,serialize,bench,tracing --all-targets
- name: Check extra features
if: matrix.toolchain == 'stable' && matrix.conf == 'check-unstable-feats'
run: |
cargo check --features=unstable,channel-api
- name: Run cargo-c
if: matrix.conf == 'cargo-c'
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
run: |
cargo fetch
cargo cbuild --offline
- name: Install cargo-fuzz
if: matrix.conf == 'fuzz'
run: |
cargo install cargo-fuzz
- name: Run cargo-fuzz
if: matrix.conf == 'fuzz'
run: |
cargo fuzz build --sanitizer none
- name: Run cargo clean
if: matrix.conf == 'grcov-codecov'
run: |
cargo clean
- name: Run tests with coverage
if: matrix.conf == 'grcov-codecov'
env:
CARGO_INCREMENTAL: 0
LLVM_PROFILE_FILE: "rav1e-%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
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: >
${{ env.SDE_PATH }}/sde -icx --
run: |
cargo test --workspace --target x86_64-unknown-linux-gnu \
--lib --test doctests \
--features=decode_test,decode_test_dav1d,quick_test
cargo test --workspace --target x86_64-unknown-linux-gnu \
--doc \
--features=decode_test,decode_test_dav1d,quick_test
- name: Run unit tests
if: matrix.conf == 'no-asm-tests'
run: |
cargo test --workspace --verbose
- name: Run grcov
if: matrix.conf == 'grcov-codecov'
run: |
grcov . --binary-path ./target/x86_64-unknown-linux-gnu/debug/ -s . \
-t lcov --branch --ignore-not-existing --ignore "/*" \
--ignore "../*" --ignore "target/*" --ignore "examples/*" \
--ignore "tests/*" --ignore "src/test_encode_decode/*" \
--ignore "src/x86/*" --ignore "src/ext/x86/*" \
--excl-line "grcov-excl-line|.*unreachable.*" \
--ignore "tools/*" --ignore "crates/*" -o lcov.info
- name: Stop sccache server
run: |
sccache --stop-server
- name: Codecov upload
if: matrix.conf == 'grcov-codecov'
uses: codecov/codecov-action@v4
with:
files: lcov.info
build-macos:
strategy:
matrix:
include:
- name: Cargo build (x64)
conf: cargo-build
target: x86_64-apple-darwin
- name: Cargo test (x64)
conf: cargo-test
target: x86_64-apple-darwin
- name: Cargo C-build (x64)
conf: cargo-c
target: x86_64-apple-darwin
- name: Cargo build (Arm64)
conf: cargo-build
target: aarch64-apple-darwin
- name: Cargo C-build (Arm64)
conf: cargo-c
target: aarch64-apple-darwin
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 300M
SCCACHE_DIR: /Users/runner/Library/Caches/Mozilla.sccache
runs-on: macos-latest
needs: [rustfmt-clippy, msrv]
steps:
- uses: actions/checkout@v4
- name: Install sccache
run: |
brew install sccache
- name: Install nasm
run: |
brew install nasm
- name: Install cargo-c
if: matrix.conf == 'cargo-c'
run: |
brew install cargo-c
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Generate Cargo.version for cache key
run: |
cargo --version > Cargo.version
- name: Cache cargo registry
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/.cargo/registry/cache
key: ${{ runner.os }}-${{ matrix.conf }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.conf }}-cargo-registry-
- name: Cache sccache output
uses: actions/cache@v4
continue-on-error: true
with:
path: /Users/runner/Library/Caches/Mozilla.sccache
key: ${{ runner.os }}-${{ matrix.conf }}-sccache-${{ hashFiles('**/Cargo.*') }}
restore-keys: |
${{ runner.os }}-${{ matrix.conf }}-sccache-
- name: Start sccache server
run: |
sccache --start-server
- name: Build
if: matrix.conf == 'cargo-build'
run: |
cargo build --release --target=${{ matrix.target }}
- name: Test
if: matrix.conf == 'cargo-test'
run: |
cargo test --workspace --verbose --target=${{ matrix.target }}
- name: Run cargo-c
if: matrix.conf == 'cargo-c'
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
run: |
cargo fetch
cargo cbuild --target=${{ matrix.target }} --offline
- name: Stop sccache server
run: |
sccache --stop-server
build-windows:
strategy:
matrix:
include:
- conf: cargo-build
target: x86_64-pc-windows-msvc
- conf: cargo-test
target: x86_64-pc-windows-msvc
- conf: cargo-c
target: x86_64-pc-windows-gnu
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 300M
SCCACHE_DIR: C:\sccache
runs-on: windows-latest
needs: [rustfmt-clippy, msrv]
steps:
- uses: actions/checkout@v4
- uses: ilammy/setup-nasm@v1
- name: Install sccache
run: |
$LINK = "https://github.com/mozilla/sccache/releases/download/0.2.12"
$SCCACHE_FILE = "sccache-0.2.12-x86_64-pc-windows-msvc"
curl -LO "$LINK/$SCCACHE_FILE.tar.gz"
tar xzf "$SCCACHE_FILE.tar.gz"
echo "$Env:GITHUB_WORKSPACE/$SCCACHE_FILE" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install stable-${{ matrix.target }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable-${{ matrix.target }}
- name: Install cargo-c
if: matrix.conf == 'cargo-c'
run: |
$LINK = "https://github.com/lu-zero/cargo-c/releases/latest/download"
$CARGO_C_FILE = "cargo-c-windows-msvc"
curl -LO "$LINK/$CARGO_C_FILE.zip"
7z e -y "$CARGO_C_FILE.zip" -o"${env:USERPROFILE}\.cargo\bin"
- name: Generate Cargo.version for cache key
run: |
cargo --version > Cargo.version
- name: Cache cargo registry
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/.cargo/registry/cache
key: ${{ runner.os }}-${{ matrix.conf }}-${{ matrix.target }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.conf }}-${{ matrix.target }}-cargo-registry-
- name: Cache sccache output
uses: actions/cache@v4
continue-on-error: true
with:
path: C:\sccache
key: ${{ runner.os }}-${{ matrix.conf }}-${{ matrix.target }}-sccache-${{ hashFiles('**/Cargo.*') }}
restore-keys: |
${{ runner.os }}-${{ matrix.conf }}-${{ matrix.target }}-sccache-
- name: Start sccache server
run: |
sccache --start-server
- name: Build
if: matrix.conf == 'cargo-build'
run: |
cargo build --release
- name: Test
if: matrix.conf == 'cargo-test'
run: |
cargo test --workspace --verbose
- name: Run cargo-c
if: matrix.conf == 'cargo-c'
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
run: |
cargo fetch
cargo cbuild --offline
- name: Stop sccache server
run: |
sccache --stop-server