Skip to content

Commit 6a80ab4

Browse files
joyeecheungrichardlau
authored andcommitted
build: add manually-dispatched stress-test workflow
Add a GitHub action workflow that can be manually dispatched to stress-run tests on a PR/branch to verify flakiness. Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com> PR-URL: #64118 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
1 parent 8e8874b commit 6a80ab4

1 file changed

Lines changed: 116 additions & 0 deletions

File tree

.github/workflows/stress-test.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Stress Test (rebase tested branch on main for cache reuse)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
test_path:
7+
description: Test path or glob (e.g. test/parallel/test-debugger-break.js or "test/parallel/test-debugger-*")
8+
required: true
9+
type: string
10+
os:
11+
description: Runner to use
12+
required: true
13+
default: macos-15
14+
type: choice
15+
options:
16+
- macos-15
17+
- ubuntu-24.04
18+
- ubuntu-24.04-arm
19+
repeat:
20+
description: Number of times to repeat each test (--repeat)
21+
required: true
22+
default: '1000'
23+
type: string
24+
test_jobs:
25+
description: Number of jobs to run in parallel (-j).
26+
required: true
27+
default: '1'
28+
type: string
29+
test_args:
30+
description: Extra args for tools/test.py, space-separated (e.g. "-t 10 --worker")
31+
required: false
32+
default: ''
33+
type: string
34+
35+
env:
36+
PYTHON_VERSION: '3.14'
37+
XCODE_VERSION: '16.4'
38+
CLANG_VERSION: '19'
39+
RUSTC_VERSION: '1.82'
40+
41+
permissions:
42+
contents: read
43+
44+
jobs:
45+
stress-test:
46+
runs-on: ${{ inputs.os }}
47+
env:
48+
# Linux builds with clang (matching test-linux.yml), macOS with gcc/g++.
49+
CC: ${{ startsWith(inputs.os, 'ubuntu') && 'sccache clang-19' || 'sccache gcc' }}
50+
CXX: ${{ startsWith(inputs.os, 'ubuntu') && 'sccache clang++-19' || 'sccache g++' }}
51+
# Enable sccache - this is okay for a manually-dispatched workflow that is typically used to
52+
# test lib-only or test-only deflaking changes. This should be able to pick up cache from
53+
# test-linux.yml and test-macos.yml running on the main branch.
54+
SCCACHE_GHA_ENABLED: 'true'
55+
SCCACHE_IDLE_TIMEOUT: '0'
56+
steps:
57+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
58+
with:
59+
persist-credentials: false
60+
path: node
61+
- name: Install Clang ${{ env.CLANG_VERSION }}
62+
if: runner.os == 'Linux'
63+
uses: ./node/.github/actions/install-clang
64+
with:
65+
clang-version: ${{ env.CLANG_VERSION }}
66+
- name: Set up Xcode ${{ env.XCODE_VERSION }}
67+
if: runner.os == 'macOS'
68+
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
69+
- name: Set up Python ${{ env.PYTHON_VERSION }}
70+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
71+
with:
72+
python-version: ${{ env.PYTHON_VERSION }}
73+
allow-prereleases: true
74+
- name: Install Rust ${{ env.RUSTC_VERSION }}
75+
run: |
76+
rustup override set "$RUSTC_VERSION"
77+
rustup --version
78+
- name: Set up sccache
79+
uses: Mozilla-Actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
80+
with:
81+
version: v0.16.0
82+
- name: Environment Information
83+
run: npx envinfo@7.21.0
84+
# This is needed due to https://github.com/nodejs/build/issues/3878
85+
- name: Cleanup
86+
if: runner.os == 'macOS'
87+
run: |
88+
echo "::group::Free space before cleanup"
89+
df -h
90+
echo "::endgroup::"
91+
echo "::group::Cleaned Files"
92+
93+
sudo rm -rf /Users/runner/Library/Android/sdk
94+
95+
echo "::endgroup::"
96+
echo "::group::Free space after cleanup"
97+
df -h
98+
echo "::endgroup::"
99+
- name: Build
100+
run: make -C node build-ci -j"$(getconf _NPROCESSORS_ONLN)" V=1 CONFIG_FLAGS="--error-on-warn --v8-enable-temporal-support"
101+
- name: Stress run ${{ inputs.test_path }} x${{ inputs.repeat }}
102+
shell: bash
103+
env:
104+
REPEAT: ${{ inputs.repeat }}
105+
JOBS: ${{ inputs.test_jobs }}
106+
TEST_ARGS: ${{ inputs.test_args }}
107+
TEST_PATH: ${{ inputs.test_path }}
108+
run: |
109+
cd node
110+
read -ra EXTRA_ARGS <<< "$TEST_ARGS"
111+
python3 tools/test.py \
112+
--repeat "$REPEAT" \
113+
-j "$JOBS" \
114+
-p actions \
115+
"${EXTRA_ARGS[@]}" \
116+
"$TEST_PATH"

0 commit comments

Comments
 (0)