Skip to content

build: experiment with windows testing #4199

build: experiment with windows testing

build: experiment with windows testing #4199

Workflow file for this run

name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
defaults:
run:
shell: bash
jobs:
analyze:
runs-on: ubuntu-latest
outputs:
snapshots: ${{ steps.filter.outputs.snapshots }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
snapshots:
- 'tests/legacy-cli/e2e/ng-snapshot/package.json'
lint:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@b015169b635123c1ab9084f604e36b6342eac171
- name: Setup ESLint Caching
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: .eslintcache
key: ${{ runner.os }}-${{ hashFiles('.eslintrc.json') }}
- name: Install node modules
run: yarn install --immutable
- name: Generate JSON schema types
# Schema types are required to correctly lint the TypeScript code
run: yarn admin build-schema
- name: Run ESLint
run: yarn lint --cache-strategy content
- name: Validate NgBot Configuration
run: yarn ng-dev ngbot verify
- name: Validate Circular Dependencies
run: yarn ts-circular-deps check
- name: Run Validation
run: yarn admin validate
- name: Check Package Licenses
uses: angular/dev-infra/github-actions/linting/licenses@b015169b635123c1ab9084f604e36b6342eac171
- name: Check tooling setup
run: yarn check-tooling-setup
- name: Check commit message
# Commit message validation is only done on pull requests as its too late to validate once
# it has been merged.
run: yarn ng-dev commit-message validate-range ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
- name: Check code format
# Code formatting checks are only done on pull requests as its too late to validate once
# it has been merged.
run: yarn ng-dev format changed --check ${{ github.event.pull_request.base.sha }}
build:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@b015169b635123c1ab9084f604e36b6342eac171
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@b015169b635123c1ab9084f604e36b6342eac171
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@b015169b635123c1ab9084f604e36b6342eac171
- name: Install node modules
run: yarn install --immutable
- name: Build release targets
run: yarn ng-dev release build
- name: Store PR release packages
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: packages
path: dist/releases/*.tgz
retention-days: 14
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@b015169b635123c1ab9084f604e36b6342eac171
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@b015169b635123c1ab9084f604e36b6342eac171
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@b015169b635123c1ab9084f604e36b6342eac171
- name: Install node modules
run: yarn install --immutable
- name: Run module and package tests
run: yarn bazel test //modules/... //packages/...
env:
ASPECT_RULES_JS_FROZEN_PNPM_LOCK: '1'
e2e:
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
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@b015169b635123c1ab9084f604e36b6342eac171
- name: Install node modules
run: yarn install --immutable
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@b015169b635123c1ab9084f604e36b6342eac171
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@b015169b635123c1ab9084f604e36b6342eac171
- 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 }}
e2e-windows-subset:
# needs: build
runs-on: windows-2025
steps:
# Git checkout converts to CRLF by default. This causes the Aspect lock
# files to differ. See: https://github.com/actions/checkout/issues/135.
- run: |
git config --system core.autocrlf false
git config --system core.eol lf
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@b015169b635123c1ab9084f604e36b6342eac171
- name: Install node modules
run: yarn install --immutable
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@b015169b635123c1ab9084f604e36b6342eac171
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@a5e90c88a0fc012de199fe6f148c12b5476d6d1b
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
detached: true
- uses: Vampire/setup-wsl@v4
with:
wsl-conf: |
[interop]
appendWindowsPath=false
[wsl2]
networkingMode=mirrored
wsl-shell-command: bash --login -euo pipefail
additional-packages: |
curl
ca-certificates
g++
unzip
zip
git
python3
tar
- name: Setup nvm
shell: wsl-bash {0}
run: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
export NVM_DIR="$HOME/.nvm"
# Note: Specify `--install` due to https://github.com/nvm-sh/nvm/issues/1985.
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --install
- run: nvm install
shell: wsl-bash {0}
- run: npm install -g yarn@1
shell: wsl-bash {0}
- name: Install node modules in WSL (re-using from previous install/cache restore)
run: yarn install --immutable
shell: wsl-bash {0}
- name: Determining paths for WSL usage
id: wsl_paths
run: |
cmd_path=$(which cmd.exe)
cmd_wsl_path=$(wsl exec wslpath -u $cmd_path)
npm_path=$(which npm)
npm_wls_path=$(wsl exec wslpath -u "$npm_path")
tmp_dir_wsl_path=$(wsl exec wslpath -u "/tmp")
git_bin=$(which git)
git_bin_wsl_path=$(wsl exec wslpath -u "$git_bin")
echo "cmd_path=$cmd_wsl_path" >> $GITHUB_OUTPUT
echo "npm_path=$npm_wls_path" >> $GITHUB_OUTPUT
echo "tmp_path=$tmp_dir_wsl_path" >> $GITHUB_OUTPUT
echo "git_path=$git_bin_wsl_path" >> $GITHUB_OUTPUT
- name: Create link to WSL drive
shell: powershell
run: New-Item -ItemType SymbolicLink -Path "C:\wsl_root" -Target "\\wsl.localhost\Debian"
- name: Run CLI E2E tests
env:
# See: https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows
WSLENV: 'GOOGLE_APPLICATION_CREDENTIALS/p'
run: |
yarn bazel test \
--config=e2e //tests/legacy-cli:e2e_node22 \
--test_filter="tests/basic/{build,rebuild}.ts" \
--test_arg="--esbuild" \
--test_env="NG_E2E_RUNNER_WSL_ROOT=C:\wsl_root" \
--test_env="NG_E2E_RUNNER_WSL_UNC_BASE=\\\\wsl.localhost\Debian" \
--test_env="NG_E2E_RUNNER_WINDOWS_CMD=${{steps.wsl_paths.outputs.cmd_path}}" \
--test_env="NG_E2E_RUNNER_WINDOWS_NPM=${{steps.wsl_paths.outputs.npm_path}}" \
--test_env="NG_E2E_RUNNER_WINDOWS_TMP_DIR=${{steps.wsl_paths.outputs.tmp_path}}" \
--test_env="NG_E2E_RUNNER_WINDOWS_GIT_BASH_BIN=${{steps.wsl_paths.outputs.git_path}}" \
--test_output=streamed \
--strategy=TestRunner=standalone
shell: wsl-bash {0}
e2e-package-managers:
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [22]
subset: [yarn, pnpm]
shard: [0, 1, 2]
runs-on: ${{ matrix.os }}
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@b015169b635123c1ab9084f604e36b6342eac171
- name: Install node modules
run: yarn install --immutable
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@b015169b635123c1ab9084f604e36b6342eac171
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@3bfa6d8c9861c6477a52146828382a3d5043005f
- 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 }}
e2e-snapshots:
needs: [analyze, build]
if: needs.analyze.outputs.snapshots == 'true'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [18]
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@b015169b635123c1ab9084f604e36b6342eac171
- name: Install node modules
run: yarn install --immutable
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@b015169b635123c1ab9084f604e36b6342eac171
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@b015169b635123c1ab9084f604e36b6342eac171
- 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 }}