-
-
Notifications
You must be signed in to change notification settings - Fork 14
171 lines (165 loc) · 6.75 KB
/
Copy pathtest.yml
File metadata and controls
171 lines (165 loc) · 6.75 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
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
# Reusable test workflow: fmt, clippy, and full test suite.
#
# Called by:
# - ci.yml (PR checks)
# - release.yml (pre-publish gate)
#
# Cache strategy: both jobs share the same `target/` cache via
# `shared-key: workspace`. The `lint` job seeds the cache on cold runs;
# subsequent `test` runs start warm and only need to recompile what
# changed. Avoids the previous 3x compile (lint + test + test-cluster).
#
# Job structure: fast tests and 3-node cluster tests run sequentially
# in the same job so we don't pay the ~10-minute cold compile twice.
name: Test
on:
workflow_call:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
# Link the workspace's test binaries with mold instead of the default BFD
# linker. With --all-features every test binary statically links the full
# dependency closure and there are hundreds of them, so linking — not
# codegen — dominates the cold-cache build. mold cuts that link time several-
# fold. Applies to both jobs; installed via apt below.
RUSTFLAGS: "-C link-arg=-fuse-ld=mold"
jobs:
lint:
name: Lint & Check
# Free ARM64 runner for public repos: ~40% faster per-core than
# ubuntu-latest at the same (zero) cost. The release workflows already
# build on ubuntu-24.04-arm, so the toolchain + system deps are proven
# on this ISA.
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
shared-key: workspace
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake clang libclang-dev pkg-config protobuf-compiler perl \
libcurl4-openssl-dev libsasl2-dev mold
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features --profile ci -- -D warnings
- name: Warm-storage ObjectStore gate
run: bash scripts/ci/check_warm_storage_gate.sh
- name: Format-path .expect() gate
run: bash scripts/ci/check_format_expects.sh
- name: Calvin determinism gate
run: bash scripts/ci/check_calvin_determinism.sh
- name: Plane-separation gate
run: bash scripts/ci/check_plane_separation.sh
- name: Raft transport-boundary gate
run: python3 scripts/ci/check_raft_transport_boundary.py
- name: Reconstructed-SQL gate
run: |
python3 scripts/ci/check_reconstructed_sql.py --self-test
python3 scripts/ci/check_reconstructed_sql.py
- name: Authorized-dispatch gate
run: |
python3 scripts/ci/check_authorized_dispatch.py --self-test
python3 scripts/ci/check_authorized_dispatch.py
- name: Robust-parsing gate
run: |
python3 scripts/ci/check_robust_parsing.py --self-test
python3 scripts/ci/check_robust_parsing.py
- name: Install cargo-deny
uses: taiki-e/install-action@v2
with:
tool: cargo-deny
- name: Dependency audit
run: cargo deny check
# Single test job: runs the fast suite first, then the 3-node cluster
# suite (`nodedb-cluster-tests`) on the same runner. Combining them
# avoids a second cold compile of the whole workspace; the cluster
# crate is only a thin layer on top of the deps the fast suite has
# already built.
#
# `--no-fail-fast` so a regression surfaces every failure in one run.
# Cluster tests are intentionally not fail-fast either, but they are
# serialised by `.config/nextest.toml`'s `cluster` test group.
test:
name: Test
# Free ARM64 runner — see the lint job for rationale.
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- name: Reclaim disk and record resources
# Building the workspace's test binaries with --all-features writes on
# the order of 100 GB into target/: every test binary statically links
# the full dependency closure and lands in the hundreds of MB, and there
# are hundreds of them. A stock runner starts with barely more free
# space than that, and when it runs out mid-link the linker's
# memory-mapped write aborts with SIGBUS (signal 7) rather than a clean
# ENOSPC — which reads like a linker crash and not a full disk.
#
# Reclaim the large preinstalled toolchains this build never uses, then
# record the resources a failed mmap actually depends on. The `df` runs
# BEFORE the build, so it shows the headroom available to it, not what
# remained; read it as the budget, not the outcome.
run: |
sudo rm -rf \
/usr/local/lib/android \
/usr/share/dotnet \
/opt/ghc /usr/local/.ghcup \
/opt/hostedtoolcache/CodeQL \
/usr/share/swift
sudo docker image prune -af || true
echo "== memory =="; free -h
echo "== filesystems =="; df -h / /tmp /dev/shm
echo "== cpus =="; nproc
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: workspace
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake clang libclang-dev pkg-config protobuf-compiler perl \
libcurl4-openssl-dev libsasl2-dev mold
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Run fast tests
run: |
cargo nextest run \
--workspace --exclude nodedb-cluster-tests \
--all-features \
--cargo-profile ci --profile ci \
--no-fail-fast
- name: Run cluster tests
run: |
cargo nextest run \
-p nodedb-cluster-tests \
--all-features \
--cargo-profile ci --profile ci \
--no-fail-fast
- name: Record disk after build
if: always()
# Counterpart to the pre-build reading: that one is the budget, this is
# what the build actually left. Runs even on failure, so a linker abort
# can be attributed to a full disk instead of inferred. `target/` is
# reported separately because it is what grows.
run: |
echo "== filesystems =="; df -h / /tmp /dev/shm
echo "== target/ =="; du -sh target 2>/dev/null || true
- name: Upload JUnit report
if: always()
uses: actions/upload-artifact@v7
with:
name: junit-report
path: target/nextest/ci/junit.xml
if-no-files-found: ignore