ci: Add WSL testing workflow for Windows #20
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Windows | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - .mailmap | |
| - README.md | |
| - vcbuild.bat | |
| - test/internet/** | |
| - '**.nix' | |
| - .github/** | |
| - '!.github/workflows/test-windows.yml' | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| push: | |
| branches: | |
| - main | |
| - canary | |
| - v[0-9]+.x-staging | |
| - v[0-9]+.x | |
| paths-ignore: | |
| - .mailmap | |
| - README.md | |
| - vcbuild.bat | |
| - test/internet/** | |
| - '**.nix' | |
| - .github/** | |
| - '!.github/workflows/test-windows.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| PYTHON_VERSION: '3.14' | |
| FLAKY_TESTS: keep_retrying | |
| CLANG_VERSION: '19' | |
| RUSTC_VERSION: '1.82' | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-wsl: | |
| if: github.event.pull_request.draft == false | |
| strategy: | |
| fail-fast: false | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 | |
| with: | |
| persist-credentials: false | |
| path: node | |
| - name: Install WSL Distribution (Ubuntu-22.04) | |
| shell: powershell | |
| run: | | |
| wsl --install Ubuntu-22.04 --no-launch | |
| $sleepTime = 5 | |
| $maxAttempts = 12 | |
| $attempt = 0 | |
| while ($attempt -lt $maxAttempts) { | |
| $attempt++ | |
| Write-Host "Waiting for Ubuntu-22.04 to be installed (Attempt $attempt/$maxAttempts)..." | |
| Start-Sleep -Seconds $sleepTime | |
| $distros = wsl -l -q | |
| if ($distros -match "Ubuntu-22.04") { | |
| Write-Host "Ubuntu-22.04 is installed." | |
| break | |
| } | |
| if ($attempt -eq $maxAttempts) { | |
| Write-Error "Ubuntu-22.04 did not install within the expected time." | |
| exit 1 | |
| } | |
| } | |
| # Ensure the distro is fully initialized by running a dummy command | |
| wsl -d Ubuntu-22.04 echo "WSL distribution ready." | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} in WSL | |
| shell: powershell | |
| run: | | |
| wsl -d Ubuntu-22.04 bash -c "sudo apt-get update && sudo apt-get install -y python3 python3-pip" | |
| wsl -d Ubuntu-22.04 bash -c "python3 --version" | |
| - name: Install Clang ${{ env.CLANG_VERSION }} in WSL | |
| shell: powershell | |
| run: | | |
| wsl -d Ubuntu-22.04 bash -c "sudo apt-get update && sudo apt-get install -y clang-${{ env.CLANG_VERSION }}" | |
| wsl -d Ubuntu-22.04 bash -c "sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VERSION }} 100" | |
| wsl -d Ubuntu-22.04 bash -c "sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ env.CLANG_VERSION }} 100" | |
| wsl -d Ubuntu-22.04 bash -c "clang --version" | |
| - name: Install Rust ${{ env.RUSTC_VERSION }} in WSL | |
| shell: powershell | |
| run: | | |
| wsl -d Ubuntu-22.04 bash -c "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUSTC_VERSION }}" | |
| wsl -d Ubuntu-22.04 bash -c "echo 'export PATH=\"$HOME/.cargo/bin:\$PATH\"' >> \$HOME/.bashrc" | |
| wsl -d Ubuntu-22.04 bash -c "source \$HOME/.bashrc && rustup override set ${{ env.RUSTC_VERSION }}" | |
| wsl -d Ubuntu-22.04 bash -c "source \$HOME/.bashrc && rustup --version" | |
| - name: Set up sccache in WSL | |
| shell: powershell | |
| run: | | |
| 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" | |
| wsl -d Ubuntu-22.04 bash -c "mkdir -p ~/.cargo/bin" | |
| wsl -d Ubuntu-22.04 bash -c "mv sccache-v0.3.0-x86_64-unknown-linux-gnu/sccache ~/.cargo/bin/" | |
| wsl -d Ubuntu-22.04 bash -c "echo 'export PATH=\"$HOME/.cargo/bin:\$PATH\"' >> \$HOME/.bashrc" | |
| wsl -d Ubuntu-22.04 bash -c "echo 'export CC=\"sccache clang\"' >> \$HOME/.bashrc" | |
| wsl -d Ubuntu-22.04 bash -c "echo 'export CXX=\"sccache clang++\"' >> \$HOME/.bashrc" | |
| wsl -d Ubuntu-22.04 bash -c "echo 'export SCCACHE_GHA_ENABLED=\"true\"' >> \$HOME/.bashrc" | |
| - name: Environment Information | |
| shell: powershell | |
| run: | | |
| $wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}" | |
| wsl -d Ubuntu-22.04 bash -c "cd $wslCheckoutRoot && npx envinfo" | |
| - name: tools/doc/node_modules workaround | |
| shell: powershell | |
| run: | | |
| $wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}" | |
| wsl -d Ubuntu-22.04 bash -c "cd $wslCheckoutRoot && make -C node tools/doc/node_modules" | |
| - name: Build Node.js in WSL | |
| shell: powershell | |
| run: | | |
| $wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}" | |
| 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\"" | |
| - name: Test Node.js in WSL | |
| shell: powershell | |
| run: | | |
| $wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}" | |
| 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\"" | |
| - name: Re-run test in a folder whose name contains unusual chars | |
| shell: powershell | |
| run: | | |
| $wslCheckoutRoot = "/mnt/c/Users/runneradmin/work/${env:GITHUB_REPOSITORY//\/\_}" | |
| $unusualDirName = "dir%20with \$unusual`"chars?'Γ₯ΓβΖΒ©βΒ¬β¦`" # This is the name *without* the 'node' prefix | |
| $nodeOriginalPath = "$wslCheckoutRoot/node" | |
| $nodeRenamedPath = "$wslCheckoutRoot/$unusualDirName" | |
| wsl -d Ubuntu-22.04 bash -c "cd $wslCheckoutRoot && mv node \"$unusualDirName\"" | |
| wsl -d Ubuntu-22.04 bash -c "cd \"$nodeRenamedPath\" && ./tools/test.py --flaky-tests keep_retrying -p actions -j 4" |