Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,15 @@ jobs:
strategy:
fail-fast: false
matrix:
# TODO See https://github.com/actions/runner-images/issues/13729
runs-on: [windows-latest, windows-11-arm]
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
# TODO See https://github.com/actions/runner-images/issues/13729
- if: matrix.runs-on == 'windows-latest'
run: |
for ($i = 1; $i -le 18; $i++) {
docker info *> $null
if ($LASTEXITCODE -eq 0) { exit 0 }
Start-Sleep -Seconds 10
}
throw 'FAIL the docker daemon never became ready'
# Host Go on windows-11-arm is for compiling moby only
# (install-docker-arm64.ps1); the suite itself runs from the Compose
# runner service with no host Go anywhere.
# TODO For compiling moby only.
# Because https://github.com/actions/runner-images/blob/win11-arm64/20260920.174/images/windows/Windows11-Arm64-Readme.md is still using `Go 1.24.13`.
- if: matrix.runs-on == 'windows-11-arm'
Expand All @@ -58,4 +53,18 @@ jobs:
cache: false
- if: matrix.runs-on == 'windows-11-arm'
run: pwsh -NoProfile -File tests/e2e/windows/install-docker-arm64.ps1
- run: pwsh -NoProfile -File tests/e2e/windows/e2e.ps1
# windows-latest ships Docker Compose; windows-11-arm builds its engine
# from source with no plugin, so pin one explicitly there.
- if: matrix.runs-on == 'windows-11-arm'
name: Install Compose v5.5.1 CLI plugin
run: |
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.docker\cli-plugins" | Out-Null
curl.exe -fsSL --retry 3 --retry-delay 5 --retry-all-errors "https://github.com/docker/compose/releases/download/v5.5.1/docker-compose-windows-aarch64.exe" -o "$env:USERPROFILE\.docker\cli-plugins\docker-compose.exe"
docker compose version
# Both runners drive the daemon from the Compose runner service
# (Dockerfile-runner: servercore plus the pinned Go MSI, built for the
# host arch): no host Go is needed by the suite on any arch. Host Go on
# windows-11-arm exists only to compile moby above.
- run: docker compose -f tests/e2e/windows/compose.yaml run --rm --build e2e
env:
ARCH: ${{ contains(matrix.runs-on, 'arm') && 'arm64' || 'amd64' }}
31 changes: 27 additions & 4 deletions docs/e2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ winget install --id Microsoft.PowerShell --source winget --exact
```powershell
winget install --id Git.Git --source winget --exact

Invoke-WebRequest -UseBasicParsing `
curl.exe -fsSL --retry 3 --retry-delay 5 --retry-all-errors `
"https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" `
-OutFile ./install-docker-ce.ps1
-o ./install-docker-ce.ps1
```

3. Execute in PowerShell 7 with administrator privileges,
Expand All @@ -80,10 +80,26 @@ Invoke-WebRequest -UseBasicParsing `

4. Execute in PowerShell 7,

```powershell
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.docker\cli-plugins" | Out-Null
curl.exe -fsSL --retry 3 --retry-delay 5 --retry-all-errors `
"https://github.com/docker/compose/releases/download/v5.5.1/docker-compose-windows-x86_64.exe" `
-o "$env:USERPROFILE\.docker\cli-plugins\docker-compose.exe"
```

5. Execute in PowerShell 7,

```powershell
git clone git@github.com:version-fox/vfox-flutter.git
cd ./vfox-flutter/
pwsh -NoProfile -File .\tests\e2e\windows\e2e.ps1
docker compose -f tests/e2e/windows/compose.yaml run --rm --build e2e
```

To check the `vfox` x `flavor` x `mirror` matrix expansion without
starting containers, override the service command:

```powershell
docker compose -f tests/e2e/windows/compose.yaml run --rm e2e go test -short ./...
```

### arm64
Expand All @@ -98,9 +114,16 @@ winget install --id Microsoft.PowerShell --source winget --exact

```powershell
winget install --id Git.Git --source winget --exact
# Host Go stays here: building the moby engine from source needs it. The
# suite itself runs from a container (see below), no host Go involved.
winget install --id GoLang.Go --source winget --exact
git clone git@github.com:version-fox/vfox-flutter.git
cd ./vfox-flutter/
pwsh -NoProfile -File .\tests\e2e\windows\install-docker-arm64.ps1
pwsh -NoProfile -File .\tests\e2e\windows\e2e.ps1
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.docker\cli-plugins" | Out-Null
curl.exe -fsSL --retry 3 --retry-delay 5 --retry-all-errors `
"https://github.com/docker/compose/releases/download/v5.5.1/docker-compose-windows-aarch64.exe" `
-o "$env:USERPROFILE\.docker\cli-plugins\docker-compose.exe"
$env:ARCH = 'arm64'
docker compose -f tests/e2e/windows/compose.yaml run --rm --build e2e
```
4 changes: 2 additions & 2 deletions tests/e2e/linux/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
tc "github.com/testcontainers/testcontainers-go"
)

