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
name: Lint
# Mirror the local pre-push hook's format and lint gates (`cargo fmt --check`
# and `cargo clippy`) in CI, so style and lint regressions are caught on every
# PR even when a contributor hasn't installed the git hooks. HEAD has
# historically drifted out of clippy/fmt compliance between hook runs; this gate
# keeps `main` green against the same standard the hook enforces locally.
#
# fmt and clippy run as separate jobs so a formatting failure and a lint failure
# are reported independently. The build relies on the committed `prebuilt.html`
# (build.rs falls back to it when trunk is absent), so no trunk or wasm target
# is needed just to type-check and lint the server crate.
on:
pull_request:
push:
branches:
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust (with rustfmt)
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --check
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust (with clippy)
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo registry (registry only, not target)
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Run clippy
run: cargo clippy --all-targets -- -D warnings