-
Notifications
You must be signed in to change notification settings - Fork 1
349 lines (304 loc) · 12 KB
/
Copy pathci.yml
File metadata and controls
349 lines (304 loc) · 12 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
name: CI
on:
push:
branches: [master, feature/holographic-memory]
pull_request:
branches: ['**']
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_PROFILE_TEST_DEBUG: "0"
jobs:
test:
name: Test ${{ matrix.name }}
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || contains(fromJSON('["master","feature/holographic-memory"]'), github.event.pull_request.base.ref) }}
runs-on: ${{ fromJSON(matrix.runner) }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux
runner: '"ubuntu-latest"'
- name: macOS
runner: '"macos-14"'
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-test-
${{ runner.os }}-cargo-
- name: Run tests
run: cargo nextest run --workspace --profile ci
windows-test-shards:
name: Test Windows ${{ matrix.partition }}/4
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || contains(fromJSON('["master","feature/holographic-memory"]'), github.event.pull_request.base.ref) }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
partition: [1, 2, 3, 4]
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-test-
${{ runner.os }}-cargo-
- name: Run Windows test shard
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$partition = [int]"${{ matrix.partition }}"
$partitions = 4
$metadata = cargo metadata --no-deps --format-version 1 | ConvertFrom-Json
$package = $metadata.packages | Where-Object { $_.name -eq "tracedecay" } | Select-Object -First 1
$targets = @($package.targets | Where-Object { $_.kind -contains "test" } | Sort-Object name)
$selected = New-Object System.Collections.Generic.List[string]
for ($i = 0; $i -lt $targets.Count; $i++) {
if (($i % $partitions) -eq ($partition - 1)) {
$selected.Add($targets[$i].name)
}
}
if ($selected.Count -eq 0) {
throw "No integration test targets selected for Windows shard $partition/$partitions"
}
Write-Host "Windows shard $partition/$partitions running $($selected.Count) integration test targets"
$nextestArgs = @("nextest", "run", "-p", "tracedecay", "--profile", "ci")
if ($partition -eq 1) {
$nextestArgs += @("--lib", "--bin", "tracedecay")
}
foreach ($target in $selected) {
$nextestArgs += @("--test", $target)
}
cargo @nextestArgs
- name: Show sccache stats
if: always()
shell: pwsh
run: '& $env:SCCACHE_PATH --show-stats'
windows-test:
name: Test Windows
if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || contains(fromJSON('["master","feature/holographic-memory"]'), github.event.pull_request.base.ref)) }}
needs: [windows-test-shards]
runs-on: ubuntu-latest
steps:
- name: Check Windows shards
run: |
if [ "${{ needs.windows-test-shards.result }}" != "success" ]; then
echo "Windows test shards finished with: ${{ needs.windows-test-shards.result }}" >&2
exit 1
fi
clippy:
name: Clippy
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || contains(fromJSON('["master","feature/holographic-memory"]'), github.event.pull_request.base.ref) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-clippy-
${{ runner.os }}-cargo-
- name: Run blocking Clippy policy
run: cargo clippy --workspace --all-targets
fmt:
name: Format
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || contains(fromJSON('["master","feature/holographic-memory"]'), github.event.pull_request.base.ref) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
dashboard:
name: Dashboard
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || contains(fromJSON('["master","feature/holographic-memory"]'), github.event.pull_request.base.ref) }}
runs-on: ubuntu-latest
timeout-minutes: 25
env:
DASHBOARD_DIST_FILES: >-
shell/dist/shell.js
shell/dist/shell.css
holographic/dist/index.js
holographic/dist/style.css
lcm/dist/index.js
lcm/dist/style.css
graph/dist/index.js
graph/dist/style.css
savings/dist/index.js
savings/dist/style.css
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: "22"
cache: npm
cache-dependency-path: dashboard/package-lock.json
- name: Install dashboard dependencies
working-directory: dashboard
run: npm ci
- name: Build dashboard assets
working-directory: dashboard
run: npm run build
- name: Run dashboard unit tests
working-directory: dashboard
run: npm test
- name: Verify embedded dist artifacts
working-directory: dashboard
run: |
set -euo pipefail
for f in $DASHBOARD_DIST_FILES; do
if [ ! -s "$f" ]; then
echo "missing or empty dist artifact: $f" >&2
exit 1
fi
done
# shellcheck disable=SC2086
sha256sum $DASHBOARD_DIST_FILES > /tmp/dashboard-dist.sha
npm run build
sha256sum -c /tmp/dashboard-dist.sha
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-dashboard-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-dashboard-
${{ runner.os }}-cargo-
- name: Run dashboard integration tests
run: cargo nextest run --test dashboard_api_test --no-fail-fast
- name: Cache Playwright browsers
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('dashboard/package-lock.json') }}
restore-keys: |
playwright-${{ runner.os }}-
- name: Install Playwright Chromium
working-directory: dashboard
run: npx playwright install --with-deps chromium
- name: Prebuild dashboard binary for smoke
run: cargo build --bin tracedecay
- name: Run dashboard smoke (empty LCM)
working-directory: dashboard
env:
TRACEDECAY_GLOBAL_DB: ${{ runner.temp }}/tracedecay-dashboard-smoke-empty.db
run: |
set -euo pipefail
rm -f "$TRACEDECAY_GLOBAL_DB"
attempts=0
max_attempts=3
until [ "$attempts" -ge "$max_attempts" ]; do
attempts=$((attempts + 1))
echo "Smoke attempt ${attempts}/${max_attempts}..."
if npm run smoke -- --expect-lcm=empty; then
exit 0
fi
if [ "$attempts" -lt "$max_attempts" ]; then
sleep 10
fi
done
echo "Dashboard smoke failed after ${max_attempts} attempts" >&2
exit 1
- name: Run dashboard mobile smoke
working-directory: dashboard
env:
TRACEDECAY_GLOBAL_DB: ${{ runner.temp }}/tracedecay-dashboard-smoke-mobile.db
run: |
set -euo pipefail
rm -f "$TRACEDECAY_GLOBAL_DB"
npm run smoke:mobile -- --expect-lcm=empty
hermes-integration:
name: Hermes integration (stock)
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository || contains(fromJSON('["master","feature/holographic-memory"]'), github.event.pull_request.base.ref) }}
runs-on: ubuntu-latest
timeout-minutes: 30
env:
# Stock (upstream) Hermes pin — the generated plugin must keep working
# against this exact upstream commit. Bump deliberately after rerunning
# scripts/hermes_stock_integration.sh against the new ref locally.
HERMES_UPSTREAM_REPO: https://github.com/NousResearch/hermes-agent.git
HERMES_UPSTREAM_REF: 9dd9ef0ec99a87f078f7272b4323df5440b4b3f9
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-hermes-integration-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-hermes-integration-
${{ runner.os }}-cargo-
- name: Build tracedecay binary
run: cargo build --bin tracedecay
- name: Run generated-plugin unit checks (no Hermes required)
run: python3 scripts/hermes_plugin_unit_check.py
- name: Clone stock Hermes at pinned ref
run: |
set -euo pipefail
git init -q "$RUNNER_TEMP/hermes-upstream"
git -C "$RUNNER_TEMP/hermes-upstream" remote add origin "$HERMES_UPSTREAM_REPO"
git -C "$RUNNER_TEMP/hermes-upstream" fetch --depth 1 origin "$HERMES_UPSTREAM_REF"
git -C "$RUNNER_TEMP/hermes-upstream" checkout --detach FETCH_HEAD
- uses: astral-sh/setup-uv@v8.2.0
with:
enable-cache: true
cache-dependency-glob: ${{ runner.temp }}/hermes-upstream/uv.lock
cache-suffix: hermes-${{ env.HERMES_UPSTREAM_REF }}
- name: Set up stock Hermes environment
working-directory: ${{ runner.temp }}/hermes-upstream
run: uv sync --frozen --no-dev
- name: Run stock Hermes integration checks
env:
TRACEDECAY_BIN: ${{ github.workspace }}/target/debug/tracedecay
HERMES_UPSTREAM_DIR: ${{ runner.temp }}/hermes-upstream
run: scripts/hermes_stock_integration.sh