Skip to content

Commit c999215

Browse files
committed
ci: removing WSL for a simpler, more performant approach
We've been using a complex workflow with WSL to run our E2E tests on CI. This method, which involves building on Linux and running on Windows, has led to several issues, including: - A complex and cumbersome setup. - Performance overhead due to cross-OS file operations. - Flakiness caused by symlink conversion problems. This change overhauls the E2E test workflow to a much simpler and more stable two-step process: building natively on Linux and running natively on Windows. This new approach significantly simplifies our CI setup by eliminating the dev-infra wsl action and the tricky symlink conversions, leading to better performance and fewer test flakes.
1 parent 8a512cc commit c999215

File tree

4 files changed

+97
-225
lines changed

4 files changed

+97
-225
lines changed
Lines changed: 24 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,49 @@
1-
name: 'Native Windows Bazel e2e test'
2-
description: 'Runs an Angular CLI e2e Bazel test on native Windows (dispatched from inside WSL)'
3-
author: 'Angular'
1+
name: Native Windows Bazel E2E test
2+
description: Runs an Angular CLI e2e Bazel test on native Windows
3+
author: Angular
44

55
inputs:
66
test_target_name:
7-
description: E2E test target name
7+
description: E2E test target name.
88
required: true
99
test_args:
1010
description: |
1111
Text representing the command line arguments that
1212
should be passed to the e2e test runner.
1313
required: false
1414
default: ''
15+
e2e_temp_dir:
16+
description: 'The temporary directory path for E2E tests.'
17+
required: false
18+
# Use D:\\ by default as it's much faster
19+
# See: https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows
20+
default: 'D:\\tmp_dir'
1521

1622
runs:
17-
using: composite
23+
using: 'composite'
1824
steps:
19-
- name: Initialize WSL
20-
id: init_wsl
21-
uses: angular/dev-infra/github-actions/setup-wsl@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
22-
with:
23-
wsl_firewall_interface: 'vEthernet (WSL (Hyper-V firewall))'
24-
25-
- name: Install node modules in WSL (re-using from previous install/cache restore)
26-
run: |
27-
export NVM_DIR="$HOME/.nvm"
28-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
29-
30-
cd ${{steps.init_wsl.outputs.repo_path}}
31-
pnpm install --frozen-lockfile
32-
shell: wsl-bash {0}
33-
34-
- name: Build test binary for Windows (inside WSL)
35-
shell: wsl-bash {0}
36-
run: |
37-
export NVM_DIR="$HOME/.nvm"
38-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
39-
40-
cd ${{steps.init_wsl.outputs.repo_path}}
41-
pnpm bazel \
42-
build --config=e2e //tests/legacy-cli:${{inputs.test_target_name}} --platforms=tools:windows_x64
43-
env:
44-
# See: https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows
45-
WSLENV: 'GOOGLE_APPLICATION_CREDENTIALS/p'
46-
47-
- name: Copying binary artifact to host
48-
shell: wsl-bash {0}
25+
- name: Set up temp directory
26+
shell: bash
4927
run: |
50-
cd ${{steps.init_wsl.outputs.repo_path}}
51-
tar -cf /tmp/test.tar.gz dist/bin/tests/legacy-cli/${{inputs.test_target_name}}_
52-
# Use D:/ for better performance see: https://github.com/actions/runner-images/issues/12744
53-
mkdir /mnt/d/test
54-
mkdir /mnt/d/tmp_dir
55-
mv /tmp/test.tar.gz /mnt/d/test
56-
(cd /mnt/d/test && tar -xf /mnt/d/test/test.tar.gz)
28+
mkdir ${{ inputs.e2e_temp_dir }}
5729
5830
- name: Convert symlinks for Windows host
59-
shell: wsl-bash {0}
31+
shell: pwsh
6032
run: |
61-
export NVM_DIR="$HOME/.nvm"
62-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
63-
64-
cd ${{steps.init_wsl.outputs.repo_path}}
65-
66-
runfiles_dir="/mnt/d/test/dist/bin/tests/legacy-cli/${{inputs.test_target_name}}_/${{inputs.test_target_name}}.bat.runfiles"
67-
68-
# Make WSL symlinks compatible on Windows native file system.
69-
node scripts/windows-testing/convert-symlinks.mjs $runfiles_dir "${{steps.init_wsl.outputs.cmd_path}}"
33+
$runfiles_dir = "./dist/bin/tests/legacy-cli/${{inputs.test_target_name}}_/${{inputs.test_target_name}}.bat.runfiles"
7034
7135
# Needed for resolution because Aspect/Bazel looks for repositories at `<workspace>/external`.
7236
# TODO(devversion): consult with Aspect on why this is needed.
73-
(cd $runfiles_dir/_main && ${{steps.init_wsl.outputs.cmd_path}} /C "mklink /D external ..")
37+
Set-Location -Path "${runfiles_dir}\_main"
38+
New-Item -ItemType SymbolicLink -Path "external" -Target ".."
7439
75-
- name: Run tests
76-
# Note: This is Git Bash.
40+
- name: Run CLI E2E tests
7741
shell: bash
7842
env:
7943
BAZEL_BINDIR: '.'
80-
# Use D:/ for better performance see: https://github.com/actions/runner-images/issues/12744
81-
E2E_TEMP: 'D:\\tmp_dir'
82-
working-directory: "D:\\test"
44+
E2E_TEMP: ${{ inputs.e2e_temp_dir }}
8345
run: |
84-
node "${{github.workspace}}\\scripts\\windows-testing\\parallel-executor.mjs" \
85-
$PWD/dist/bin/tests/legacy-cli/${{inputs.test_target_name}}_/${{inputs.test_target_name}}.bat.runfiles \
86-
${{inputs.test_target_name}} \
87-
"${{inputs.test_args}}" \
46+
node ./scripts/windows-testing/parallel-executor.mjs \
47+
"./dist/bin/tests/legacy-cli/${{ inputs.test_target_name }}_/${{ inputs.test_target_name }}.bat.runfiles" \
48+
${{ inputs.test_target_name }} \
49+
"${{ inputs.test_args }}"

