Skip to content

build: update dev-infra and rework windows native testing #29705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# This file should be checked into version control along with the pnpm-lock.yaml file.
.npmrc=-1406867100
modules/testing/builder/package.json=973445093
package.json=1411918173
package.json=-462103860
packages/angular/build/package.json=1920607808
packages/angular/cli/package.json=-1917515334
packages/angular/pwa/package.json=1108903917
packages/angular/ssr/package.json=-2027233365
packages/angular/ssr/package.json=1556449772
packages/angular_devkit/architect/package.json=-363443363
packages/angular_devkit/architect_cli/package.json=1551210941
packages/angular_devkit/build_angular/package.json=595549079
Expand All @@ -17,7 +17,7 @@ packages/angular_devkit/schematics/package.json=-1133510866
packages/angular_devkit/schematics_cli/package.json=-2026655035
packages/ngtools/webpack/package.json=884391309
packages/schematics/angular/package.json=251715148
pnpm-lock.yaml=2112966384
pnpm-lock.yaml=-758853739
pnpm-workspace.yaml=-1264044456
tests/package.json=700948366
yarn.lock=1484073494
yarn.lock=1188157
14 changes: 3 additions & 11 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ test:no-sharding --flaky_test_attempts=1 --test_sharding_strategy=disabled
# See https://github.com/bazelbuild/bazel/issues/4603
build --symlink_prefix=dist/

# Disable watchfs as it causes tests to be flaky on Windows
# https://github.com/angular/angular/issues/29541
build --nowatchfs

# Turn off legacy external runfiles
build --nolegacy_external_runfiles

Expand Down Expand Up @@ -133,9 +129,9 @@ build:remote --jobs=150

# Setup the toolchain and platform for the remote build execution. The platform
# is provided by the shared dev-infra package and targets k8 remote containers.
build:remote --extra_execution_platforms=@npm//@angular/build-tooling/bazel/remote-execution:platform_with_network
build:remote --host_platform=@npm//@angular/build-tooling/bazel/remote-execution:platform_with_network
build:remote --platforms=@npm//@angular/build-tooling/bazel/remote-execution:platform_with_network
build:remote --extra_execution_platforms=@devinfra//bazel/remote-execution:platform_with_network
build:remote --host_platform=@devinfra//bazel/remote-execution:platform_with_network
build:remote --platforms=@devinfra//bazel/remote-execution:platform_with_network

# Set remote caching settings
build:remote --remote_accept_cached=true
Expand All @@ -162,10 +158,6 @@ build:remote-cache --google_default_credentials
# Fixes use of npm paths with spaces such as some within the puppeteer module
build --experimental_inprocess_symlink_creation

# Enable runfiles even on Windows.
# Architect resolves output files from data files, and this isn't possible without runfile support.
build --enable_runfiles

####################################################
# rules_js specific flags
####################################################
Expand Down
79 changes: 79 additions & 0 deletions .github/shared-actions/windows-bazel-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: 'Native Windows Bazel e2e test'
description: 'Runs an Angular CLI e2e Bazel test on native Windows (dispatched from inside WSL)'
author: 'Angular'

inputs:
test_target_name:
description: E2E test target name
required: true
test_args:
description: |
Text representing the command line arguments that
should be passed to the e2e test runner.
required: false
default: ''

runs:
using: composite
steps:
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@2667d139a421977a40c3ea7ec768609fb19a8b9d
with:
allow_windows_rbe: true

- name: Initialize WSL
id: init_wsl
uses: angular/dev-infra/github-actions/setup-wsl@9a3e28a515bf51cd2ecfd5f4d5b17613845e6f44
with:
wsl_firewall_interface: 'vEthernet (WSL (Hyper-V firewall))'

- name: Install node modules in WSL (re-using from previous install/cache restore)
run: |
cd ${{steps.init_wsl.outputs.repo_path}}
yarn install --immutable
shell: wsl-bash {0}

- name: Build test binary for Windows (inside WSL)
shell: wsl-bash {0}
run: |
cd ${{steps.init_wsl.outputs.repo_path}}
yarn bazel \
build --config=e2e //tests/legacy-cli:${{inputs.test_target_name}} --platforms=tools:windows_x64
env:
# See: https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows
WSLENV: 'GOOGLE_APPLICATION_CREDENTIALS/p'

