-
Notifications
You must be signed in to change notification settings - Fork 2
231 lines (197 loc) · 7.76 KB
/
test.yml
File metadata and controls
231 lines (197 loc) · 7.76 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
name: Tests
# Runs on every PR to main, every push to main, and on version tag pushes
# (so release.yml can gate publish on a green Tests run for the exact SHA
# being released). Mirrors the gating pattern from the Perry compiler repo.
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# Pin macOS deployment target so cached object files carry a stable
# LC_VERSION_MIN regardless of which runner image Apple rolls to next.
MACOSX_DEPLOYMENT_TARGET: "13.0"
jobs:
# ---------------------------------------------------------------------------
# Shared crate unit tests on all three host OSes. Runs the jolt_sys smoke
# tests (bj_global_init → bj_world_create → bj_world_step → gravity fall →
# teardown), which exercise the compiled Jolt static lib at runtime. This
# is the strongest signal that the Rapier → Jolt migration works on each
# platform — a cmake build-only check would miss runtime issues like
# mismatched C++ ABI or thread-pool problems.
#
# Linux needs cmake + a C++ toolchain for the shim. Windows gets MSVC via
# the ilammy action so cmake's CXX compiler probe succeeds.
# ---------------------------------------------------------------------------
shared-tests:
strategy:
fail-fast: false
matrix:
os: [macos-14, ubuntu-22.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install Linux build deps (cmake + C++)
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential pkg-config
- name: Set up MSVC environment (Windows)
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
native/shared/target
key: ${{ runner.os }}-shared-${{ hashFiles('native/shared/Cargo.lock') }}
restore-keys: ${{ runner.os }}-shared-
- name: cargo test (bloom-shared + jolt)
working-directory: native/shared
run: cargo test --release
# ---------------------------------------------------------------------------
# Lint: rustfmt + clippy. Advisory while the codebase is still in flux.
# Flip `continue-on-error: false` once the lint baseline is clean.
# ---------------------------------------------------------------------------
lint:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: rustfmt --check (shared)
working-directory: native/shared
continue-on-error: true
run: cargo fmt --check
- name: clippy (shared, advisory)
working-directory: native/shared
continue-on-error: true
run: cargo clippy --release --no-deps -- -D warnings
# ---------------------------------------------------------------------------
# Per-platform builds: each native crate is a separate Cargo workspace root
# (one Cargo.lock per platform) and they only build on their own OS.
# A successful build proves that:
# 1. The platform crate compiles against the current shared API
# 2. The Jolt C++ shim builds for that target (cmake picks a working
# toolchain)
# 3. wgpu + the platform's windowing + audio deps resolve cleanly
# ---------------------------------------------------------------------------
build-macos:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
native/macos/target
key: ${{ runner.os }}-macos-crate-${{ hashFiles('native/macos/Cargo.lock') }}
restore-keys: ${{ runner.os }}-macos-crate-
- name: cargo build --release (bloom-macos)
working-directory: native/macos
run: cargo build --release
build-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install system deps (X11, ALSA, cmake, C++ toolchain)
run: |
sudo apt-get update
sudo apt-get install -y \
libx11-dev libxcb1-dev libxrandr-dev libxi-dev libxcursor-dev \
libasound2-dev libpulse-dev \
pkg-config cmake build-essential
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
native/linux/target
key: ${{ runner.os }}-linux-crate-${{ hashFiles('native/linux/Cargo.lock') }}
restore-keys: ${{ runner.os }}-linux-crate-
- name: cargo build --release (bloom-linux)
working-directory: native/linux
run: cargo build --release
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Set up MSVC environment
# Populates LIB / INCLUDE / PATH so cmake (which builds the Jolt C++
# shim via bloom-shared's build.rs) can find the Windows SDK. Without
# this, jolt cmake fails the initial CXX compiler probe even though
# MSVC is installed on the runner.
uses: ilammy/msvc-dev-cmd@v1
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
native/windows/target
key: ${{ runner.os }}-windows-crate-${{ hashFiles('native/windows/Cargo.lock') }}
restore-keys: ${{ runner.os }}-windows-crate-
- name: cargo build --release (bloom-windows)
working-directory: native/windows
run: cargo build --release
# ---------------------------------------------------------------------------
# Web / WASM. No submodule needed: bloom-shared's build.rs early-exits on
# target_arch=wasm32, and web physics is bridged to JoltPhysics.js at
# runtime rather than a native Jolt static lib.
# ---------------------------------------------------------------------------
build-web:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain (wasm32)
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
native/web/target
native/shared/target
key: ${{ runner.os }}-web-${{ hashFiles('native/web/Cargo.lock', 'native/shared/Cargo.lock') }}
restore-keys: ${{ runner.os }}-web-
- name: cargo check (shared, wasm32, web feature)
working-directory: native/shared
run: cargo check --target wasm32-unknown-unknown --no-default-features --features web
- name: wasm-pack build (bloom-web)
working-directory: native/web
run: wasm-pack build --release --target web