@@ -7,21 +7,14 @@ Setup WSL
77A GitHub action to install and setup a Linux distribution for the Windows Subsystem for Linux (WSL).
88
99Beginning with ` windows-2019 ` virtual environment for GitHub actions, WSLv1 is enabled.
10+ Beginning with later ` windows-2022 ` virtual environment version for GitHub actions, WSLv2 is also available.
1011However, there is no Linux distribution installed by default and there is also no easy shell for
1112` run ` steps that executes commands within a WSL distribution.
1213
1314This action provides an easy way to install Linux distributions for WSL, update those to the latest packages and
1415install additional packages in them. It also provides a comfortable shell for ` run ` steps that uses the default
1516WSL distribution and distribution-specific shells if you set up multiple distributions.
1617
17- WSLv2 is not explicitly supported, because as of this writing neither the Windows version running on GitHub hosted
18- runners supports WSLv2, nor is Hyper-V enabled which is also necessary to enable WSLv2. If you use a self-hosted
19- runner on a Windows OS that is new enough with enabled Hyper-V and default WSL version set to 2, this action will
20- probably run just fine, but this setup is untested and not explicitly supported. If you want to provide a self-hosted
21- runner with a sufficient setup for this action to use or need changes for supporting WSLv2 I will happily accept this.
22- With a proper test environment (self-hosted runner) that will stay available, I would also add proper official support
23- where you can select the WSL version in your workflow files.
24-
2518Thanks to the provided [ typings] ( action-types.yml ) , it is possible to use this action in a type-safe way using
2619https://github.com/typesafegithub/github-workflows-kt which allows writing workflow files using a type-safe Kotlin DSL.
2720
@@ -58,7 +51,7 @@ To use this action with all inputs set to their default value, just use its name
5851_ ** Example:** _
5952
6053``` yaml
61- - uses : Vampire/setup-wsl@v3
54+ - uses : Vampire/setup-wsl@v4
6255` ` `
6356
6457This will first check whether the distribution is installed already. If not, it will be installed and also
@@ -121,7 +114,7 @@ defaults:
121114 shell: wsl-bash {0}
122115
123116steps:
124- - uses: Vampire/setup-wsl@v3
117+ - uses: Vampire/setup-wsl@v4
125118
126119 - run: |
127120 npm ci
@@ -163,7 +156,7 @@ The values currently supported by this action are:
163156
164157_**Example:**_
165158` ` ` yaml
166- - uses: Vampire/setup-wsl@v3
159+ - uses: Vampire/setup-wsl@v4
167160 with:
168161 distribution: Ubuntu-18.04
169162` ` `
@@ -180,7 +173,7 @@ space of the repository. Refer to [`actions/cache` documentation][actions/cache
180173
181174_**Example:**_
182175` ` ` yaml
183- - uses: Vampire/setup-wsl@v3
176+ - uses: Vampire/setup-wsl@v4
184177 with:
185178 use-cache: 'false'
186179` ` `
@@ -201,7 +194,7 @@ its contents in your configured value.
201194
202195_**Example:**_
203196` ` ` yaml
204- - uses: Vampire/setup-wsl@v3
197+ - uses: Vampire/setup-wsl@v4
205198 with:
206199 wsl-conf: |
207200 [automount]
@@ -220,7 +213,7 @@ This can also be used if the distribution is installed already.
220213
221214_**Example:**_
222215` ` ` yaml
223- - uses: Vampire/setup-wsl@v3
216+ - uses: Vampire/setup-wsl@v4
224217 with:
225218 set-as-default: 'false'
226219` ` `
@@ -234,7 +227,7 @@ This can also be used if the distribution is installed already.
234227
235228_**Example:**_
236229` ` ` yaml
237- - uses: Vampire/setup-wsl@v3
230+ - uses: Vampire/setup-wsl@v4
238231 with:
239232 update: 'true'
240233` ` `
@@ -248,7 +241,7 @@ This can also be used if the distribution is installed already.
248241
249242_**Example:**_
250243` ` ` yaml
251- - uses: Vampire/setup-wsl@v3
244+ - uses: Vampire/setup-wsl@v4
252245 with:
253246 additional-packages:
254247 dos2unix
@@ -266,7 +259,7 @@ it is automatically added.
266259
267260_**Example:**_
268261` ` ` yaml
269- - uses: Vampire/setup-wsl@v3
262+ - uses: Vampire/setup-wsl@v4
270263 with:
271264 wsl-shell-user: test
272265` ` `
@@ -297,7 +290,7 @@ scripts, the [`wsl-shell-wrapper-path` output](#wsl-shell-wrapper-path) and
297290
298291_**Examples:**_
299292` ` ` yaml
300- - uses: Vampire/setup-wsl@v3
293+ - uses: Vampire/setup-wsl@v4
301294 with:
302295 wsl-shell-command: ash -eu
303296
@@ -308,21 +301,21 @@ _**Examples:**_
308301 run: |
309302 useradd -m -p 4qBD5NWD3IkbU test
310303
311- - uses: Vampire/setup-wsl@v3
304+ - uses: Vampire/setup-wsl@v4
312305 with:
313306 wsl-shell-command: bash -c "sudo -u test bash --noprofile --norc -euo pipefail "\
314307
315308- shell: wsl-bash {0}
316309 run: id
317310
318- - uses: Vampire/setup-wsl@v3
311+ - uses: Vampire/setup-wsl@v4
319312 with:
320313 wsl-shell-command: bash -c "sudo -u test bash --noprofile --norc -euo pipefail '{0}'"
321314
322315- shell: wsl-bash {0}
323316 run: id
324317
325- - uses: Vampire/setup-wsl@v3
318+ - uses: Vampire/setup-wsl@v4
326319 with:
327320 wsl-shell-command: bash -c "cd && bash --noprofile --norc -euo pipefail '{0}'"
328321
@@ -333,6 +326,26 @@ _**Examples:**_
333326 run: DEL /F "${{ steps.execute_action.outputs.wsl-shell-wrapper-path }}"
334327` ` `
335328
329+ # ### wsl-version
330+
331+ The WSL version that should be used. This can be set to any positive integer. Using an untested one might
332+ work or break, so issues a warning for the action run. Currently, WSLv1 and WSLv2 are tested and do not
333+ issue a warning. If a new WSL version is available and your workflow works with it, please report an issue
334+ so that proper tests can be added and the warning for that version removed.
335+ Default is '1' if running on 'windows-2019' virtual environment as this is not yet supporting WSLv2.
336+ Default is '2' if not running on 'windows-2019' virtual environment.
337+
338+ **Default value:**
339+ * `1` if running on 'windows-2019' virtual environment as this is not yet supporting WSLv2
340+ * `2` if not running on 'windows-2019' virtual environment
341+
342+ _**Example:**_
343+ ` ` ` yaml
344+ - uses: Vampire/setup-wsl@v3
345+ with:
346+ wsl-version: 1
347+ ` ` `
348+
336349
337350
338351# ## Outputs
0 commit comments