- name: Copying binary artifact to host
shell: wsl-bash {0}
run: |
cd ${{steps.init_wsl.outputs.repo_path}}
tar -cf /tmp/test.tar.gz dist/bin/tests/legacy-cli/${{inputs.test_target_name}}_
mkdir /mnt/c/test
mv /tmp/test.tar.gz /mnt/c/test
(cd /mnt/c/test && tar -xf /mnt/c/test/test.tar.gz)

- name: Convert symlinks for Windows host
shell: wsl-bash {0}
run: |
cd ${{steps.init_wsl.outputs.repo_path}}

runfiles_dir="/mnt/c/test/dist/bin/tests/legacy-cli/${{inputs.test_target_name}}_/${{inputs.test_target_name}}.bat.runfiles"

# Make WSL symlinks compatible on Windows native file system.
node scripts/windows-testing/convert-symlinks.mjs $runfiles_dir "${{steps.init_wsl.outputs.cmd_path}}"

# Needed for resolution because Aspect/Bazel looks for repositories at `<workspace>/external`.
# TODO(devversion): consult with Aspect on why this is needed.
(cd $runfiles_dir/angular_cli && ${{steps.init_wsl.outputs.cmd_path}} /C "mklink /D external ..")

- name: Run tests
# Note: This is Git Bash.
shell: bash
env:
BAZEL_BINDIR: '.'
working-directory: "C:\\test"
run: |
node "${{github.workspace}}\\scripts\\windows-testing\\parallel-executor.mjs" \
$PWD/dist/bin/tests/legacy-cli/${{inputs.test_target_name}}_/${{inputs.test_target_name}}.bat.runfiles \
${{inputs.test_target_name}} \
"${{inputs.test_args}}" \
36 changes: 24 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,12 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
node: [20, 22]
subset: [npm, esbuild]
shard: [0, 1, 2, 3, 4, 5]
exclude:
# Skip Node.js v20 tests on Windows
- os: windows-latest
node: 20
runs-on: ${{ matrix.os }}
steps:
# Workaround for: https://github.com/bazel-contrib/bazel-lib/issues/968.
# TODO(devversion): Remove when Aspect lib issue is fixed.
- run: choco install gzip
if: ${{matrix.os == 'windows-latest'}}
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@836bdd0543d15904c469f5a0ce869d30a8029971
- name: Install node modules
Expand All @@ -97,7 +89,27 @@ jobs:
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@836bdd0543d15904c469f5a0ce869d30a8029971
- name: Run CLI E2E tests
run: yarn bazel test --define=E2E_SHARD_TOTAL=6 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}
run: yarn 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 }}

e2e_windows:
strategy:
fail-fast: false
matrix:
os: [windows-2025]
node: [22]
subset: [npm, esbuild]
shard: [0, 1, 2, 3, 4, 5]
runs-on: ${{ matrix.os }}
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@0000d926624b2fd918e93f1c6b5e2defba9af91f
- name: Run CLI E2E tests
uses: ./.github/shared-actions/windows-bazel-test
with:
test_target_name: e2e.${{ matrix.subset }}_node${{ matrix.node }}
env:
E2E_SHARD_TOTAL: 6
E2E_SHARD_INDEX: ${{ matrix.shard }}

e2e-package-managers:
needs: test
Expand All @@ -119,7 +131,7 @@ jobs:
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@836bdd0543d15904c469f5a0ce869d30a8029971
- name: Run CLI E2E tests
run: yarn bazel test --define=E2E_SHARD_TOTAL=3 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}
run: yarn bazel test --test_env=E2E_SHARD_TOTAL=3 --test_env=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}

e2e-snapshots:
needs: test
Expand All @@ -141,7 +153,7 @@ jobs:
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@836bdd0543d15904c469f5a0ce869d30a8029971
- name: Run CLI E2E tests
run: yarn bazel test --define=E2E_SHARD_TOTAL=6 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.snapshots.${{ matrix.subset }}_node${{ matrix.node }}
run: yarn bazel test --test_env=E2E_SHARD_TOTAL=6 --test_env=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.snapshots.${{ matrix.subset }}_node${{ matrix.node }}