.github/workflows/ci.yml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,38 @@ jobs:
9999
- name: Run CLI E2E tests
100100
run: pnpm bazel test --test_env=E2E_SHARD_TOTAL=6 --test_env=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}
101101

102-
e2e_windows:
102+
build-e2e-windows:
103+
runs-on: ubuntu-latest
104+
steps:
105+
- name: Initialize environment
106+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
107+
- name: Setup Bazel
108+
uses: angular/dev-infra/github-actions/bazel/setup@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
109+
- name: Setup Bazel RBE
110+
uses: angular/dev-infra/github-actions/bazel/configure-remote@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
111+
with:
112+
google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }}
113+
- name: Install node modules
114+
run: pnpm install --frozen-lockfile
115+
- name: Build E2E tests for Windows on Linux
116+
run: |
117+
pnpm bazel build \
118+
--config=e2e \
119+
//tests/legacy-cli:e2e.npm_node22 \
120+
//tests/legacy-cli:e2e.esbuild_node22 \
121+
--platforms=tools:windows_x64
122+
- name: Store built Windows E2E tests
123+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
124+
with:
125+
name: win-e2e-build-artifacts
126+
path: |
127+
dist/bin/tests/legacy-cli/**
128+
!**/node_modules/**
129+
retention-days: 1
130+
if-no-files-found: 'error'
131+
132+
e2e-windows:
133+
needs: build-e2e-windows
103134
strategy:
104135
fail-fast: false
105136
matrix:
@@ -110,16 +141,14 @@ jobs:
110141
runs-on: ${{ matrix.os }}
111142
steps:
112143
- name: Initialize environment
113-
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
114-
with:
115-
disable-package-manager-cache: true
116-
- name: Setup Bazel
117-
uses: angular/dev-infra/github-actions/bazel/setup@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
118-
- name: Setup Bazel RBE
119-
uses: angular/dev-infra/github-actions/bazel/configure-remote@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
144+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@029d16b075db696b35d0d661d0fd3a0552a4b452
145+
- name: Install node modules
146+
run: pnpm install --frozen-lockfile
147+
- name: Download built tests
148+
uses: actions/download-artifact@abefc31eafcfbdf6c5336127c1346fdae79ff41c # v4.3.0
120149
with:
121-
allow_windows_rbe: true
122-
google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }}
150+
name: win-e2e-build-artifacts
151+
path: dist/bin/tests/legacy-cli/
123152
- name: Run CLI E2E tests
124153
uses: ./.github/shared-actions/windows-bazel-test
125154
with:

.github/workflows/pr.yml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,51 @@ jobs:
127127
- name: Run CLI E2E tests
128128
run: pnpm bazel test --test_env=E2E_SHARD_TOTAL=6 --test_env=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}
129129

130-
e2e-windows-subset:
131-
needs: build
132-
runs-on: windows-2025
130+
build-e2e-windows-subset:
131+
runs-on: ubuntu-latest
133132
steps:
134133
- name: Initialize environment
135134
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
136-
with:
137-
disable-package-manager-cache: true
138135
- name: Setup Bazel
139136
uses: angular/dev-infra/github-actions/bazel/setup@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
140137
- name: Setup Bazel RBE
141138
uses: angular/dev-infra/github-actions/bazel/configure-remote@1ef1e98c528b9e9d0d636d1d768b6ebca195ce5d
139+
- name: Install node modules
140+
run: pnpm install --frozen-lockfile
141+
- name: Build E2E tests for Windows on Linux
142+
run: |
143+
pnpm bazel build \
144+
--config=e2e \
145+
//tests/legacy-cli:e2e.esbuild_node22 \
146+
--platforms=tools:windows_x64
147+
- name: Store built Windows E2E tests
148+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
142149
with:
143-
allow_windows_rbe: true
150+
name: win-e2e-build-artifacts
151+
path: |
152+
dist/bin/tests/legacy-cli/**
153+
!**/node_modules/**
154+
retention-days: 1
155+
if-no-files-found: 'error'
156+
157+
e2e-windows-subset:
158+
needs: build-e2e-windows-subset
159+
runs-on: windows-2025
160+
steps:
161+
- name: Initialize environment
162+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@029d16b075db696b35d0d661d0fd3a0552a4b452
163+
- name: Install node modules
164+
run: pnpm install --frozen-lockfile
165+
- name: Download built tests
166+
uses: actions/download-artifact@abefc31eafcfbdf6c5336127c1346fdae79ff41c # v4.3.0
167+
with:
168+
name: win-e2e-build-artifacts
169+
path: dist/bin/tests/legacy-cli/
144170
- name: Run CLI E2E tests
145171
uses: ./.github/shared-actions/windows-bazel-test
146-
env:
147-
E2E_SHARD_TOTAL: 1
148172
with:
149-
test_target_name: e2e_node22
150-
test_args: --esbuild --glob "tests/basic/{build,rebuild}.ts"
173+
test_target_name: e2e.esbuild_node22
174+
test_args: --glob "tests/basic/{build,rebuild}.ts"
151175

152176
e2e-package-managers:
153177
needs: build

scripts/windows-testing/convert-symlinks.mjs

Lines changed: 0 additions & 143 deletions
This file was deleted.

0 commit comments

Comments
 (0)