-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
146 lines (132 loc) Β· 6.54 KB
/
test-windows.yml
File metadata and controls
146 lines (132 loc) Β· 6.54 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
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: Download Ubuntu rootfs tarball
shell: powershell
run: |
Write-Host "=== Downloading Ubuntu rootfs tarball ==="
$url = "https://cloud-images.ubuntu.com/wsl/jammy/current/ubuntu-jammy-wsl-amd64-ubuntu22.04lts.rootfs.tar.gz"
$output = "$env:TEMP\ubuntu-22.04.tar.gz"
Invoke-WebRequest -Uri $url -OutFile $output
Write-Host "Download complete: $output"
- name: Import WSL Distribution
shell: powershell
run: |
Write-Host "=== Importing distribution to WSL ==="
$tarFile = "$env:TEMP\ubuntu-22.04.tar.gz"
$installDir = "$env:LOCALAPPDATA\WSL\Ubuntu-22.04"
$distroName = "Ubuntu-22.04"
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
wsl --import $distroName $installDir $tarFile --version 2
Start-Sleep -Seconds 10
Write-Host "`n=== Installation check ==="
wsl --list --verbose
Add-Content -Path $env:GITHUB_ENV -Value "DISTRO_NAME=$distroName"
- name: Initial Setup in WSL
shell: powershell
run: |
$distroName = $env:DISTRO_NAME
wsl -d $distroName -u root bash -c "export DEBIAN_FRONTEND=noninteractive && apt update && apt install -y python3 python3-pip git curl sudo build-essential"
wsl -d $distroName -u root bash -c "apt install -y clang-${{ env.CLANG_VERSION }}"
wsl -d $distroName -u root bash -c "update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ env.CLANG_VERSION }} 100"
wsl -d $distroName -u root bash -c "update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ env.CLANG_VERSION }} 100"
wsl -d $distroName -u root bash -c "clang --version"
wsl -d $distroName -u root bash -c "curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUSTC_VERSION }}"
wsl -d $distroName -u root bash -c "export PATH=\`$HOME/.cargo/bin:\`$PATH && rustup override set ${{ env.RUSTC_VERSION }}"
wsl -d $distroName -u root bash -c "export PATH=\`$HOME/.cargo/bin:\`$PATH && rustup --version"
wsl -d $distroName -u root 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 $distroName -u root bash -c "mkdir -p ~/.cargo/bin && mv sccache-v0.3.0-x86_64-unknown-linux-gnu/sccache ~/.cargo/bin/"
wsl -d $distroName -u root bash -c "echo 'export PATH=\`"`$HOME/.cargo/bin:\`$PATH\`"' >> \`$HOME/.bashrc"
wsl -d $distroName -u root bash -c "echo 'export CC=\`"sccache clang\`"' >> \`$HOME/.bashrc"
wsl -d $distroName -u root bash -c "echo 'export CXX=\`"sccache clang++\`"' >> \`$HOME/.bashrc"
wsl -d $distroName -u root bash -c "echo 'export SCCACHE_GHA_ENABLED=\`"true\`"' >> \`$HOME/.bashrc"
wsl -d $distroName -u root bash -c "export PATH=\`$HOME/.cargo/bin:\`$PATH && rustc --version"
wsl -d $distroName -u root bash -c "export PATH=\`$HOME/.cargo/bin:\`$PATH && sccache --version"
- name: Environment Information
shell: powershell
run: |
$distroName = $env:DISTRO_NAME
$wslCheckoutRoot = ($env:GITHUB_WORKSPACE -replace '\\', '/').ToLower() -replace '^([a-z]):', '/mnt/$1'
$wslNodePath = "$wslCheckoutRoot/node"
wsl -d $distroName bash -c "source ~/.bashrc && cd '$wslNodePath' && npx envinfo"
- name: tools/doc/node_modules workaround
shell: powershell
run: |
$distroName = $env:DISTRO_NAME
$wslCheckoutRoot = ($env:GITHUB_WORKSPACE -replace '\\', '/').ToLower() -replace '^([a-z]):', '/mnt/$1'
$wslNodePath = "$wslCheckoutRoot/node"
wsl -d $distroName bash -c "source ~/.bashrc && cd '$wslNodePath' && make tools/doc/node_modules"
- name: Build Node.js in WSL
shell: powershell
run: |
$distroName = $env:DISTRO_NAME
$wslCheckoutRoot = ($env:GITHUB_WORKSPACE -replace '\\', '/').ToLower() -replace '^([a-z]):', '/mnt/$1'
$wslNodePath = "$wslCheckoutRoot/node"
wsl -d $distroName bash -c "source ~/.bashrc && cd '$wslNodePath' && make build-ci -j`$(nproc) V=1 CONFIG_FLAGS='--error-on-warn --v8-enable-temporal-support'"
- name: Test Node.js in WSL
shell: powershell
run: |
$distroName = $env:DISTRO_NAME
$wslCheckoutRoot = ($env:GITHUB_WORKSPACE -replace '\\', '/').ToLower() -replace '^([a-z]):', '/mnt/$1'
$wslNodePath = "$wslCheckoutRoot/node"
wsl -d $distroName bash -c "source ~/.bashrc && cd '$wslNodePath' && make 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: |
$distroName = $env:DISTRO_NAME
$wslCheckoutRoot = ($env:GITHUB_WORKSPACE -replace '\\', '/').ToLower() -replace '^([a-z]):', '/mnt/$1'
$unusualDirName = 'dir%20with $unusual"chars?''Γ₯ΓβΖΒ©βΒ¬β¦'
wsl -d $distroName bash -c "cd '$wslCheckoutRoot' && mv node '$unusualDirName' && cd '$unusualDirName' && ./tools/test.py --flaky-tests keep_retrying -p actions -j 4"
- name: Cleanup
if: always()
shell: powershell
run: |
$distroName = $env:DISTRO_NAME
if ($distroName) {
Write-Host "Unregistering distro: $distroName"
wsl --unregister $distroName
}