|
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 |
4 | 4 |
|
5 | 5 | inputs: |
6 | 6 | test_target_name: |
7 | | - description: E2E test target name |
| 7 | + description: E2E test target name. |
8 | 8 | required: true |
9 | 9 | test_args: |
10 | 10 | description: | |
11 | 11 | Text representing the command line arguments that |
12 | 12 | should be passed to the e2e test runner. |
13 | 13 | required: false |
14 | 14 | 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' |
15 | 21 |
|
16 | 22 | runs: |
17 | | - using: composite |
| 23 | + using: 'composite' |
18 | 24 | 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 |
49 | 27 | 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 }} |
57 | 29 |
|
58 | 30 | - name: Convert symlinks for Windows host |
59 | | - shell: wsl-bash {0} |
| 31 | + shell: pwsh |
60 | 32 | 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" |
70 | 34 |
|
71 | 35 | # Needed for resolution because Aspect/Bazel looks for repositories at `<workspace>/external`. |
72 | 36 | # 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 ".." |
74 | 39 |
|
75 | | - - name: Run tests |
76 | | - # Note: This is Git Bash. |
| 40 | + - name: Run CLI E2E tests |
77 | 41 | shell: bash |
78 | 42 | env: |
79 | 43 | 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 }} |
83 | 45 | 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 }}" |
0 commit comments