Skip to content

Commit 3a17e7d

Browse files
committed
Improve CI caching and reliability coverage
1 parent 7120d20 commit 3a17e7d

14 files changed

Lines changed: 1480 additions & 233 deletions

File tree

.github/workflows/ci.yml

Lines changed: 181 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,49 @@ on:
66
- main
77
pull_request:
88

9+
concurrency:
10+
group: ci-${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
CARGO_INCREMENTAL: "0"
15+
916
jobs:
10-
ci:
17+
rust:
18+
name: Rust lint and unit tests
1119
runs-on: macos-latest
1220

21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: dtolnay/rust-toolchain@stable
25+
with:
26+
components: rustfmt, clippy
27+
28+
- name: Cache Rust build outputs
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
~/.cargo/git
33+
~/.cargo/registry
34+
server/target
35+
key: rust-${{ runner.os }}-${{ hashFiles('server/Cargo.lock', 'server/Cargo.toml', 'server/build.rs', 'server/src/**/*.rs', 'cli/**/*.m') }}
36+
restore-keys: |
37+
rust-${{ runner.os }}-
38+
39+
- name: Check Rust formatting
40+
run: cargo fmt --manifest-path server/Cargo.toml --check
41+
42+
- name: Clippy
43+
run: cargo clippy --manifest-path server/Cargo.toml --all-targets -- -D warnings
44+
45+
- name: Rust unit tests
46+
run: cargo test --manifest-path server/Cargo.toml
47+
48+
client:
49+
name: Client lint, build, and tests
50+
runs-on: ubuntu-latest
51+
1352
steps:
1453
- uses: actions/checkout@v4
1554

@@ -20,32 +59,165 @@ jobs:
2059
cache-dependency-path: |
2160
package-lock.json
2261
client/package-lock.json
62+
63+
- name: Install root dependencies
64+
run: npm ci --ignore-scripts --force
65+
66+
- name: Install client dependencies
67+
run: npm ci --prefix client
68+
69+
- name: Check Prettier formatting
70+
run: npx prettier --check .
71+
72+
- name: Typecheck client
73+
run: npm run --prefix client typecheck
74+
75+
- name: Test client
76+
run: npm run --prefix client test
77+
78+
- name: Build client
79+
run: npm run build:client
80+
81+
packages:
82+
name: Packages and VS Code extension
83+
runs-on: ubuntu-latest
84+
85+
steps:
86+
- uses: actions/checkout@v4
87+
88+
- uses: actions/setup-node@v4
89+
with:
90+
node-version: 20
91+
cache: npm
92+
cache-dependency-path: |
93+
package-lock.json
2394
packages/react-native-inspector/package-lock.json
2495
packages/nativescript-inspector/package-lock.json
2596
97+
- name: Install root dependencies
98+
run: npm ci --ignore-scripts --force
99+
100+
- name: Install NativeScript inspector dependencies
101+
run: npm ci --prefix packages/nativescript-inspector
102+
103+
- name: Install React Native inspector dependencies
104+
run: npm ci --prefix packages/react-native-inspector
105+
106+
- name: Build inspector and test packages
107+
run: npm run build:packages
108+
109+
- name: Package VS Code extension
110+
run: npm run package:vscode-extension
111+
112+
build-artifacts:
113+
name: Build integration artifacts
114+
runs-on: macos-latest
115+
116+
steps:
117+
- uses: actions/checkout@v4
118+
119+
- uses: actions/setup-node@v4
120+
with:
121+
node-version: 20
122+
cache: npm
123+
cache-dependency-path: |
124+
package-lock.json
125+
client/package-lock.json
126+
26127
- uses: dtolnay/rust-toolchain@stable
128+
129+
- name: Cache Rust build outputs and fixture app
130+
uses: actions/cache@v4
27131
with:
28-
components: rustfmt, clippy
132+
path: |
133+
~/.cargo/git
134+
~/.cargo/registry
135+
server/target
136+
.cache/simdeck/fixture
137+
key: rust-${{ runner.os }}-${{ hashFiles('server/Cargo.lock', 'server/Cargo.toml', 'server/build.rs', 'server/src/**/*.rs', 'cli/**/*.m', 'scripts/integration/fixture.mjs') }}
138+
restore-keys: |
139+
rust-${{ runner.os }}-
29140
30141
- name: Install root dependencies
31-
run: npm ci
142+
run: npm ci --ignore-scripts
32143

33144
- name: Install client dependencies
34145
run: npm ci --prefix client
35146

36-
- name: Install NativeScript inspector dependencies
37-
run: npm ci --prefix packages/nativescript-inspector
147+
- name: Build CLI, client, and JS test API
148+
run: |
149+
npm run build:cli
150+
npm run build:client
151+
npm run build:simdeck-test
152+
npm run test:integration:fixture
38153
39-
- name: Install React Native inspector dependencies
40-
run: npm ci --prefix packages/react-native-inspector
154+
- name: Upload integration artifacts
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: simdeck-integration-artifacts
158+
if-no-files-found: error
159+
include-hidden-files: true
160+
path: |
161+
build/simdeck
162+
build/simdeck-bin
163+
client/dist
164+
packages/simdeck-test/dist
165+
.cache/simdeck/fixture
166+
167+
integration-cli:
168+
name: CLI simulator integration
169+
runs-on: macos-latest
170+
needs:
171+
- rust
172+
- client
173+
- packages
174+
- build-artifacts
41175

42-
- name: Lint, build, and test
43-
run: npm run ci
176+
steps:
177+
- uses: actions/checkout@v4
178+
179+
- uses: actions/setup-node@v4
180+
with:
181+
node-version: 20
182+
183+
- name: Download integration artifacts
184+
uses: actions/download-artifact@v4
185+
with:
186+
name: simdeck-integration-artifacts
187+
path: .
188+
189+
- name: Make CLI executable
190+
run: chmod +x build/simdeck build/simdeck-bin
44191

45192
- name: CLI simulator integration tests
46193
run: npm run test:integration:cli
47194
env:
48195
SIMDECK_INTEGRATION_VERBOSE: "1"
49196

197+
integration-js-api:
198+
name: JS API simulator integration
199+
runs-on: macos-latest
200+
needs:
201+
- rust
202+
- client
203+
- packages
204+
- build-artifacts
205+
206+
steps:
207+
- uses: actions/checkout@v4
208+
209+
- uses: actions/setup-node@v4
210+
with:
211+
node-version: 20
212+
213+
- name: Download integration artifacts
214+
uses: actions/download-artifact@v4
215+
with:
216+
name: simdeck-integration-artifacts
217+
path: .
218+
219+
- name: Make CLI executable
220+
run: chmod +x build/simdeck build/simdeck-bin
221+
50222
- name: JS API simulator integration tests
51223
run: npm run test:integration:js-api

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ packages/react-native-inspector/dist/
1212
docs/.vitepress/dist/
1313
docs/.vitepress/cache/
1414
cloud/
15+
.cache/
1516
.playwright-mcp/
1617
simdeck-snapshot.md
1718

docs/guide/testing.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The repo includes a macOS-only integration runner that creates a temporary simul
5353
```sh
5454
npm run build:cli
5555
npm run build:client
56+
npm run test:integration:fixture
5657
npm run test:integration:cli
5758
```
5859

@@ -72,3 +73,25 @@ Useful environment variables:
7273
| `SIMDECK_INTEGRATION_KEEP_SIMULATOR=1` | Leave the temporary simulator after exit. |
7374

7475
The integration suite is separate from `npm run test` because it boots and drives a real iOS simulator.
76+
The SwiftUI fixture app is cached under `.cache/simdeck/fixture` using a hash
77+
of its generated source, plist, simulator SDK, Swift compiler, and host
78+
architecture.
79+
80+
## Stress and Leak Checks
81+
82+
Use the stress runner against an already-running daemon when you want to shake out
83+
high-usage reliability issues without adding minutes to every PR:
84+
85+
```sh
86+
npm run test:stress -- --server-url http://127.0.0.1:4310 --iterations 1000 --concurrency 12
87+
```
88+
89+
To include simulator-specific refresh traffic and RSS growth checks:
90+
91+
```sh
92+
npm run test:stress -- --udid <udid> --iterations 2000 --concurrency 16 --max-rss-growth-mb 256
93+
```
94+
95+
The runner repeatedly calls health, metrics, simulator listing, stream-quality,
96+
and optional simulator refresh endpoints. It samples the daemon process RSS with
97+
`ps` and fails if the peak or growth limits are exceeded.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@
6262
"test": "cargo test --manifest-path server/Cargo.toml && npm run --prefix client test",
6363
"test:integration:cli": "node scripts/integration/cli.mjs",
6464
"test:integration:cli:verbose": "SIMDECK_INTEGRATION_VERBOSE=1 SIMDECK_INTEGRATION_SHOW_SIMULATOR=1 node scripts/integration/cli.mjs",
65+
"test:integration:fixture": "node scripts/integration/prebuild-fixture.mjs",
6566
"test:integration:js-api": "node scripts/integration/js-api.mjs",
6667
"test:integration:js-api:verbose": "SIMDECK_INTEGRATION_SHOW_SIMULATOR=1 node scripts/integration/js-api.mjs",
68+
"test:stress": "node scripts/stress/simdeck.mjs",
6769
"ci": "npm run lint && npm run build:all && npm run test && npm run package:vscode-extension",
6870
"dev": "npm run build:cli && node scripts/dev.mjs",
6971
"preview:swiftui": "node scripts/experimental/swiftui-preview.mjs",

0 commit comments

Comments
 (0)