browsers:
needs: build
Expand Down
24 changes: 9 additions & 15 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,19 @@ jobs:
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@836bdd0543d15904c469f5a0ce869d30a8029971
- name: Run CLI E2E tests
run: yarn bazel test --define=E2E_SHARD_TOTAL=6 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}
run: yarn 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 }}

e2e-windows-subset:
needs: build
runs-on: windows-latest
runs-on: windows-2025
steps:
# Workaround for: https://github.com/bazel-contrib/bazel-lib/issues/968.
# TODO(devversion): Remove when Aspect lib issue is fixed.
- run: choco install gzip
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@836bdd0543d15904c469f5a0ce869d30a8029971
- name: Install node modules
run: yarn install --immutable
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@836bdd0543d15904c469f5a0ce869d30a8029971
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@836bdd0543d15904c469f5a0ce869d30a8029971
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@0000d926624b2fd918e93f1c6b5e2defba9af91f
- name: Run CLI E2E tests
run: yarn bazel test --config=e2e //tests/legacy-cli:e2e_node22 --test_filter="tests/basic/{build,rebuild}.ts" --test_arg="--esbuild"
uses: ./.github/shared-actions/windows-bazel-test
with:
test_target_name: e2e_node22
test_args: --esbuild --glob "tests/basic/{build,rebuild}.ts"

e2e-package-managers:
needs: build
Expand All @@ -163,7 +157,7 @@ jobs:
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@836bdd0543d15904c469f5a0ce869d30a8029971
- name: Run CLI E2E tests
run: yarn bazel test --define=E2E_SHARD_TOTAL=3 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}
run: yarn bazel test --test_env=E2E_SHARD_TOTAL=3 --test_env=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.${{ matrix.subset }}_node${{ matrix.node }}

e2e-snapshots:
needs: [analyze, build]
Expand All @@ -186,4 +180,4 @@ jobs:
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@836bdd0543d15904c469f5a0ce869d30a8029971
- name: Run CLI E2E tests
run: yarn bazel test --define=E2E_SHARD_TOTAL=6 --define=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.snapshots.${{ matrix.subset }}_node${{ matrix.node }}
run: yarn bazel test --test_env=E2E_SHARD_TOTAL=6 --test_env=E2E_SHARD_INDEX=${{ matrix.shard }} --config=e2e //tests/legacy-cli:e2e.snapshots.${{ matrix.subset }}_node${{ matrix.node }}
36 changes: 16 additions & 20 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ workspace(name = "angular_cli")

DEFAULT_NODE_VERSION = "20.11.1"

