-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (128 loc) · 4.57 KB
/
ci-webcodecs.yml
File metadata and controls
134 lines (128 loc) · 4.57 KB
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
name: CI / mediadecode-webcodecs
# Triggered by changes to either the WebCodecs adapter, the core
# crate it adapts (since core changes can break the adapter), or
# shared workspace files. The crate is `wasm32`-only — every
# job here builds against `wasm32-unknown-unknown`.
on:
push:
branches: [main]
paths:
- 'mediadecode/**'
- 'mediadecode-webcodecs/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci-webcodecs.yml'
pull_request:
paths:
- 'mediadecode/**'
- 'mediadecode-webcodecs/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci-webcodecs.yml'
workflow_dispatch:
schedule:
- cron: "0 1 1 * *"
env:
CARGO_TERM_COLOR: always
# `web-sys` gates WebCodecs APIs behind `--cfg web_sys_unstable_apis`.
# `.cargo/config.toml` already sets this for `cargo` invocations,
# but env-level `RUSTFLAGS` displaces config-file rustflags entirely
# — combine both here so deny-warnings and the unstable cfg coexist.
RUSTFLAGS: "-Dwarnings --cfg=web_sys_unstable_apis"
# rustdoc (used by `cargo test --doc`) reads `RUSTDOCFLAGS`, not
# `RUSTFLAGS`, so the cfg has to be repeated here or the
# `compile_error!` gate in the crate's `lib.rs` fires during
# doctest runs.
RUSTDOCFLAGS: "--cfg=web_sys_unstable_apis"
RUST_BACKTRACE: 1
jobs:
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
run: rustup update stable && rustup default stable && rustup component add rustfmt
- name: Check formatting
run: cargo fmt -p mediadecode-webcodecs -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust
run: |
rustup update stable && rustup default stable
rustup component add clippy
rustup target add wasm32-unknown-unknown
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Apply clippy lints
run: cargo hack clippy -p mediadecode-webcodecs --target wasm32-unknown-unknown --each-feature --exclude-no-default-features
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Cache cargo build and registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-webcodecs-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-webcodecs-build-
- name: Install Rust
run: |
rustup update stable && rustup default stable
rustup target add wasm32-unknown-unknown
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Run build
run: cargo hack build -p mediadecode-webcodecs --target wasm32-unknown-unknown --feature-powerset --exclude-no-default-features
test:
name: test (wasm-bindgen-test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Audio fixtures live at `tests/fixtures/audio/` as a
# submodule pointing at `findit-ai/audio-fixtures`
# (~283 MiB of mono 16 kHz pcm_s16le clips).
submodules: recursive
- name: Cache cargo build and registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-webcodecs-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-webcodecs-test-
- name: Install Rust
run: |
rustup update stable && rustup default stable
rustup target add wasm32-unknown-unknown
- name: Install wasm-bindgen-test-runner + wasm-pack
run: |
cargo install wasm-bindgen-cli --locked
cargo install wasm-pack --locked
- name: Install Chromium + chromedriver
run: |
sudo apt-get update -y
sudo apt-get install -y chromium-browser chromium-chromedriver
- name: Run wasm-bindgen-test in headless Chromium
env:
CHROMEDRIVER: /usr/bin/chromedriver
# `cargo test --target wasm32-unknown-unknown` alone only
# builds — the produced `.wasm` is not a native binary, so
# cargo's default test runner exits 126 trying to execute
# it. Route through `wasm-bindgen-test-runner` (set via
# `CARGO_TARGET_..._RUNNER`) so the test harness actually
# boots in headless Chromium.
run: |
export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER="wasm-bindgen-test-runner"
cargo test -p mediadecode-webcodecs --target wasm32-unknown-unknown