// NOTE: keep in sync with tests/e2e/windows/lib.ps1, which duplicates these
// defaults (Go and PowerShell share no config format). Bump both together.
// NOTE: keep in sync with tests/e2e/windows/setup.go, which duplicates these
// defaults (the two Go modules share no config format). Bump both together.
const (
defaultOfficialVersion = "3.47.4"
defaultOhosVersion = "3.41.10-ohos-1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/linux/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// NOTE: the drift-warning strings asserted here are part of the plugin's
// user-facing contract (see hooks/ lib/). If the Lua side rewords them,
// update this file and tests/e2e/windows/verify.Tests.ps1 together.
// update this file and tests/e2e/windows/verify.go together.

// sdkDir prints the SDK root for the active flutter on PATH
// (was lib.sh sdk_dir).
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/windows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ FROM ${BASE_IMAGE}

SHELL ["powershell", "-NoProfile", "-Command"]

COPY tests/e2e/windows/lib.ps1 C:\lib.ps1
COPY tests/e2e/windows/bootstrap-tools.ps1 C:\bootstrap-tools.ps1
RUN powershell -NoProfile -ExecutionPolicy Bypass -File 'C:\bootstrap-tools.ps1'

Expand All @@ -13,7 +12,8 @@ WORKDIR C:\e2e
COPY metadata.lua C:\e2e\metadata.lua
COPY hooks C:\e2e\hooks
COPY lib C:\e2e\lib
COPY tests/e2e/windows C:\e2e\tests\e2e\windows

ENTRYPOINT ["C:/Program Files/PowerShell/7/pwsh.exe", "-File"]
CMD ["C:/e2e/tests/e2e/windows/run.ps1"]
# Long-lived container: the Go test (e2e_test.go) drives every phase through
# pwsh exec calls, so the main process just idles here.
ENTRYPOINT ["C:/Program Files/PowerShell/7/pwsh.exe", "-NoProfile", "-Command"]
CMD ["while ($true) { Start-Sleep 3600 }"]
26 changes: 26 additions & 0 deletions tests/e2e/windows/Dockerfile-runner
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# escape=`
# Runner image for the Windows container E2E suite: stock servercore plus the
# pinned Go toolchain, so no host Go is needed on any arch. (There is no
# stock golang Windows image for arm64, hence this file instead of pinning
# one.) Built via compose --build (see compose.yaml).
ARG BASE_IMAGE=mcr.microsoft.com/windows/servercore:ltsc2025-KB5122871-amd64
FROM ${BASE_IMAGE}

SHELL ["powershell", "-NoProfile", "-Command"]

ARG GO_VERSION=1.26.8
# NB: no double quotes or backticks below. The classic builder wraps the
# joined lines in powershell -Command "..." through cmd.exe, where both
# break parsing. Single quotes, ${var} braces and array arguments only.
RUN $goArch = if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { 'arm64' } else { 'amd64' }; `
$goMsi = $env:TEMP + '\go.msi'; `
curl.exe -fsSL --retry 3 --retry-delay 5 --retry-all-errors -o $goMsi https://go.dev/dl/go${env:GO_VERSION}.windows-${goArch}.msi; `
$goInstall = Start-Process msiexec.exe -Wait -PassThru -ArgumentList '/i', $goMsi, '/quiet', '/norestart'; `
if ($goInstall.ExitCode -notin 0, 3010, 1937) { throw 'FAIL the Go MSI install exited with code ' + $goInstall.ExitCode }; `
Remove-Item $goMsi; `
New-Item -ItemType Directory -Force -Path 'C:\m', 'C:\b' | Out-Null; `
& 'C:\Program Files\Go\bin\go.exe' version

# Short module/build caches: Windows long paths are off in this image.
ENV GOMODCACHE=C:\m
ENV GOCACHE=C:\b
26 changes: 17 additions & 9 deletions tests/e2e/windows/bootstrap-tools.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
$ErrorActionPreference = 'Stop'
. "$PSScriptRoot\lib.ps1"

# Local copy of the native-command guard (the e2e/lib.ps1 helper is gone;
# the suite is driven from Go now). Fails unless the command exits 0.
function Invoke-Native {
param(
[Parameter(Mandatory)] [scriptblock] $Cmd,
[Parameter(Mandatory)] [string] $What,
[int[]] $Ok = 0
)
$prev = $PSNativeCommandUseErrorActionPreference
$PSNativeCommandUseErrorActionPreference = $false
& $Cmd
$code = $LASTEXITCODE
$PSNativeCommandUseErrorActionPreference = $prev
if ($null -eq $code) { throw "FAIL $What did not run" }
if ($code -notin $Ok) { throw "FAIL $What exited with code $code" }
}

$IsArm64 = $env:PROCESSOR_ARCHITECTURE -eq 'ARM64'
$pwshArch = if ($IsArm64) { 'arm64' } else { 'x64' }
Expand All @@ -20,11 +36,3 @@ if (-not (Test-Path 'C:\Program Files\PowerShell\7\pwsh.exe')) { throw 'FAIL pws
if (-not (Test-Path 'C:\Program Files\Git\cmd\git.exe')) { throw 'FAIL git.exe is missing after the Git installer' }
Invoke-Native { & 'C:\Program Files\Git\cmd\git.exe' config --system core.longpaths true } 'enable system-wide git long paths'
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 -PropertyType DWORD -Force | Out-Null

# Pester 5 runs the *.Tests.ps1 suites (see run.ps1). Pinned, because the
# container image must stay reproducible; run.ps1 only requires v5 or newer.
$PesterVersion = '5.7.1'
$pwsh = 'C:\Program Files\PowerShell\7\pwsh.exe'
Invoke-Native { & $pwsh -NoProfile -Command "Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted'" } 'trust the PSGallery repository'
Invoke-Native { & $pwsh -NoProfile -Command "Install-Module -Name 'Pester' -RequiredVersion '$PesterVersion' -Scope 'AllUsers' -Force -SkipPublisherCheck" } "the Pester $PesterVersion module install"
Invoke-Native { & $pwsh -NoProfile -Command "& { Import-Module 'Pester' -RequiredVersion '$PesterVersion'; (Get-Module 'Pester').Version.ToString() }" } "importing Pester $PesterVersion"
45 changes: 45 additions & 0 deletions tests/e2e/windows/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Host-side runner for the Windows container E2E suite (see docs/e2e.md).
#
# docker compose -f tests/e2e/windows/compose.yaml run --rm --build e2e
#
# The host requirement is Docker plus the Compose v5 plugin (installed once
# per machine, see docs/e2e.md); Go never touches the host, so it cannot
# conflict with a vfox-managed toolchain. The runner image
# (Dockerfile-runner: stock servercore plus the pinned Go MSI) is built for
# the host arch, because there is no stock golang Windows image for arm64.
# It drives the host daemon through the mounted named pipe. Ryuk is disabled
# in code (it has no Windows image); every container is terminated explicitly
# via t.Cleanup instead.
#
# Every knob below forwards only when set in the caller's env; empty means
# "use the built-in default" (see matrix.go).

services:
e2e:
build:
context: ../../..
dockerfile: tests/e2e/windows/Dockerfile-runner
args:
BASE_IMAGE: mcr.microsoft.com/windows/servercore:ltsc2025-KB5122871-${ARCH:-amd64}
image: vfox-flutter/e2e-runner:1.26.8
working_dir: C:/work/tests/e2e/windows
volumes:
- type: npipe
source: \\.\pipe\docker_engine
target: \\.\pipe\docker_engine
- ../../..:C:/work
- e2e-go-modcache:C:/m
environment:
ARCH: ${ARCH:-}
E2E_MAX_JOBS: ${E2E_MAX_JOBS:-}
VFOX_VERSION: ${VFOX_VERSION:-}
FLAVOR: ${FLAVOR:-}
MIRROR: ${MIRROR:-}
FLUTTER_VERSION: ${FLUTTER_VERSION:-}
OHOS_VERSION: ${OHOS_VERSION:-}
VFOX_FLUTTER_GITHUB_MIRROR: ${VFOX_FLUTTER_GITHUB_MIRROR:-}
E2E_RETRY_ATTEMPTS: ${E2E_RETRY_ATTEMPTS:-}
command: ["go", "test", "-v", "-timeout", "55m", "-run", "TestE2E", "./..."]

volumes:
e2e-go-modcache:
99 changes: 0 additions & 99 deletions tests/e2e/windows/e2e.ps1

This file was deleted.

Loading
Loading