Skip to content

Commit 5b41fa1

Browse files
committed
CI: Attempt to run Node.js tests only on Linux when doing Slint internal changes
1 parent 5090684 commit 5b41fa1

File tree

3 files changed

+91
-44
lines changed

3 files changed

+91
-44
lines changed

.github/workflows/ci.yaml

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -79,54 +79,30 @@ jobs:
7979
save_if: ${{ matrix.save_if }}
8080
timeout_minutes: 120
8181

82-
node_test:
82+
# For changes to Slint internals, do a quick test on Linux for Node.js only.
83+
node_test_linux:
8384
needs: files-changed
8485
if: needs.files-changed.outputs.internal == 'true' || needs.files-changed.outputs.api_node == 'true' || needs.files-changed.outputs.tests == 'true'
85-
env:
86-
RUSTFLAGS: -D warnings
87-
CARGO_PROFILE_DEV_DEBUG: 0
88-
CARGO_INCREMENTAL: false
89-
RUST_BACKTRACE: 1
90-
strategy:
91-
matrix:
92-
os: [ubuntu-22.04, macos-14, windows-2022]
86+
uses: ./.github/workflows/node_test_reusable.yaml
87+
with:
88+
name: "Node.js Linux"
89+
os: "ubuntu-22.04"
9390

94-
runs-on: ${{ matrix.os }}
91+
node_test_macos:
92+
needs: files-changed
93+
if: needs.files-changed.outputs.api_node == 'true' || needs.files-changed.outputs.tests == 'true'
94+
uses: ./.github/workflows/node_test_reusable.yaml
95+
with:
96+
name: "Node.js macOS"
97+
os: "macos-14"
9598

96-
steps:
97-
- uses: actions/checkout@v5
98-
- uses: ./.github/actions/install-linux-dependencies
99-
- uses: ./.github/actions/install-skia-dependencies
100-
- name: Setup headless display
101-
if: runner.os != 'macOS'
102-
uses: pyvista/setup-headless-display-action@v4
103-
- uses: actions/setup-node@v6
104-
with:
105-
node-version: 20
106-
package-manager-cache: false
107-
id: node-install
108-
- uses: pnpm/[email protected]
109-
with:
110-
version: 10.18.2
111-
- uses: ./.github/actions/setup-rust
112-
with:
113-
key: x-napi-v2-${{ steps.node-install.outputs.node-version }} # the cache key consists of a manually bumpable version and the node version, as the cached rustc artifacts contain linking information where to find node.lib, which is in a versioned directory.
114-
- name: Run pnpm install
115-
working-directory: api/node
116-
run: pnpm install --frozen-lockfile
117-
- name: Build node plugin in debug
118-
run: pnpm build:testing
119-
working-directory: api/node
120-
- name: Run node tests
121-
working-directory: api/node
122-
run: pnpm test
123-
- name: Run test-driver-nodejs
124-
# Release is only applied to the harness that drives the node.js invocations, but needed
125-
# to avoid crashing on Windows with what looks like an out of stack exception.
126-
run: cargo test --verbose --release --all-features -p test-driver-nodejs
127-
- name: Check image-filter example
128-
working-directory: examples/imagefilter/node
129-
run: pnpm check
99+
node_test_windows:
100+
needs: files-changed
101+
if: needs.files-changed.outputs.api_node == 'true' || needs.files-changed.outputs.tests == 'true'
102+
uses: ./.github/workflows/node_test_reusable.yaml
103+
with:
104+
name: "Node.js Windows"
105+
os: "windows-2022"
130106

131107
# For changes to Slint internals, do a quick test on Linux for Python only.
132108
python_test_linux:

.github/workflows/nightly_tests.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,12 @@ jobs:
311311
with:
312312
name: "Python ${{ matrix.os }}"
313313
os: ${{ matrix.os }}
314+
315+
node:
316+
strategy:
317+
matrix:
318+
os: [ubuntu-22.04, macos-14, windows-2022]
319+
uses: ./.github/workflows/node_test_reusable.yaml
320+
with:
321+
name: "Node.js ${{ matrix.os }}"
322+
os: ${{ matrix.os }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright © SixtyFPS GmbH <[email protected]>
2+
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3+
4+
name: Node.js Test (Reusable)
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
name:
10+
description: 'Name of the job'
11+
required: true
12+
type: string
13+
os:
14+
description: 'Operating system to run on'
15+
required: true
16+
type: string
17+
18+
env:
19+
RUSTFLAGS: -D warnings
20+
CARGO_PROFILE_DEV_DEBUG: 0
21+
CARGO_INCREMENTAL: false
22+
RUST_BACKTRACE: 1
23+
24+
25+
jobs:
26+
node_test:
27+
name: ${{ inputs.name }}
28+
runs-on: ${{ inputs.os }}
29+
steps:
30+
- uses: actions/checkout@v5
31+
- uses: ./.github/actions/install-linux-dependencies
32+
- uses: ./.github/actions/install-skia-dependencies
33+
- name: Setup headless display
34+
if: runner.os != 'macOS'
35+
uses: pyvista/setup-headless-display-action@v4
36+
- uses: actions/setup-node@v6
37+
with:
38+
node-version: 20
39+
package-manager-cache: false
40+
id: node-install
41+
- uses: pnpm/[email protected]
42+
with:
43+
version: 10.18.2
44+
- uses: ./.github/actions/setup-rust
45+
with:
46+
key: x-napi-v2-${{ steps.node-install.outputs.node-version }} # the cache key consists of a manually bumpable version and the node version, as the cached rustc artifacts contain linking information where to find node.lib, which is in a versioned directory.
47+
- name: Run pnpm install
48+
working-directory: api/node
49+
run: pnpm install --frozen-lockfile
50+
- name: Build node plugin in debug
51+
run: pnpm build:testing
52+
working-directory: api/node
53+
- name: Run node tests
54+
working-directory: api/node
55+
run: pnpm test
56+
- name: Run test-driver-nodejs
57+
# Release is only applied to the harness that drives the node.js invocations, but needed
58+
# to avoid crashing on Windows with what looks like an out of stack exception.
59+
run: cargo test --verbose --release --all-features -p test-driver-nodejs
60+
- name: Check image-filter example
61+
working-directory: examples/imagefilter/node
62+
run: pnpm check

0 commit comments

Comments
 (0)