Skip to content

Commit bf0dd63

Browse files
committed
refactor: improve setup-wsl action to support native Windows testing
Instead of building inside WSL on the host disk, we should build inside the WSL file system as that is significantly faster and avoids the interop bottleneck. For this, we naively copy over the repository after checkout into WSL; and operate from in there. Pending TODO is how we can properly cache contents inside WSL; as the cache action currently does not seem to pick it up properly.
1 parent 836bdd0 commit bf0dd63

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

github-actions/setup-wsl/action.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ outputs:
3636
description: UNC Windows path pointing to the WSL file system root.
3737
value: \\\\wsl.localhost\Debian
3838
repo_path:
39-
description: Path to the copied repository directory
39+
description: Path to the copied repository directory (as Unix wsl path)
4040
value: ${{steps.disk_path.outputs.repo}}
4141

4242
runs:
@@ -46,7 +46,7 @@ runs:
4646
# Note: `memory` by default is 50% of the Windows host machine. We want to try
4747
# a higher percentage to leverage more of the GitHub Windows machines.
4848
# They have 16GB by default. See: https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners.
49-
- uses: Vampire/setup-wsl@v4
49+
- uses: Vampire/setup-wsl@v5
5050
with:
5151
wsl-conf: |
5252
[interop]
@@ -100,9 +100,11 @@ runs:
100100
env:
101101
WSLENV: 'GITHUB_OUTPUT/p'
102102
run: |
103-
mkdir $HOME/repo
104-
cp -R ./* $HOME/repo/
105-
echo "repo=$(wslpath -w $HOME/repo)" >> $GITHUB_OUTPUT
103+
repo_path="$HOME/repo"
104+
cp -R . $repo_path
105+
106+
echo "repo=$repo_path" >> $GITHUB_OUTPUT
107+
echo "Repo path is: $repo_path"
106108
107109
- name: Cache for nvm, yarn profile caches.
108110
uses: actions/cache@v4
@@ -115,17 +117,18 @@ runs:
115117
${{ runner.os }}-wsl-cache-v${{inputs.cache_version}}-
116118
117119
- name: Setup nvm
118-
working-directory: ${{steps.paths.outputs.repo}}
119120
shell: wsl-bash {0}
120121
run: |
121122
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
122123
export NVM_DIR="$HOME/.nvm"
123124
# Note: Specify `--install` due to https://github.com/nvm-sh/nvm/issues/1985.
124125
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --install
125126
126-
- run: nvm install
127-
working-directory: ${{steps.paths.outputs.repo}}
127+
- name: Installing Node and npm (in WSL)
128+
run: |
129+
cd ${{steps.disk_path.outputs.repo}}
130+
nvm install
128131
shell: wsl-bash {0}
129-
- run: npm install -g yarn@1
130-
working-directory: ${{steps.paths.outputs.repo}}
132+
- name: Installing Yarn (in WSL)
133+
run: npm install -g yarn@1
131134
shell: wsl-bash {0}

0 commit comments

Comments
 (0)