forked from NVIDIA/NemoClaw
-
Notifications
You must be signed in to change notification settings - Fork 0
442 lines (403 loc) · 16 KB
/
Copy pathplatform-vitest-main.yaml
File metadata and controls
442 lines (403 loc) · 16 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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: CI / Platform Evidence
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "**/*.md"
- ".github/workflows/docs-preview-*.yaml"
- "ISSUE_TEMPLATE/**"
- ".github/ISSUE_TEMPLATE/**"
permissions:
contents: read
concurrency:
group: platform-evidence-${{ github.ref }}
cancel-in-progress: true
jobs:
ubuntu-2604-contract:
runs-on: ubuntu-latest
container:
image: ubuntu:26.04@sha256:b7f48194d4d8b763a478a621cdc81c27be222ba2206ca3ca6bc42b49685f3d9e
timeout-minutes: 20
steps:
- name: Install runner dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
binutils ca-certificates docker.io git python3
rm -rf /var/lib/apt/lists/*
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
cache: npm
- name: Verify Ubuntu 26.04 userspace
shell: bash
run: |
set -euo pipefail
. /etc/os-release
test "$ID" = "ubuntu"
test "$VERSION_ID" = "26.04"
command -v docker
docker info --format 'server={{.ServerVersion}} os={{.OperatingSystem}}'
command -v strings
printf 'os=%s version=%s arch=%s\n' "$ID" "$VERSION_ID" "$(uname -m)"
node --version
npm --version
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build CLI
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
test "$(git rev-parse --verify HEAD)" = "$GITHUB_SHA"
npm run build:cli
- name: Run Ubuntu 26.04 compatibility contracts
run: |
npx vitest run --project cli \
src/lib/onboard/preflight.test.ts \
src/lib/onboard/preflight-ubuntu-2604.test.ts
npx vitest run --project integration test/platform.test.ts
npx vitest run --project installer-integration \
--testTimeout 30000 \
test/install-preflight.test.ts
macos-vitest:
name: macOS compatibility (${{ matrix.shard }}/4)
runs-on: macos-26
timeout-minutes: ${{ matrix.timeout_minutes }}
strategy:
fail-fast: false
matrix:
include:
- shard: 1
timeout_minutes: 60
- shard: 2
timeout_minutes: 30
- shard: 3
timeout_minutes: 30
- shard: 4
timeout_minutes: 30
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
cache: npm
- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.14"
cache: pip
cache-dependency-path: ci/platform-vitest-macos-requirements.lock
- name: Install macOS test dependencies
run: |
set -euo pipefail
brew install bash coreutils fd gawk ripgrep
printf '%s\n' \
"$(brew --prefix bash)/bin" \
"$(brew --prefix coreutils)/libexec/gnubin" \
"$(brew --prefix gawk)/libexec/gnubin" \
>>"$GITHUB_PATH"
python -m pip install \
--only-binary=:all: \
--require-hashes \
--requirement ci/platform-vitest-macos-requirements.lock
- name: Show environment
run: |
set -euo pipefail
echo "Runner: $(uname -a)"
echo "Arch: $(uname -m)"
sw_vers
bash --version | head -n 1
node --version
npm --version
python --version
python3 --version
python -c 'import setuptools, yaml; print(f"setuptools={setuptools.__version__} pyyaml={yaml.__version__}")'
rg --version | head -n 1
timeout --version | head -n 1
stat --version | head -n 1
awk --version | head -n 1
- name: Install pinned OpenShell
env:
NEMOCLAW_NON_INTERACTIVE: "1"
run: env -u GH_TOKEN -u GITHUB_TOKEN bash scripts/install-openshell.sh
- name: Install dependencies
run: |
npm ci --ignore-scripts
cd nemoclaw
npm ci --ignore-scripts
- name: Build CLI and plugin
run: |
npm run build:cli
cd nemoclaw
npm run build
- name: Run full Vitest suite on macOS
run: npx vitest run --testTimeout 60000 --shard="${{ matrix.shard }}/4"
- id: macos_docker
name: Detect Docker availability for macOS E2E
if: ${{ matrix.shard == 1 }}
shell: bash
run: |
set -euo pipefail
if docker info >/dev/null 2>&1; then
echo "docker_ok=true" >>"$GITHUB_OUTPUT"
docker version
else
echo "docker_ok=false" >>"$GITHUB_OUTPUT"
echo "Docker is unavailable on the Apple silicon runner."
fi
- name: Run macOS live E2E
if: ${{ matrix.shard == 1 && steps.macos_docker.outputs.docker_ok == 'true' && github.ref == 'refs/heads/main' }}
env:
GITHUB_TOKEN: ${{ github.token }}
NVIDIA_INFERENCE_API_KEY: ${{ secrets.NVIDIA_INFERENCE_API_KEY }}
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1"
NEMOCLAW_NON_INTERACTIVE: "1"
NEMOCLAW_RECREATE_SANDBOX: "1"
NEMOCLAW_SANDBOX_NAME: "e2e-macos"
NEMOCLAW_RUN_LIVE_E2E: "1"
run: >-
npx vitest run --project e2e-live
test/e2e/live/full-e2e.test.ts
--silent=false --reporter=default
- name: Explain skipped macOS live E2E
if: ${{ matrix.shard == 1 && (steps.macos_docker.outputs.docker_ok != 'true' || github.ref != 'refs/heads/main') }}
shell: bash
run: |
set -euo pipefail
if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then
echo "The macOS live E2E did not run because this workflow does not test main."
else
echo "The macOS live E2E did not run because Docker is unavailable."
fi
echo "The macOS build and Vitest shard still provide platform evidence."
- name: Upload macOS E2E logs on failure
if: ${{ matrix.shard == 1 && failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: macos-platform-evidence-logs
path: |
/tmp/nemoclaw-e2e-*.log
${{ github.workspace }}/e2e-artifacts/live
if-no-files-found: ignore
retention-days: 14
wsl-vitest:
name: WSL compatibility (${{ matrix.shard }}/4)
runs-on: windows-latest
timeout-minutes: ${{ matrix.timeout_minutes }}
strategy:
fail-fast: false
matrix:
include:
- shard: 1
timeout_minutes: 180
- shard: 2
timeout_minutes: 90
- shard: 3
timeout_minutes: 90
- shard: 4
timeout_minutes: 90
env:
WSL_DISTRO: Ubuntu
WSL_TEST_USER: nemoclaw-ci
TRUSTED_WSL_HELPER: ${{ github.workspace }}\trusted-wsl-ci\tools\wsl\ci-helper.ps1
NEMOCLAW_NON_INTERACTIVE: "1"
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1"
NEMOCLAW_RECREATE_SANDBOX: "1"
NEMOCLAW_SANDBOX_NAME: "e2e-wsl"
steps:
- name: Force LF line endings for checkout
shell: powershell
run: git config --global core.autocrlf false
- name: Check out the trusted WSL helper
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.workflow_sha }}
path: trusted-wsl-ci
persist-credentials: false
sparse-checkout: |
tools/wsl/ci-helper.ps1
sparse-checkout-cone-mode: false
- name: Check out candidate source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: source
fetch-depth: 0
persist-credentials: false
- name: Resolve workspace paths for WSL
shell: powershell
run: |
. "$env:TRUSTED_WSL_HELPER"
$null = Set-WslWorkflowPaths `
-Workspace "$env:GITHUB_WORKSPACE\source" `
-WorkdirPrefix '/tmp/nemoclaw-wsl-vitest' `
-RunId $env:GITHUB_RUN_ID `
-RunAttempt $env:GITHUB_RUN_ATTEMPT `
-EnvironmentFile $env:GITHUB_ENV
- name: Ensure Ubuntu WSL exists
shell: powershell
run: |
. "$env:TRUSTED_WSL_HELPER"
Ensure-WslDistro -Distro $env:WSL_DISTRO
- name: Install Ubuntu dependencies
shell: powershell
run: |
. "$env:TRUSTED_WSL_HELPER"
$packages = @(
'bash', 'ca-certificates', 'curl', 'git', 'jq', 'lsb-release', 'make',
'python3', 'python3-pip', 'python3-venv', 'ripgrep', 'rsync', 'tar', 'unzip', 'xz-utils'
)
Install-WslUbuntuDependencies -Distro $env:WSL_DISTRO -Packages $packages -TestUser $env:WSL_TEST_USER
- name: Install Node.js 22 in WSL
shell: powershell
run: |
. "$env:TRUSTED_WSL_HELPER"
Install-WslNode -Distro $env:WSL_DISTRO
- name: Copy checkout into WSL ext4 workspace
shell: powershell
run: |
. "$env:TRUSTED_WSL_HELPER"
Sync-WslCheckout `
-Distro $env:WSL_DISTRO `
-Checkout $env:WSL_CHECKOUT_DIR `
-Workdir $env:WSL_WORKDIR `
-Owner $env:WSL_TEST_USER
- name: Install dependencies and build in WSL
shell: powershell
run: |
. "$env:TRUSTED_WSL_HELPER"
$testUser = ConvertTo-BashLiteral -Value $env:WSL_TEST_USER
$workdir = ConvertTo-BashLiteral -Value $env:WSL_WORKDIR
$script = @"
set -euo pipefail
id -un | grep -Fxq $testUser
cd $workdir
npm ci --ignore-scripts
npm run build:cli
cd nemoclaw
npm ci --ignore-scripts
npm run build
"@
Invoke-WslScript -Distro $env:WSL_DISTRO -User $env:WSL_TEST_USER -Script $script
- name: Run full Vitest suite in WSL
shell: powershell
run: |
. "$env:TRUSTED_WSL_HELPER"
$testUser = ConvertTo-BashLiteral -Value $env:WSL_TEST_USER
$workdir = ConvertTo-BashLiteral -Value $env:WSL_WORKDIR
$script = @"
set -euo pipefail
id -un | grep -Fxq $testUser
cd $workdir
export NEMOCLAW_EXEC_TIMEOUT=60000
export NEMOCLAW_TEST_TIMEOUT=60000
npx vitest run --testTimeout 60000 --shard='${{ matrix.shard }}/4'
"@
Invoke-WslScript -Distro $env:WSL_DISTRO -User $env:WSL_TEST_USER -Script $script
# Keep the root-only test selection and identity checks inline. Only the
# trusted helper constructs WSL commands and transfers scripts.
- name: Run root-required Vitest contracts in WSL
if: ${{ matrix.shard == 1 }}
shell: powershell
run: |
. "$env:TRUSTED_WSL_HELPER"
$workdir = ConvertTo-BashLiteral -Value $env:WSL_WORKDIR
$script = @"
set -euo pipefail
id -u | grep -Fxq '0'
cd $workdir
if ! getent group sandbox >/dev/null; then
groupadd --system sandbox
fi
if ! id -u sandbox >/dev/null 2>&1; then
useradd --system --gid sandbox --home-dir /sandbox --shell /bin/bash sandbox
fi
install -d -o root -g root -m 0755 /usr/local/lib/nemoclaw
install -o root -g root -m 0644 \
scripts/lib/normalize_mutable_config_perms.py \
/usr/local/lib/nemoclaw/normalize_mutable_config_perms.py
npx vitest run --project integration \
test/hermes-restart-config-seal-recovery.test.ts \
-t 'keeps the locked Hermes entry sticky-protected|lets a sandbox-group peer create state'
npx vitest run --project integration \
test/nemoclaw-start-perms.test.ts \
-t 'requires both fixed files to match|reclaims a root-owned collapsed config|leaves a root-owned recovery baseline untouched'
"@
Invoke-WslScript -Distro $env:WSL_DISTRO -User root -Script $script
- id: wsl_docker
name: Detect Docker availability in WSL
if: ${{ matrix.shard == 1 }}
shell: powershell
run: |
. "$env:TRUSTED_WSL_HELPER"
$script = @'
if docker info >/dev/null 2>&1; then
echo DOCKER_OK=1
else
echo DOCKER_OK=0
fi
'@
$result = Invoke-WslScript -Distro $env:WSL_DISTRO -Script $script -CaptureOutput
if ($result -match 'DOCKER_OK=1') {
'docker_ok=true' | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
Write-Host 'Docker is available in WSL'
} else {
'docker_ok=false' | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
Write-Host 'Docker is unavailable in WSL'
}
- name: Run WSL live E2E
if: ${{ matrix.shard == 1 && steps.wsl_docker.outputs.docker_ok == 'true' && github.ref == 'refs/heads/main' }}
shell: powershell
env:
GITHUB_TOKEN: ${{ github.token }}
NVIDIA_INFERENCE_API_KEY: ${{ secrets.NVIDIA_INFERENCE_API_KEY }}
run: |
. "$env:TRUSTED_WSL_HELPER"
$workdir = ConvertTo-BashLiteral -Value $env:WSL_WORKDIR
$exports = @(
'export NVIDIA_INFERENCE_API_KEY=' + (ConvertTo-BashLiteral -Value ([string]$env:NVIDIA_INFERENCE_API_KEY))
'export GITHUB_TOKEN=' + (ConvertTo-BashLiteral -Value ([string]$env:GITHUB_TOKEN))
'export NEMOCLAW_NON_INTERACTIVE=' + (ConvertTo-BashLiteral -Value $env:NEMOCLAW_NON_INTERACTIVE)
'export NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=' + (ConvertTo-BashLiteral -Value $env:NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE)
'export NEMOCLAW_RECREATE_SANDBOX=' + (ConvertTo-BashLiteral -Value $env:NEMOCLAW_RECREATE_SANDBOX)
'export NEMOCLAW_SANDBOX_NAME=' + (ConvertTo-BashLiteral -Value $env:NEMOCLAW_SANDBOX_NAME)
) -join "`n"
$script = @"
set -euo pipefail
cd $workdir
$exports
export NEMOCLAW_RUN_LIVE_E2E=1
npx vitest run --project e2e-live test/e2e/live/full-e2e.test.ts --silent=false --reporter=default
"@
Invoke-WslScript -Distro $env:WSL_DISTRO -Script $script
- name: Explain skipped WSL live E2E
if: ${{ matrix.shard == 1 && (steps.wsl_docker.outputs.docker_ok != 'true' || github.ref != 'refs/heads/main') }}
shell: powershell
run: |
if ($env:GITHUB_REF -ne 'refs/heads/main') {
Write-Host 'The WSL live E2E did not run because this workflow does not test main.'
} else {
Write-Host 'The WSL live E2E did not run because Docker is unavailable.'
}
Write-Host 'The WSL build and Vitest shard still provide platform evidence.'
- name: Upload WSL E2E log on failure
if: ${{ matrix.shard == 1 && failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wsl-platform-evidence-install-log
path: C:\Users\runneradmin\AppData\Local\Temp\nemoclaw-e2e-install.log
if-no-files-found: ignore
retention-days: 14