Skip to content

Commit fa76923

Browse files
committed
ci: add WSL testing workflow for Windows
This commit introduces a new GitHub Actions workflow for running Node.js builds and tests within a Windows Subsystem for Linux (WSL) environment. The primary goal is to expand our continuous integration coverage to ensure Node.js functions correctly in WSL, which is a common development and deployment scenario. The workflow leverages the `windows-latest` runner and executes commands within an Ubuntu-22.04 WSL instance. The structure and styling of this new workflow closely follow the conventions established in `test-macos.yml` to maintain consistency and improve overall maintainability across our CI configurations.
1 parent 838c0e9 commit fa76923

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

.github/workflows/test-windows.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,43 +100,45 @@ jobs:
100100
- name: Set up sccache in WSL
101101
shell: powershell
102102
run: |
103-
$wslRepoPath = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}/node"
104-
wsl -d Ubuntu-22.04 bash -c "curl -sL https://github.com/mozilla/sccache/releases/download/v0.3.0/sccache-v0.3.0-x86_64-unknown-linux-gnu.tar.gz | tar xz -C $wslRepoPath"
105-
wsl -d Ubuntu-22.04 bash -c "mv $wslRepoPath/sccache-v0.3.0-x86_64-unknown-linux-gnu/sccache $wslRepoPath/.cargo/bin/"
106-
wsl -d Ubuntu-22.04 bash -c "echo 'CC=$wslRepoPath/.cargo/bin/sccache clang' >> $HOME/.bashrc"
107-
wsl -d Ubuntu-22.04 bash -c "echo 'CXX=$wslRepoPath/.cargo/bin/sccache clang++' >> $HOME/.bashrc"
108-
wsl -d Ubuntu-22.04 bash -c "echo 'SCCACHE_GHA_ENABLED=true' >> $HOME/.bashrc"
103+
wsl -d Ubuntu-22.04 bash -c "curl -sL https://github.com/mozilla/sccache/releases/download/v0.3.0/sccache-v0.3.0-x86_64-unknown-linux-gnu.tar.gz | tar xz"
104+
wsl -d Ubuntu-22.04 bash -c "mkdir -p ~/.cargo/bin"
105+
wsl -d Ubuntu-22.04 bash -c "mv sccache-v0.3.0-x86_64-unknown-linux-gnu/sccache ~/.cargo/bin/"
106+
wsl -d Ubuntu-22.04 bash -c "echo 'export PATH=\"$HOME/.cargo/bin:\$PATH\"' >> \$HOME/.bashrc"
107+
wsl -d Ubuntu-22.04 bash -c "echo 'export CC=\"sccache clang\"' >> \$HOME/.bashrc"
108+
wsl -d Ubuntu-22.04 bash -c "echo 'export CXX=\"sccache clang++\"' >> \$HOME/.bashrc"
109+
wsl -d Ubuntu-22.04 bash -c "echo 'export SCCACHE_GHA_ENABLED=\"true\"' >> \$HOME/.bashrc"
109110
110111
- name: Environment Information
111112
shell: powershell
112113
run: |
113-
$wslRepoPath = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}/node"
114-
wsl -d Ubuntu-22.04 bash -c "cd $wslRepoPath && npx envinfo"
114+
$wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}"
115+
wsl -d Ubuntu-22.04 bash -c "cd $wslCheckoutRoot && npx envinfo"
115116
116117
- name: tools/doc/node_modules workaround
117118
shell: powershell
118119
run: |
119-
$wslRepoPath = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}/node"
120-
wsl -d Ubuntu-22.04 bash -c "cd $wslRepoPath && make tools/doc/node_modules"
120+
$wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}"
121+
wsl -d Ubuntu-22.04 bash -c "cd $wslCheckoutRoot && make -C node tools/doc/node_modules"
121122
122123
- name: Build Node.js in WSL
123124
shell: powershell
124125
run: |
125-
$wslRepoPath = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}/node"
126-
wsl -d Ubuntu-22.04 bash -c "cd $wslRepoPath && make build-ci -j$(nproc) V=1 CONFIG_FLAGS=\"--error-on-warn --v8-enable-temporal-support\""
126+
$wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}"
127+
wsl -d Ubuntu-22.04 bash -c "cd $wslCheckoutRoot && make -C node build-ci -j$(nproc) V=1 CONFIG_FLAGS=\"--error-on-warn --v8-enable-temporal-support\""
127128
128129
- name: Test Node.js in WSL
129130
shell: powershell
130131
run: |
131-
$repoPath = "node"
132-
$wslRepoPath = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}/$repoPath"
133-
wsl -d Ubuntu-22.04 bash -c "cd $wslRepoPath && make test-ci -j1 V=1 TEST_CI_ARGS=\"-p actions --measure-flakiness 9\""
132+
$wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}"
133+
wsl -d Ubuntu-22.04 bash -c "cd $wslCheckoutRoot && make -C node test-ci -j1 V=1 TEST_CI_ARGS=\"-p actions --measure-flakiness 9\""
134134
135135
- name: Re-run test in a folder whose name contains unusual chars
136136
shell: powershell
137137
run: |
138-
$repoPath = "node"
139-
$wslRepoPath = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}/$repoPath"
140-
$dir = "dir%20with \$unusual`"chars?'åß∂ƒ©∆¬…`"
141-
wsl -d Ubuntu-22.04 bash -c "cd $wslRepoPath && mv node \"$dir\""
142-
wsl -d Ubuntu-22.04 bash -c "cd \"$wslRepoPath/$dir\" && ./tools/test.py --flaky-tests keep_retrying -p actions -j 4"
138+
$wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}"
139+
$unusualDirName = "dir%20with \$unusual`"chars?'åß∂ƒ©∆¬…`" # This is the name *without* the 'node' prefix
140+
$nodeOriginalPath = "$wslCheckoutRoot/node"
141+
$nodeRenamedPath = "$wslCheckoutRoot/$unusualDirName"
142+
143+
wsl -d Ubuntu-22.04 bash -c "cd $wslCheckoutRoot && mv node \"$unusualDirName\""
144+
wsl -d Ubuntu-22.04 bash -c "cd \"$nodeRenamedPath\" && ./tools/test.py --flaky-tests keep_retrying -p actions -j 4"

0 commit comments

Comments
 (0)