This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Repository navigation
98 lines (98 loc) · 4.69 KB
/
Copy pathtests.yml
File metadata and controls
98 lines (98 loc) · 4.69 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
# The tests, on every push to main and every pull request: the server's own (every crate's cargo tests, which also run
# the page's network code against the switch in node, and free roam's C core against the hub with wasi-sdk) and the
# page's fast unit tests (web/tools/unit-tests.mjs --fast, and the LAN backend's lan-wasm: the tests that need the
# game folder or mingw show as skipped here). Beside them the checks: the page's types (npm run check: tsc) and the
# server's format and lints (cargo fmt --check, cargo clippy -D warnings). A check runs even when a step before it
# failed, so one failure does not hide another. None of this holds back the image (image-rs.yml).
#
# Three runners side by side, each building what its part needs: the LAN crate's tests (one at a time, as harness
# serial() keeps them: they measure time and queues), the other crates' tests, and the page's tests with a server of
# their own. A push that changes only the bot, the changelog or the docs (AGENTS.md too) is not tested: no test reads
# them (the changelog's form is checked by web/build.mjs, which the image's build runs on every push).
name: tests
on:
push:
branches: [main]
paths-ignore: ['discord-bot/**', CHANGELOG.md, 'docs/**', README.md, AGENTS.md, CLAUDE.md]
pull_request:
paths-ignore: ['discord-bot/**', CHANGELOG.md, 'docs/**', README.md, AGENTS.md, CLAUDE.md]
workflow_dispatch:
permissions:
contents: read
# a newer push to a pull request stops its run; on main every push is tested to the end (several sessions push there)
concurrency:
group: tests-${{ github.ref }}-${{ github.event_name == 'pull_request' && 'pr' || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
tests:
name: ${{ matrix.part }}
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
# a part that fails does not stop the others
fail-fast: false
matrix:
part: [server, lan, page]
steps:
- uses: actions/checkout@v5
# node and the page's packages (ws, esbuild): the page's tests, the LAN crate's page tests, the Node comparisons.
# Those (crates/http cross_node, src/app/url.rs, crates/names cross_check) were checked against this Node: 24 reads
# a "^" in a path, a few malformed headers and some new Unicode letters otherwise
- uses: actions/setup-node@v4
with:
node-version: 23.9.0
cache: npm
cache-dependency-path: web/package-lock.json
- run: npm ci
working-directory: web
- run: node build.mjs
working-directory: web
# wasi-sdk, in deps/ as on the Mac: the C tests built for wasm
- id: wasi
uses: actions/cache@v4
with:
path: deps
key: wasi-sdk-34.0-x86_64-linux
- if: steps.wasi.outputs.cache-hit != 'true'
run: mkdir -p deps && curl -sSfL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-34/wasi-sdk-34.0-x86_64-linux.tar.gz | tar xz -C deps
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
# the build is kept also when a test failed (by default only a run that passed saves it); a cache per part, as
# each builds other crates
- uses: Swatinem/rust-cache@v2
with:
workspaces: web/server-rs
key: ${{ matrix.part }}
cache-on-failure: true
# the release build's code without its slow link (Cargo.toml's profile.ci)
- name: server tests
if: matrix.part == 'server'
run: cargo test --profile ci --locked --workspace --exclude nfsu2-lan --no-fail-fast
working-directory: web/server-rs
- name: server format
if: matrix.part == 'server' && !cancelled()
run: cargo fmt --check
working-directory: web/server-rs
- name: server lints
if: matrix.part == 'server' && !cancelled()
run: cargo clippy --profile ci --locked --workspace --all-targets -- -D warnings
working-directory: web/server-rs
- name: LAN tests
if: matrix.part == 'lan'
run: cargo test --profile ci --locked -p nfsu2-lan --no-fail-fast
working-directory: web/server-rs
- name: the server for the page's tests
if: matrix.part == 'page'
run: cargo build --profile ci --locked -p nfsu2-server
working-directory: web/server-rs
- name: page tests
if: matrix.part == 'page'
run: node tools/unit-tests.mjs --fast test/lan-wasm.test.mjs
working-directory: web
env:
NFSU2_SERVER_BIN: ${{ github.workspace }}/web/server-rs/target/ci/nfsu2-server
- name: page types
if: matrix.part == 'page' && !cancelled()
run: npm run check
working-directory: web