Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vedantmgoyal9/setup-wsl2
GitHub action to enable WSL2 and install a Linux distro in GitHub-hosted runners.
https://github.com/vedantmgoyal9/setup-wsl2
actions github github-actions linux ubuntu windows wsl
Last synced: about 2 months ago
JSON representation
GitHub action to enable WSL2 and install a Linux distro in GitHub-hosted runners.
- Host: GitHub
- URL: https://github.com/vedantmgoyal9/setup-wsl2
- Owner: vedantmgoyal9
- License: mit
- Created: 2024-11-09T14:37:58.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-22T10:03:23.000Z (about 2 months ago)
- Last Synced: 2024-11-22T10:23:28.694Z (about 2 months ago)
- Topics: actions, github, github-actions, linux, ubuntu, windows, wsl
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# setup-wsl2
GitHub action to enable WSL2 and install a Linux distro in GitHub-hosted runners.
GitHub-hosted Windows runners come with WSL 1 by default. This action upgrades to WSL 2 and installs a Linux distro of your choice (Ubuntu by default).
It also enables systemd support if you are using `windows-2022`/`windows-latest` runner. See https://learn.microsoft.com/windows/wsl/systemd.
### Inputs
| Input | Description | Default |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| `distro` | The Linux distro to install. You can use any distro which is available in `wsl --list --online`.
**Note:** Use `none` to skip installing any distro. | `Ubuntu` |
| `enable-systemd` | Enable systemd.
**Note:** Please set it to `false` if you are using `windows-2019` runner. | `true` |### Example Usage
```yaml
name: CI/CD
on:
push:
branches: [main]
jobs:
build:
# always windows. why would you use wsl on linux or macos 😂
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: vedantmgoyal9/setup-wsl2@main
- run: apt update && apt upgrade -y
# add this line to run the commands inside linux
shell: wsl-run {0}
- run: |
ls -al
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
shell: wsl-run {0} # don't forget to add this
```