Skip to content

Prepare QCW Lima (from revision) #248

Prepare QCW Lima (from revision)

Prepare QCW Lima (from revision) #248

name: Prepare QCW Lima (from revision)
on:
workflow_dispatch:
workflow_call:
outputs:
lima_version:
description: "Lima version"
value: ${{ jobs.build.outputs.lima_version }}
gowsllinks_version:
description: "go-wsllinks version"
value: ${{ jobs.build.outputs.gowsllinks_version }}
bundles_version:
description: "bundles version"
value: ${{ jobs.build.outputs.bundles_version }}
alpine_version:
description: "Alpine version"
value: ${{ jobs.build.outputs.alpine_version }}
alpine_wsl_version:
description: "Alpine-WSL version"
value: ${{ jobs.build.outputs.alpine_wsl_version }}
env:
LIMA_GITURL: https://github.com/lima-vm/lima.git
LIMA_SHA: 44f3da4a6a734730a663612661b851be1ece60cd
LIMA_VERSION: 1.1.1
jobs:
call-prepare-alpine-wsl:
uses: ./.github/workflows/prepare-alpine-wsl-release.yml
call-prepare-go-wsllinks:
uses: ./.github/workflows/prepare-go-wsllinks-release.yml
build:
needs: [call-prepare-go-wsllinks, call-prepare-alpine-wsl]
runs-on: windows-2025
outputs:
lima_version: ${{ steps.make_versions.outputs.lima }}
gowsllinks_version: ${{ steps.make_versions.outputs.gowsllinks }}
bundles_version: ${{ steps.make_versions.outputs.bundles }}
alpine_version: ${{ steps.make_versions.outputs.alpine }}
alpine_wsl_version: ${{ steps.make_versions.outputs.alpine_wsl }}
steps:
- name: "πŸ—οΈ Install msys2 (user)"
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
git make mingw-w64-ucrt-x86_64-go patch unzip zip
- name: "πŸ“ Configure checkout"
run: git config --global core.autocrlf input
- name: "πŸ“ Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: "πŸ“ Fetch sources"
shell: msys2 {0}
run: |
mkdir lima-release
cd lima-release
git init
git config --local core.symlinks true
git remote add origin $LIMA_GITURL
git fetch --tags origin $LIMA_SHA
git checkout FETCH_HEAD
patch --binary -l -p 1 < ../patches/lima/0001-Add-WSL2-based-tooling-support-on-Windows-hosts.patch
- name: "πŸ› οΈ Build Lima"
working-directory: lima-release
shell: msys2 {0}
run: |
make binaries
- name: "πŸ“¦ Pack Lima"
shell: msys2 {0}
run: |
mkdir -p qcw
mkdir -p qcw-tmp
cp -r "lima-release/_output" qcw-tmp/lima
cd qcw-tmp/
zip -9 -r ../qcw/lima.zip .
cd ../qcw
find . -type f \( ! -iname "*.checksums" \) -exec sha256sum -b {} \; > sha.checksums
find . -type f \( ! -iname "*.checksums" \) -exec sha512sum -b {} \; >> sha.checksums
cat sha.checksums
- id: make_versions
name: "πŸ“Œ Export versions"
env:
GOWSLLINKS_VERSION: ${{ needs.call-prepare-go-wsllinks.outputs.gowsllinks_version }}
BUNDLES_VERSION: ${{ needs.call-prepare-go-wsllinks.outputs.bundles_version }}
ALPINE_VERSION: ${{ needs.call-prepare-alpine-wsl.outputs.alpine_version }}
ALPINEWSL_VERSION: ${{ needs.call-prepare-alpine-wsl.outputs.alpine_wsl_version }}
shell: msys2 {0}
run: |
echo "lima=$LIMA_VERSION-$LIMA_SHA" >> "$GITHUB_OUTPUT"
echo "gowsllinks=$GOWSLLINKS_VERSION" >> "$GITHUB_OUTPUT"
echo "bundles=$BUNDLES_VERSION" >> "$GITHUB_OUTPUT"
echo "alpine=$ALPINE_VERSION" >> "$GITHUB_OUTPUT"
echo "alpine_wsl=$ALPINEWSL_VERSION" >> "$GITHUB_OUTPUT"
- name: "πŸš€ Upload artifact"
uses: actions/upload-artifact@v4
with:
name: qcw-lima
path: qcw
test:
needs: [build]
strategy:
fail-fast: false
matrix:
bundle: [wsl, git]
runs-on: windows-2025
steps:
- name: "πŸ—οΈ Install msys2 (user)"
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
git patch unzip
- name: "πŸ“ Configure checkout"
run: git config --global core.autocrlf input
- name: "πŸ“ Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: "πŸ›» Donwload artifacts"
uses: actions/download-artifact@v4
with:
path: qcw-art
- name: "πŸ—οΈ Install msys2 (system)"
shell: pwsh
run: "$env:PATH = 'C:\\msys64\\usr\\bin;' + $env:PATH\npacman -Sy --noconfirm openbsd-netcat diffutils \n"
- name: "πŸ—οΈ Install tools"
run: |
winget install --silent --accept-source-agreements --accept-package-agreements --disable-interactivity SoftwareFreedomConservancy.QEMU
winget install --silent --accept-source-agreements --accept-package-agreements --disable-interactivity MikeFarah.yq
- name: "πŸ—οΈ Install lima-infra"
shell: pwsh
run: |
wsl --set-default-version 2
wsl --shutdown
wsl --update
wsl --version
wsl --install -n --from-file qcw-art/qcw-alpine/lima-infra.wsl
wsl -l -v
- name: "βœ… Check user"
shell: pwsh
run: |
cmd /c "start wsl -d lima-infra -u root bash -c `"until pkill -KILL -u 1000; do sleep 1; done`""
wsl -d lima-infra
wsl -d lima-infra whoami
wsl -d lima-infra -u lima whoami
wsl -d lima-infra wslinfo --networking-mode
- name: "βš™οΈ Configure firewalls"
shell: pwsh
run: |
Import-Module -Name NetSecurity -UseWindowsPowerShell
Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -DefaultInboundAction Allow
New-NetFirewallRule -DisplayName "Allow QEMU x86_64" -Direction Inbound -Program "$env:PROGRAMFILES\QEMU\qemu-system-x86_64.exe" -Action Allow
New-NetFirewallRule -DisplayName "Allow QEMU x86_64w" -Direction Inbound -Program "$env:PROGRAMFILES\QEMU\qemu-system-x86_64w.exe" -Action Allow
- name: "πŸ“ Fetch sources"
shell: msys2 {0}
run: |
mkdir lima-release
cd lima-release
git init
git config --local core.symlinks true
git remote add origin $LIMA_GITURL
git fetch --tags origin $LIMA_SHA
git checkout FETCH_HEAD
patch --binary -l -p 1 < ../patches/lima/0001-Add-WSL2-based-tooling-support-on-Windows-hosts.patch
- name: "πŸ› οΈ Build Lima"
working-directory: lima-release
shell: msys2 {0}
run: |
pushd ../qcw-art/qcw-go-wsllinks/
unzip bundles.zip
./bundle-${{ matrix.bundle }}/install-tools.bat
popd
pushd ../qcw-art/qcw-lima/
unzip lima.zip
popd
- name: "πŸ§ͺ Test Lima QEMU machine '${{ matrix.bundle }}' bundle WSL2 (NAT)"
working-directory: lima-release
shell: pwsh
run: |
Remove-Item "$env:USERPROFILE\.lima\_config\user*" -Recurse -Force -ErrorAction SilentlyContinue || $true
Remove-Item "$env:USERPROFILE\.lima\_config\wsl2*" -Recurse -Force -ErrorAction SilentlyContinue || $true
$env:PATH = "$env:PROGRAMFILES\QEMU;$env:LOCALAPPDATA\Microsoft\WinGet\Links;$pwd\..\qcw-art\qcw-lima\lima\bin;C:\msys64\usr\bin;" + $env:PATH
$env:MSYS2_ENV_CONV_EXCL = 'HOME_HOST;HOME_GUEST;_LIMA_WINDOWS_EXTRA_PATH'
$env:HOME_ALT = $(cygpath.exe -m "$env:USERPROFILE")
$env:HOME_HOST = $(cygpath.exe "$env:HOME_ALT")
$env:HOME_GUEST = ('wsl' -eq '${{ matrix.bundle }}') ? $(wsl -d lima-infra wslpath "$env:HOME_ALT") : $(cygpath.exe "$env:HOME_ALT")
$env:LIMACTL_CREATE_ARGS = '--vm-type=qemu'
$env:_LIMA_WINDOWS_EXTRA_PATH = "$pwd\..\qcw-art\qcw-go-wsllinks\bundle-${{ matrix.bundle }}"
bash.exe -c "./hack/test-templates.sh templates/default.yaml"
- name: "πŸ§ͺ Test Lima WSL2 machine '${{ matrix.bundle }}' bundle WSL2 (NAT)"
working-directory: lima-release
shell: pwsh
run: |
Remove-Item "$env:USERPROFILE\.lima\_config\user*" -Recurse -Force -ErrorAction SilentlyContinue || $true
Remove-Item "$env:USERPROFILE\.lima\_config\wsl2*" -Recurse -Force -ErrorAction SilentlyContinue || $true
$env:PATH = "$env:LOCALAPPDATA\Microsoft\WinGet\Links;$pwd\..\qcw-art\qcw-lima\lima\bin;C:\msys64\usr\bin;" + $env:PATH
$env:MSYS2_ENV_CONV_EXCL = 'HOME_HOST;HOME_GUEST;_LIMA_WINDOWS_EXTRA_PATH'
$env:HOME_ALT = $(cygpath.exe -m "$env:USERPROFILE")
$env:HOME_HOST = $(cygpath.exe "$env:HOME_ALT")
$env:HOME_GUEST = $(wsl -d lima-infra wslpath "$env:HOME_ALT")
$env:LIMACTL_CREATE_ARGS = '--vm-type=wsl2 --mount-type=wsl2 --containerd=system'
$env:_LIMA_WINDOWS_EXTRA_PATH = "$pwd\..\qcw-art\qcw-go-wsllinks\bundle-${{ matrix.bundle }}"
bash.exe -c './hack/test-templates.sh templates/experimental/wsl2.yaml'