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
name: Test
on:
pull_request:
push:
workflow_call:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Build with only line information enabled to decrease compilation
# time and binary artifact sizes in CI, while still providing relevant
# data in backtraces. This option is assumed to only have marginal
# effects on the generated code, likely only in terms of section
# arrangement. See
# https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo
RUSTFLAGS: '-C debuginfo=line-tables-only'
jobs:
test-native:
name: Test native
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- name: Test
run: cargo test-native
test-wasm:
name: Test WASM
runs-on: ubuntu-latest
env:
# wasm-bindgen does not seem to be handling RUSTFLAGS properly,
# causing spurious rebuilds due to cargo complaining that the
# variable has changed. To work around that problem, just unset it
# here. Sigh.
RUSTFLAGS: ''
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- run: |
sudo apt-get update
# Node.js is the default test backend and we don't change it for the
# unit tests. All other tests run in a headless browser, we use
# Firefox.
sudo apt-get install --no-upgrade --assume-yes nodejs firefox
- name: Test
run: cargo test-wasm
clippy:
name: Lint with clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --no-deps --all-targets --workspace -- -A unknown_lints -D warnings