# Workaround for: https://github.com/bazel-contrib/bazel-lib/issues/968.
# Override toolchain for tar on windows.
register_toolchains(
"//tools:windows_tar_system_toolchain",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

http_archive(
Expand Down Expand Up @@ -145,17 +139,6 @@ aspect_bazel_lib_dependencies()

aspect_bazel_lib_register_toolchains()

register_toolchains(
"@npm//@angular/build-tooling/bazel/git-toolchain:git_linux_toolchain",
"@npm//@angular/build-tooling/bazel/git-toolchain:git_macos_x86_toolchain",
"@npm//@angular/build-tooling/bazel/git-toolchain:git_macos_arm64_toolchain",
"@npm//@angular/build-tooling/bazel/git-toolchain:git_windows_toolchain",
)

load("@npm//@angular/build-tooling/bazel/browsers:browser_repositories.bzl", "browser_repositories")

browser_repositories()

load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories")

esbuild_repositories(
Expand Down Expand Up @@ -205,6 +188,10 @@ npm_translate_lock(
# for `rules_nodejs` dependencies :)
},
pnpm_lock = "//:pnpm-lock.yaml",
public_hoist_packages = {
# TODO: Remove when https://github.com/verdaccio/verdaccio/commit/bf0e09a509e8e0a74167b0307d129202bc3f40d2 is available.
"@verdaccio/config": [""],
},
update_pnpm_lock = True,
verify_node_modules_ignored = "//:.bazelignore",
yarn_lock = "//:yarn.lock",
Expand All @@ -216,8 +203,6 @@ npm_repositories()

http_archive(
name = "aspect_rules_ts",
patch_args = ["-p1"],
patches = ["//tools:rules_ts_windows.patch"],
sha256 = "4263532b2fb4d16f309d80e3597191a1cb2fb69c19e95d91711bd6b97874705e",
strip_prefix = "rules_ts-3.5.0",
url = "https://github.com/aspect-build/rules_ts/releases/download/v3.5.0/rules_ts-v3.5.0.tar.gz",
Expand Down Expand Up @@ -253,7 +238,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
name = "devinfra",
commit = "0ad6a370f70638e785d6ef1f90dc6ede34684a47",
commit = "bf0dd632ed129ee8770b09a6e11c6497162b3edb",
remote = "https://github.com/angular/dev-infra.git",
)

Expand All @@ -264,3 +249,14 @@ setup_dependencies_1()
load("@devinfra//bazel:setup_dependencies_2.bzl", "setup_dependencies_2")

setup_dependencies_2()

load("@devinfra//bazel/browsers:browser_repositories.bzl", "browser_repositories")

browser_repositories()

register_toolchains(
"@devinfra//bazel/git-toolchain:git_linux_toolchain",
"@devinfra//bazel/git-toolchain:git_macos_x86_toolchain",
"@devinfra//bazel/git-toolchain:git_macos_arm64_toolchain",
"@devinfra//bazel/git-toolchain:git_windows_toolchain",
)
4 changes: 3 additions & 1 deletion goldens/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")

package(default_visibility = ["//visibility:public"])

filegroup(
copy_to_bin(
name = "public-api",
srcs = glob([
"public-api/**/*.md",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"devDependencies": {
"@ampproject/remapping": "2.3.0",
"@angular/animations": "19.2.0",
"@angular/bazel": "https://github.com/angular/bazel-builds.git#8faa06d66416ce78073ab59539ff03f5253b8d52",
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#a6a996a69cfc03b3fbe538f11dd24b7bc4b30592",
"@angular/bazel": "https://github.com/angular/bazel-builds.git#58e1a344eed2dfea489cd290a4b4a963f7e3ac65",
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#d4727212a9d0f7eb63ae3116d73c769d9bd0bdc1",
"@angular/cdk": "19.2.1",
"@angular/common": "19.2.0",
"@angular/compiler": "19.2.0",
Expand All @@ -72,7 +72,6 @@
"@babel/runtime": "7.26.9",
"@bazel/bazelisk": "1.25.0",
"@bazel/buildifier": "8.0.3",
"@bazel/runfiles": "^6.0.0",
"@discoveryjs/json-ext": "0.6.3",
"@eslint/compat": "1.2.7",
"@eslint/eslintrc": "3.3.0",
Expand All @@ -82,6 +81,7 @@
"@listr2/prompt-adapter-inquirer": "2.0.18",
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^13.0.5",
"@stylistic/eslint-plugin": "^4.0.0",
"@types/babel__core": "7.20.5",
Expand Down
6 changes: 3 additions & 3 deletions packages/angular/build/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
load("@devinfra//bazel/api-golden:index_rjs.bzl", "api_golden_test_npm_package")
load("@npm2//:defs.bzl", "npm_link_all_packages")
load("//tools:defaults2.bzl", "copy_to_bin", "jasmine_test", "npm_package", "ts_project")
load("//tools:ts_json_schema.bzl", "ts_json_schema")
Expand Down Expand Up @@ -309,6 +309,6 @@ api_golden_test_npm_package(
":npm_package",
"//goldens:public-api",
],
golden_dir = "angular_cli/goldens/public-api/angular/build",
npm_package = "angular_cli/packages/angular/build/npm_package",
golden_dir = "goldens/public-api/angular/build",
npm_package = "packages/angular/build/npm_package",
)
6 changes: 3 additions & 3 deletions packages/angular/ssr/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
load("@devinfra//bazel/api-golden:index_rjs.bzl", "api_golden_test_npm_package")
load("@npm2//:defs.bzl", "npm_link_all_packages")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//tools:defaults2.bzl", "ng_package", "ts_project")
Expand Down Expand Up @@ -90,6 +90,6 @@ api_golden_test_npm_package(
":npm_package",
"//goldens:public-api",
],
golden_dir = "angular_cli/goldens/public-api/angular/ssr",
npm_package = "angular_cli/packages/angular/ssr/npm_package",
golden_dir = "goldens/public-api/angular/ssr",
npm_package = "packages/angular/ssr/npm_package",
)
Loading