Skip to content

Commit

Permalink
WIP: Add support for using mise under wsl
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Dec 30, 2024
1 parent 249c01b commit a32aa98
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
WSLENV: HOSTNAME:CI:GITHUB_ACTION:GITHUB_ACTION_PATH/p:GITHUB_ACTION_REPOSITORY:GITHUB_WORKFLOW:GITHUB_WORKSPACE/p:GITHUB_PATH/p:GITHUB_ENV/p:VIRTUAL_ENV/p

jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
Expand All @@ -21,16 +24,46 @@ jobs:
- run: |
npm run all
test: # make sure the action works on a clean machine without building
name: ${{ matrix.name || matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
include:
- name: wsl
os: windows-latest
wsl: true
shell: wsl-bash {0}
FORCE_OS: linux # force mise to think it's on linux
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Activate WSL if needed
if: matrix.wsl
uses: Vampire/setup-wsl@v4
with:
additional-packages: curl
distribution: Ubuntu-22.04
set-as-default: "true"
# '-i' seems to be the only option that loads .bashrc file that we need
# https://github.com/Vampire/setup-wsl/discussions/54
wsl-shell-command: "bash -i -eo pipefail"
# https://github.com/MicrosoftDocs/WSL/blob/main/WSL/wsl-config.md#L159
wsl-conf: |
[automount]
enabled = true
root = /
options = "metadata,umask=077"
[interop]
enabled = true
appendWindowsPath = true
[network]
hostname = wsl
- name: Setup mise
uses: ./
with:
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ async function setMiseToml(): Promise<void> {
}

function getOS(): string {
switch (process.platform) {
switch (process.env.FORCE_OS ?? process.platform) {
case 'darwin':
return 'macos'
case 'win32':
Expand Down

0 comments on commit a32aa98

Please sign in to comment.