Skip to content

Commit

Permalink
tests.yml: adjust WSL installation commands
Browse files Browse the repository at this point in the history
  • Loading branch information
EricFromCanada committed Jun 21, 2024
1 parent 8c6fb5e commit b958233
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,49 @@ jobs:
/Library/Developer/CommandLineTools
sudo xcode-select --reset
- name: Install WSL
if: runner.os == 'Windows'
shell: powershell
run: |
Write-Output "::group::Install Windows Subsystem for Linux"
winget install --name 'Windows Subsystem for Linux' --accept-source-agreements --accept-package-agreements --silent --verbose
Write-Output "::endgroup::"
# Install the new distro
$storeId="9PN20MSR04DW"
$launcher="ubuntu2204.exe"
$appxname="Ubuntu22.04LTS"
# Uninstall pre-existing appx
$pkgFullName = (Get-AppxPackage | Where-Object Name -like "CanonicalGroupLimited.${appxname}").PackageFullName
if ( "$pkgFullName" -ne "" ) {
Remove-AppxPackage "${pkgFullName}" 3>&1 2>&1 | Out-Null
}
# Unregister leftover distros
$env:WSL_UTF8=1
wsl.exe --shutdown
wsl.exe --unregister Ubuntu-22.04 3>&1 2>&1 | Out-Null
Write-Output "::group::Install a new distro"
winget install --id "${storeId}" --accept-source-agreements --accept-package-agreements --silent
Write-Output "::endgroup::"
# Register the new distro
& ${launcher} install --root --ui=none
# Testing succesful install
& ${launcher} run echo Created a new distro with user: '$(whoami)'
if ( ! $? ) { Exit(1) }
- name: Set up WSL
if: runner.os == 'Windows'
shell: powershell
run: |
wsl --update
wsl --version
wsl --set-default-version 2
wsl --install Ubuntu-22.04 --no-launch
ubuntu2204 install --root
wsl --set-default Ubuntu-22.04
wsl --list --verbose
wsl --exec apt-get update
Expand Down

0 comments on commit b958233

Please sign in to comment.