forked from NVIDIA/NeMo-Flow
-
Notifications
You must be signed in to change notification settings - Fork 0
360 lines (316 loc) · 12.7 KB
/
ci_node.yml
File metadata and controls
360 lines (316 loc) · 12.7 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
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Node.js
on:
workflow_call:
inputs:
ref_type:
description: 'The ref type from the triggering workflow'
required: true
type: string
ref_name:
description: 'The ref name from the triggering workflow'
required: true
type: string
run_package:
description: 'Whether to build package artifacts after tests pass'
required: false
default: true
type: boolean
run_openclaw:
description: 'Whether to run OpenClaw integration checks'
required: false
default: false
type: boolean
secrets:
CODECOV_TOKEN:
required: false
defaults:
run:
shell: bash
env:
GH_TOKEN: "${{ github.token }}"
GIT_COMMIT: "${{ github.sha }}"
NEMO_FLOW_CI_WORKSPACE: "${{ github.workspace }}"
NEMO_FLOW_CI_WORKSPACE_TMP: "${{ github.workspace }}/tmp"
UV_PYTHON_DOWNLOADS: never
jobs:
Test:
name: Test (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
continue-on-error: ${{ startsWith(matrix.platform, 'windows') }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- platform: linux-amd64
runner: ubuntu-latest
- platform: linux-arm64
runner: ubuntu-24.04-arm
- platform: macos-arm64
runner: macos-15
- platform: windows-amd64
runner: windows-2022
- platform: windows-arm64
runner: windows-11-arm
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Load CI tool versions
id: ci-config
uses: ./.github/actions/load-ci-tool-versions
- uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
with:
cache: false
toolchain: ${{ steps.ci-config.outputs.rust_version }}
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: nemo-flow-rust-${{ runner.os }}-${{ runner.arch }}-${{ steps.ci-config.outputs.rust_version }}
workspaces: . -> target
cache-all-crates: true
cache-bin: false
save-if: false
- uses: taiki-e/install-action@c070f87102a1c75b3183910f391c1cb887fe13c8 # v2.77.6
with:
tool: cargo-llvm-cov@${{ steps.ci-config.outputs.cargo_llvm_cov_version }},just@${{ steps.ci-config.outputs.just_version }}
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: ${{ steps.ci-config.outputs.node_version }}
- name: Run Node tests with coverage
working-directory: ${{ env.NEMO_FLOW_CI_WORKSPACE }}
run: just --set ci true --set output_dir "${{ github.workspace }}" test-node
- name: Run OpenClaw integration checks
if: ${{ inputs.run_openclaw }}
working-directory: ${{ env.NEMO_FLOW_CI_WORKSPACE }}
run: just --set ci true test-openclaw
- name: Upload Node coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6
if: ${{ !startsWith(matrix.platform, 'windows') }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
files: node-coverage.xml,node-rust.xml
flags: node-${{ matrix.platform }}
name: node-${{ matrix.platform }}
verbose: true
Package:
name: Package (${{ matrix.platform }})
needs: [Test]
if: ${{ inputs.run_package && !cancelled() && needs.Test.result == 'success' }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- platform: linux-amd64
runner: ubuntu-latest
- platform: linux-arm64
runner: ubuntu-24.04-arm
- platform: macos-arm64
runner: macos-15
- platform: windows-amd64
runner: windows-2022
- platform: windows-arm64
runner: windows-11-arm
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Load CI tool versions
id: ci-config
uses: ./.github/actions/load-ci-tool-versions
- uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
with:
cache: false
toolchain: ${{ steps.ci-config.outputs.rust_version }}
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: nemo-flow-rust-${{ runner.os }}-${{ runner.arch }}-${{ steps.ci-config.outputs.rust_version }}
workspaces: . -> target
cache-all-crates: true
cache-bin: false
save-if: false
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
if: ${{ startsWith(matrix.platform, 'linux-') }}
with:
version: ${{ steps.ci-config.outputs.uv_version }}
enable-cache: true
cache-dependency-glob: ${{ env.NEMO_FLOW_CI_WORKSPACE }}/uv.lock
- name: Install managed Python for Zig packaging
if: ${{ startsWith(matrix.platform, 'linux-') }}
run: |
set -e
UV_PYTHON_DOWNLOADS=manual uv python install --managed-python ${{ steps.ci-config.outputs.default_python_version }}
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: ${{ steps.ci-config.outputs.node_version }}
- uses: taiki-e/install-action@c070f87102a1c75b3183910f391c1cb887fe13c8 # v2.77.6
with:
tool: just@${{ steps.ci-config.outputs.just_version }}
- name: Create packaging output directory
if: ${{ inputs.run_package }}
run: |
set -e
mkdir -p "${{ env.NEMO_FLOW_CI_WORKSPACE_TMP }}/npm"
- name: Derive Node package version
if: ${{ inputs.run_package }}
working-directory: ${{ env.NEMO_FLOW_CI_WORKSPACE }}
run: |
set -e
version="$(node -e 'const fs = require("fs"); const pkg = JSON.parse(fs.readFileSync("crates/node/package.json", "utf8")); if (!pkg.version) { throw new Error("crates/node/package.json missing version field"); } console.log(pkg.version);')"
sha="${GITHUB_SHA::8}"
if [ "${{ inputs.ref_type }}" = "tag" ]; then
version="${{ inputs.ref_name }}"
else
version="${version}+${sha}"
fi
printf 'NEMO_FLOW_PACKAGE_VERSION=%s\n' "$version" >> "$GITHUB_ENV"
- name: Package Node
if: ${{ inputs.run_package }}
working-directory: ${{ env.NEMO_FLOW_CI_WORKSPACE }}
run: |
set -e
just \
--set ci true \
--set output_dir "${{ env.NEMO_FLOW_CI_WORKSPACE_TMP }}" \
--set ref_name "${NEMO_FLOW_PACKAGE_VERSION}" \
package-node
- name: Upload npm package artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ inputs.run_package }}
with:
name: npm-${{ matrix.platform }}
path: ${{ env.NEMO_FLOW_CI_WORKSPACE_TMP }}/npm/*.tgz
if-no-files-found: error
PackageOpenClaw:
name: Package OpenClaw plugin
needs: [Test]
if: ${{ inputs.run_openclaw && !cancelled() && needs.Test.result == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Load CI tool versions
id: ci-config
uses: ./.github/actions/load-ci-tool-versions
- uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
with:
cache: false
toolchain: ${{ steps.ci-config.outputs.rust_version }}
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: nemo-flow-rust-openclaw-package-${{ runner.os }}-${{ runner.arch }}-${{ steps.ci-config.outputs.rust_version }}
workspaces: . -> target
cache-all-crates: true
cache-bin: false
save-if: false
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: ${{ steps.ci-config.outputs.node_version }}
- uses: taiki-e/install-action@c070f87102a1c75b3183910f391c1cb887fe13c8 # v2.77.6
with:
tool: just@${{ steps.ci-config.outputs.just_version }}
- name: Derive OpenClaw package version
working-directory: ${{ env.NEMO_FLOW_CI_WORKSPACE }}
run: |
set -e
version="$(node -e 'const fs = require("fs"); const pkg = JSON.parse(fs.readFileSync("integrations/openclaw/package.json", "utf8")); if (!pkg.version) { throw new Error("integrations/openclaw/package.json missing version field"); } console.log(pkg.version);')"
sha="${GITHUB_SHA::8}"
if [ "${{ inputs.ref_type }}" = "tag" ]; then
version="${{ inputs.ref_name }}"
else
version="${version}+${sha}"
fi
printf 'NEMO_FLOW_OPENCLAW_PACKAGE_VERSION=%s\n' "$version" >> "$GITHUB_ENV"
- name: Package OpenClaw plugin
working-directory: ${{ env.NEMO_FLOW_CI_WORKSPACE }}
run: |
set -euo pipefail
just \
--set ci true \
--set output_dir "${NEMO_FLOW_CI_WORKSPACE_TMP}" \
--set ref_name "${NEMO_FLOW_OPENCLAW_PACKAGE_VERSION}" \
package-openclaw
- name: Upload OpenClaw plugin artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: openclaw-npm
path: ${{ env.NEMO_FLOW_CI_WORKSPACE_TMP }}/openclaw/*.tgz
if-no-files-found: error
Consolidate:
name: Consolidate
needs: [Package]
if: ${{ inputs.run_package && !cancelled() && needs.Package.result == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Download npm linux-amd64 artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: npm-linux-amd64
path: npm-linux-amd64/
- name: Download npm linux-arm64 artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: npm-linux-arm64
path: npm-linux-arm64/
- name: Download npm macos-arm64 artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: npm-macos-arm64
path: npm-macos-arm64/
- name: Download npm windows-amd64 artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: npm-windows-amd64
path: npm-windows-amd64/
- name: Download npm windows-arm64 artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: npm-windows-arm64
path: npm-windows-arm64/
- name: Consolidate Node package directory
run: |
set -euo pipefail
mkdir -p combined
first=true
for dir in npm-linux-amd64 npm-linux-arm64 npm-macos-arm64 npm-windows-amd64 npm-windows-arm64; do
shopt -s nullglob
tgzs=("${dir}"/*.tgz)
shopt -u nullglob
if [ "${#tgzs[@]}" -eq 0 ]; then
echo "Error: no npm package artifact found in ${dir}" >&2
exit 1
fi
for tgz in "${tgzs[@]}"; do
if [ "${first}" = true ]; then
tar xzf "${tgz}" -C combined
first=false
else
tar xzf "${tgz}" -C combined --wildcards '*.node'
fi
done
done
echo "Platform binaries included:"
ls -la combined/package/*.node
- name: Archive consolidated Node package
run: |
set -euo pipefail
cd combined
zip -rq "${{ github.workspace }}/consolidated.zip" package
- name: Upload consolidated Node package artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: npm-consolidated
path: ${{ github.workspace }}/consolidated.zip
if-no-files-found: error