Skip to content

Commit 6045f05

Browse files
feat(ci): support running e2e tests on windows
Signed-off-by: Swapnanil-Gupta <swpnlg@amazon.com>
1 parent d9898a5 commit 6045f05

10 files changed

Lines changed: 130 additions & 20 deletions

File tree

.github/workflows/macos-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
- deps/full-os.conf
1717
- deps/lima-bundles.conf
1818
- e2e/**
19-
- lima-template/**
19+
- lima-template/macos.yaml
2020
- Makefile
2121
- Makefile.darwin
2222
workflow_dispatch:

.github/workflows/windows-ci.yaml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,31 @@ on:
1414
- .gitmodules
1515
- deps/container-runtime-full-archive.conf
1616
- deps/rootfs.conf
17-
- lima-template/**
17+
- e2e/**
18+
- lima-template/windows.yaml
1819
- Makefile
1920
- Makefile.windows
2021
workflow_dispatch:
2122

23+
permissions:
24+
contents: read
25+
2226
concurrency:
2327
group: ${{ github.workflow }}-${{ github.ref }}
2428
cancel-in-progress: true
2529

2630
jobs:
27-
install-dependencies:
28-
# This is a spot check for make install.dependencies on Windows platform.
29-
# Finch-core provides the core dependencies needed to run Finch such as the base OS
30-
# image, rootfs, and Lima bundle. Validate the mechanism used to install the core
31-
# dependencies works on Windows.
31+
e2e-tests:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
os: [windows-2022]
35+
os: [windows-2025]
3636
runs-on: ${{ matrix.os }}
3737
steps:
38+
- name: Configure git CRLF settings
39+
run: |
40+
git config --global core.autocrlf false
41+
git config --global core.eol lf
3842
- name: Checkout code
3943
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4044
with:
@@ -46,7 +50,17 @@ jobs:
4650
with:
4751
go-version-file: e2e/go.mod
4852
cache-dependency-path: e2e/go.sum
53+
- name: Enable WSL2
54+
uses: Vampire/setup-wsl@v7
55+
- name: Configure WSL2 networking
56+
shell: pwsh
57+
run: |
58+
"networkingMode=mirrored`nhostAddressLoopback=true" | Out-File -FilePath "$env:USERPROFILE\.wslconfig" -Encoding ascii
59+
wsl --shutdown
4960
- name: Install platform dependencies
5061
run: make install.dependencies
62+
- name: Run e2e tests
63+
run: make test-e2e
5164
- name: Clean up dependencies
65+
if: always()
5266
run: make clean

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ $(FINCH_DAEMON_OUTDIR)/finch-daemon: $(OUTPUT_DIRECTORIES)
5757
install: uninstall
5858
mkdir -p $(DEST)
5959
(cd _output && tar c * | tar Cvx $(DEST) )
60-
sed -i.bak -e "s|${FINCH_OS_IMAGE_LOCATION}|$(FINCH_IMAGE_LOCATION)|g" $(DEST)/lima-template/fedora.yaml
60+
sed -i.bak -e "s|${FINCH_OS_IMAGE_LOCATION}|$(FINCH_IMAGE_LOCATION)|g" $(DEST)/lima-template/macos.yaml
6161
rm $(DEST)/lima-template/*.yaml.bak
6262

6363
.PHONY: uninstall
@@ -76,5 +76,8 @@ clean:
7676
-@cd src/socket_vmnet && make clean 2>/dev/null || true
7777

7878
.PHONY: test-e2e
79-
test-e2e: $(LIMA_TEMPLATE_OUTDIR)/fedora.yaml
80-
cd e2e && VM_TYPE=$(FINCH_VM_TYPE) go test -timeout 30m -v ./... -ginkgo.v
79+
test-e2e: $(LIMA_TEMPLATE)
80+
cd e2e && VM_TYPE=$(FINCH_VM_TYPE) LIMA_TEMPLATE=$(LIMA_TEMPLATE) \
81+
go test -timeout 3h -v ./... \
82+
-ginkgo.vv \
83+
-ginkgo.flake-attempts=3

Makefile.darwin

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
OS_OUTDIR := $(OUTDIR)/os
55
LIMA_TEMPLATE_OUTDIR := $(OUTDIR)/lima-template
6+
LIMA_TEMPLATE := $(LIMA_TEMPLATE_OUTDIR)/macos.yaml
67
CRED_HELPERS_OUTDIR := $(OUTDIR)/cred-helpers
78
OUTPUT_DIRECTORIES += $(OS_OUTDIR) $(LIMA_TEMPLATE_OUTDIR) $(CRED_HELPERS_OUTDIR)
89
SOCKET_VMNET_TEMP_PREFIX ?= $(OUTDIR)/dependencies/lima-socket_vmnet/opt/finch
@@ -61,8 +62,8 @@ install.lima-socket-vmnet:
6162
cd src/socket_vmnet && git clean -f -d
6263
cd src/socket_vmnet && PREFIX=$(SOCKET_VMNET_TEMP_PREFIX) "$(MAKE)" install.bin
6364

64-
$(LIMA_TEMPLATE_OUTDIR)/fedora.yaml: $(LIMA_TEMPLATE_OUTDIR)
65-
cp lima-template/fedora.yaml $@.template
65+
$(LIMA_TEMPLATE_OUTDIR)/macos.yaml: $(LIMA_TEMPLATE_OUTDIR)
66+
cp lima-template/macos.yaml $@.template
6667
# using -i.bak is very intentional, it allows the following commands to succeed for both GNU / BSD sed
6768
# this sed command uses the alternative separator of "|" because the image location uses "/"
6869
sed -i.bak -e "s|<image_location>|$(FINCH_IMAGE_LOCATION)|g" $@.template

Makefile.windows

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,34 @@
33

44
# TODO: Use Finch rootfs in Finch on Windows testing
55
ROOTFS_OUTPUT_DIR := $(OUTDIR)/os
6+
LIMA_TEMPLATE_OUTDIR := $(OUTDIR)/lima-template
7+
LIMA_TEMPLATE := $(LIMA_TEMPLATE_OUTDIR)/windows.yaml
68
CRED_HELPERS_OUTDIR := $(OUTDIR)/cred-helpers
7-
OUTPUT_DIRECTORIES += $(ROOTFS_OUTPUT_DIR) $(CRED_HELPERS_OUTDIR)
9+
OUTPUT_DIRECTORIES += $(ROOTFS_OUTPUT_DIR) $(LIMA_TEMPLATE_OUTDIR) $(CRED_HELPERS_OUTDIR)
810

911
include $(CURDIR)/deps/rootfs.conf
1012
ifeq ($(ARCH), x86_64)
1113
FINCH_ROOTFS_BASENAME := $(X86_64_ARTIFACT)
1214
FINCH_ROOTFS_DIGEST := $(X86_64_512_DIGEST)
15+
LIMA_ARCH = x86_64
1316
else
1417
$(error Finch on Windows ARM not supported)
1518
endif
1619

20+
# WSL2 imports the locally downloaded rootfs tarball rather than booting a disk image.
21+
FINCH_IMAGE_LOCATION ?= $(ROOTFS_OUTPUT_DIR)/$(FINCH_ROOTFS_BASENAME)
22+
FINCH_IMAGE_DIGEST ?= "sha512:$(FINCH_ROOTFS_DIGEST)"
23+
24+
# rootfs.conf sets X86_64_ARTIFACT_PATHING for the rootfs download; clear it so it
25+
# does not leak into the container-runtime artifact URL below.
26+
X86_64_ARTIFACT_PATHING :=
27+
include $(CURDIR)/deps/container-runtime-full-archive.conf
28+
ifneq ($(X86_64_ARTIFACT_PATHING),)
29+
X86_64_ARTIFACT := "$(X86_64_ARTIFACT_PATHING)/$(X86_64_ARTIFACT)"
30+
endif
31+
CONTAINER_RUNTIME_ARCHIVE_X86_64_LOCATION ?= "$(ARTIFACT_BASE_URL)/$(X86_64_ARTIFACT)"
32+
CONTAINER_RUNTIME_ARCHIVE_X86_64_DIGEST ?= "sha256:$(X86_64_256_DIGEST)"
33+
1734
# WSL2 is the only virtual machine type supported for Finch on Windows
1835
FINCH_VM_TYPE := wsl2
1936

@@ -22,14 +39,32 @@ WINGIT_x86_URL := $(or $(WINGIT_x86_URL),https://github.com/git-for-windows/git/
2239
WINGIT_x86_BASENAME ?= $(notdir $(WINGIT_x86_URL))
2340
WINGIT_x86_HASH := $(or $(WINGIT_x86_HASH),"sha512:795a2e7e0be5ab78f2d28d0bd971961d121b9c808a95dec795343dc5af943574dcf54f63a8580c5a5102075abdae387d7a67135c165821428afc07f11ef7543d")
2441

25-
install.dependencies: install.rootfs install.lima install.docker-credhelper
42+
install.dependencies: install.rootfs install.lima install.lima-template install.docker-credhelper
2643

2744
.PHONY: install.rootfs
2845
install.rootfs: $(ROOTFS_OUTPUT_DIR)/$(FINCH_ROOTFS_BASENAME)
2946

3047
$(ROOTFS_OUTPUT_DIR)/$(FINCH_ROOTFS_BASENAME): $(ROOTFS_OUTPUT_DIR) $(CURDIR)/deps/rootfs.conf
3148
bash deps/install.sh --arch $(ARCH) --output $@ $(CURDIR)/deps/rootfs.conf
3249

50+
.PHONY: install.lima-template
51+
install.lima-template: $(LIMA_TEMPLATE)
52+
53+
$(LIMA_TEMPLATE): $(LIMA_TEMPLATE_OUTDIR)
54+
cp lima-template/windows.yaml $@.template
55+
# using -i.bak is very intentional, it allows the following commands to succeed for both GNU / BSD sed
56+
# this sed command uses the alternative separator of "|" because the image location uses "/"
57+
sed -i.bak -e "s|<image_location>|$(FINCH_IMAGE_LOCATION)|g" $@.template
58+
sed -i.bak -e "s/<image_arch>/$(LIMA_ARCH)/g" $@.template
59+
sed -i.bak -e "s/<image_digest>/$(FINCH_IMAGE_DIGEST)/g" $@.template
60+
sed -i.bak -e "s|<container_runtime_archive_x86_64_location>|$(CONTAINER_RUNTIME_ARCHIVE_X86_64_LOCATION)|g" $@.template
61+
sed -i.bak -e "s/<container_runtime_archive_x86_64_digest>/$(CONTAINER_RUNTIME_ARCHIVE_X86_64_DIGEST)/g" $@.template
62+
63+
# Replace was successful, so cleanup .bak files
64+
rm $(LIMA_TEMPLATE_OUTDIR)/*.yaml.template.bak
65+
66+
mv $@.template $@
67+
3368
.PHONY: install.lima
3469
install.lima: lima-exe install.lima-dependencies-wsl2
3570

e2e/e2e_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package e2e
66
import (
77
"os"
88
"path/filepath"
9+
"runtime"
910
"testing"
1011

1112
"github.com/onsi/ginkgo/v2"
@@ -38,19 +39,28 @@ func TestE2e(t *testing.T) {
3839
t.Fatalf("failed to get the current working directory: %v", err)
3940
}
4041

41-
vmConfigFile := filepath.Join(wd, "./../_output/lima-template/fedora.yaml")
42+
configFileName := "macos.yaml"
43+
if runtime.GOOS == "windows" {
44+
configFileName = "windows.yaml"
45+
}
46+
vmConfigFile := filepath.Join(wd, "./../_output/lima-template/", configFileName)
4247

4348
subject := "limactl"
4449
limaOpt, err := option.New([]string{subject})
4550
if err != nil {
4651
t.Fatalf("failed to initialize a testing option: %v", err)
4752
}
4853

49-
vmName := "fedora"
54+
vmName := "finch"
55+
56+
nerdctlMods := []option.Modifier{option.WithNoEnvironmentVariablePassthrough()}
57+
if runtime.GOOS == "windows" {
58+
nerdctlMods = append(nerdctlMods, option.WithWindowsHostPathTranslation())
59+
}
5060

5161
nerdctlOpt, err := option.New(
5262
[]string{subject, "shell", vmName, "sudo", "-E", "nerdctl"},
53-
option.WithNoEnvironmentVariablePassthrough(),
63+
nerdctlMods...,
5464
)
5565
if err != nil {
5666
t.Fatalf("failed to initialize a testing option: %v", err)

e2e/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ require (
2222
golang.org/x/text v0.38.0 // indirect
2323
golang.org/x/tools v0.45.0 // indirect
2424
)
25+
26+
// TODO: revert
27+
replace github.com/runfinch/common-tests => github.com/Swapnanil-Gupta/common-tests v0.0.0-20260702223436-6b3984e1a3e8

e2e/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
22
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
3+
github.com/Swapnanil-Gupta/common-tests v0.0.0-20260702223436-6b3984e1a3e8 h1:ulNCk+7/Bf1Yi2OzPlF8qxkn8q6oCeHvJQrvB89cnsg=
4+
github.com/Swapnanil-Gupta/common-tests v0.0.0-20260702223436-6b3984e1a3e8/go.mod h1:mOOz4glmJ0uVwjgPEXKZPgHG8BzS2KCuE+XWV0Zg4hk=
35
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
46
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
57
github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs=
@@ -36,8 +38,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
3638
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
3739
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
3840
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
39-
github.com/runfinch/common-tests v0.10.1 h1:noZ9LbolXMLTZgXllAJtNkyO6JQrrnf1mpvN1zknU40=
40-
github.com/runfinch/common-tests v0.10.1/go.mod h1:PX9VBgtcOm+2Stjm4F6Y6KpovJ2emdSJ+y1X1URnAIU=
4141
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
4242
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
4343
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=

lima-template/windows.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This template file is based on macos.yaml but with Windows specific options.
5+
vmType: wsl2
6+
mountType: wsl2
7+
8+
images:
9+
- location: "<image_location>"
10+
arch: "<image_arch>"
11+
digest: "<image_digest>"
12+
13+
containerd:
14+
system: true
15+
user: false
16+
archives:
17+
- location: "<container_runtime_archive_x86_64_location>"
18+
arch: "x86_64"
19+
digest: "<container_runtime_archive_x86_64_digest>"
20+
21+
provision:
22+
- mode: boot
23+
script: |
24+
systemctl stop NetworkManager-wait-online.service
25+
systemctl reset-failed NetworkManager-wait-online.service
26+
systemctl mask NetworkManager-wait-online.service
27+
- mode: boot
28+
script: |
29+
modprobe virtiofs
30+
- mode: boot
31+
script: |
32+
modprobe br_netfilter
33+
cat <<EOF > /etc/sysctl.d/99-finch.conf
34+
net.bridge.bridge-nf-call-iptables = 1
35+
net.bridge.bridge-nf-call-ip6tables = 1
36+
net.ipv4.ip_forward = 1
37+
EOF
38+
sysctl --system
39+
# # `user` is executed without the root privilege
40+
- mode: user
41+
script: |
42+
#!/bin/bash
43+
sudo systemctl add-requires buildkit.service containerd.service
44+
sudo systemctl restart containerd.service

0 commit comments

Comments
 (0)