Skip to content

Commit 56cb970

Browse files
committed
Add E2E for Ubuntu 26.04.1 and Windows Server 2025
1 parent 7328f4b commit 56cb970

9 files changed

Lines changed: 230 additions & 8 deletions

File tree

‎.dockerignore‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.git
2+
.gitignore
3+
.idea
4+
.github
5+
*.md
6+
LICENSE
7+
.tool-versions
8+
Injection.lua

‎.github/workflows/e2e.yml‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: E2E
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: e2e-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
e2e-linux:
17+
if: github.repository == 'version-fox/vfox-flutter'
18+
name: Linux container
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 60
21+
steps:
22+
- uses: actions/checkout@v7
23+
with:
24+
persist-credentials: false
25+
- run: docker build --pull -f tests/e2e/Dockerfile -t vfox-flutter-e2e .
26+
- run: docker run --rm -e VFOX_VERSION=latest vfox-flutter-e2e
27+
- run: docker run --rm -e VFOX_VERSION=main vfox-flutter-e2e
28+
29+
e2e-windows:
30+
if: github.repository == 'version-fox/vfox-flutter'
31+
name: Windows container
32+
runs-on: windows-latest
33+
timeout-minutes: 90
34+
steps:
35+
- uses: actions/checkout@v7
36+
with:
37+
persist-credentials: false
38+
- run: docker build --pull -f tests/e2e/Dockerfile.windows -t vfox-flutter-e2e .
39+
- run: docker run --rm -e VFOX_VERSION=latest vfox-flutter-e2e
40+
- run: docker run --rm -e VFOX_VERSION=main vfox-flutter-e2e

‎README.md‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ https://github.com/version-fox/vfox-dart .
1919

2020
```bash
2121
vfox add flutter
22-
vfox install flutter@3.44.0
22+
vfox install flutter@3.47.4
2323
sudo apt install --assume-yes curl git unzip xz-utils zip libglu1-mesa
24-
vfox use --global flutter@3.44.0
24+
vfox use --global flutter@3.47.4
2525
```
2626

2727
You can verify this using the following command:
@@ -33,19 +33,19 @@ flutter --version --no-version-check
3333

3434
## Architecture selection
3535

36-
Available releases include architecture suffixes such as `3.44.0-arm64` and
37-
`3.44.0-x64`. You can install both builds and switch between them:
36+
Available releases include architecture suffixes such as `3.47.4-arm64` and
37+
`3.47.4-x64`. You can install both builds and switch between them:
3838

3939
```bash
40-
vfox install flutter@3.44.0-arm64
41-
vfox install flutter@3.44.0-x64
42-
vfox use --global flutter@3.44.0-x64
40+
vfox install flutter@3.47.4-arm64
41+
vfox install flutter@3.47.4-x64
42+
vfox use --global flutter@3.47.4-x64
4343
```
4444

4545
On Apple Silicon, running an x64 build requires Rosetta. Only architectures
4646
provided by Flutter for the current operating system are listed.
4747

48-
Commands without an architecture, such as `vfox install flutter@3.44.0` or
48+
Commands without an architecture, such as `vfox install flutter@3.47.4` or
4949
`vfox install flutter@stable`, continue to select the host architecture and keep
5050
their existing version names. Channels also accept a suffix, such as
5151
`vfox install flutter@stable-x64`. The version list shows the default architecture
@@ -70,6 +70,10 @@ Common mirror values:
7070

7171
For an up-to-date list of available mirrors, refer to the MirrorZ Help site: https://help.mirrors.cernet.edu.cn/flutter/ .
7272

73+
## Testing
74+
75+
See [docs/e2e.md](docs/e2e.md).
76+
7377
## Releasing this plugin
7478

7579
Maintainers can publish from **Actions → Plugin → Run workflow** on the default

‎docs/e2e.md‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# E2E
2+
3+
Offline Lua hook tests (`tests/hooks_test.lua`) run via the **Test Plugin** workflow. A
4+
containerized end-to-end suite exercises the plugin against real vfox (`latest` +
5+
`main`) on Linux and Windows.
6+
7+
## Running on Ubuntu 26.04
8+
9+
Assume that the rootful Docker Engine is already installed.
10+
11+
Execute in Bash,
12+
13+
```bash
14+
git clone git@github.com:version-fox/vfox-flutter.git
15+
cd ./vfox-flutter/
16+
docker build -f tests/e2e/Dockerfile -t vfox-flutter-e2e:linux .
17+
docker run --rm -e VFOX_VERSION=main vfox-flutter-e2e:linux
18+
```
19+
20+
## Running on Windows 11 Pro
21+
22+
Assume Git for Windows and PowerShell 7 are already installed.
23+
24+
1. Execute in PowerShell 7,
25+
26+
```powershell
27+
Invoke-WebRequest -UseBasicParsing `
28+
"https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" `
29+
-OutFile ./install-docker-ce.ps1
30+
```
31+
32+
2. Execute in PowerShell 7 with administrator privileges,
33+
34+
```powershell
35+
./install-docker-ce.ps1
36+
```
37+
38+
3. Execute in PowerShell 7,
39+
40+
```powershell
41+
git clone git@github.com:version-fox/vfox-flutter.git
42+
cd ./vfox-flutter/
43+
docker build -f tests/e2e/Dockerfile.windows -t vfox-flutter-e2e:windows .
44+
docker run --rm -e VFOX_VERSION=main vfox-flutter-e2e:windows
45+
```

‎tests/e2e/Dockerfile‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM ubuntu:26.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
RUN <<EOF
6+
set -eux
7+
apt-get update
8+
apt-get install --assume-yes \
9+
curl \
10+
git \
11+
golang \
12+
libglu1-mesa \
13+
unzip \
14+
zip
15+
EOF
16+
17+
COPY metadata.lua /e2e/metadata.lua
18+
COPY hooks /e2e/hooks
19+
COPY lib /e2e/lib
20+
COPY tests/e2e /e2e/tests/e2e
21+
22+
ENTRYPOINT ["bash", "/e2e/tests/e2e/run.sh"]

‎tests/e2e/Dockerfile.windows‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# escape=`
2+
FROM mcr.microsoft.com/windows/servercore:ltsc2025-KB5122871
3+
4+
SHELL ["powershell", "-NoProfile", "-Command"]
5+
6+
COPY tests/e2e/bootstrap-tools.ps1 C:\bootstrap-tools.ps1
7+
RUN powershell -NoProfile -ExecutionPolicy Bypass -File 'C:\bootstrap-tools.ps1'
8+
9+
WORKDIR C:\e2e
10+
11+
COPY metadata.lua C:\e2e\metadata.lua
12+
COPY hooks C:\e2e\hooks
13+
COPY lib C:\e2e\lib
14+
COPY tests/e2e C:\e2e\tests\e2e
15+
16+
ENTRYPOINT ["C:/Program Files/PowerShell/7/pwsh.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "C:/e2e/tests/e2e/run.ps1"]

‎tests/e2e/bootstrap-tools.ps1‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$msi = "$env:TEMP\pwsh.msi"
4+
& curl.exe -fsSL -o $msi 'https://github.com/PowerShell/PowerShell/releases/download/v7.6.6/PowerShell-7.6.6-win-x64.msi'
5+
& msiexec.exe /i $msi /quiet /norestart
6+
if ($LASTEXITCODE -notin 0, 3010) { throw "PowerShell MSI install failed (exit $LASTEXITCODE)" }
7+
8+
$git = "$env:TEMP\git-installer.exe"
9+
& curl.exe -fsSL -o $git 'https://github.com/git-for-windows/git/releases/download/v2.55.0.windows.5/Git-2.55.0.5-64-bit.exe'
10+
Start-Process $git -Wait -ArgumentList '/VERYSILENT', '/NORESTART', '/SP-', '/SUPPRESSMSGBOXES'

‎tests/e2e/run.ps1‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
$ErrorActionPreference = 'Stop'
2+
$PSNativeCommandUseErrorActionPreference = $true
3+
4+
$VfoxVersion = if ($env:VFOX_VERSION) { $env:VFOX_VERSION } else { 'latest' }
5+
6+
$RepoRoot = (Resolve-Path "$PSScriptRoot\..\..").Path
7+
$WorkDir = "$env:TEMP\vfox-flutter-e2e"
8+
New-Item -ItemType Directory -Force -Path $WorkDir | Out-Null
9+
$VfoxExe = "$WorkDir\vfox.exe"
10+
$PluginZip = "$WorkDir\flutter.zip"
11+
$env:PATH = "$WorkDir;$env:PATH"
12+
13+
function Install-VfoxRelease {
14+
$tag = ((& curl.exe -fsSLI -o NUL -w '%{url_effective}' 'https://github.com/version-fox/vfox/releases/latest') -split '/tag/')[-1].Trim()
15+
$zip = "$WorkDir\vfox.zip"
16+
& curl.exe -fsSL -o $zip "https://github.com/version-fox/vfox/releases/download/$tag/vfox_$($tag.TrimStart('v'))_windows_x86_64.zip"
17+
tar -xf $zip -C $WorkDir
18+
Remove-Item $zip
19+
Copy-Item -Path (Get-ChildItem -Path $WorkDir -Recurse -Filter 'vfox.exe') -Destination $VfoxExe
20+
}
21+
22+
function Install-VfoxMain {
23+
$goMsi = "$env:TEMP\go.msi"
24+
& curl.exe -fsSL -o $goMsi 'https://go.dev/dl/go1.27.1.windows-amd64.msi'
25+
Start-Process msiexec.exe -Wait -ArgumentList '/i', "`"$goMsi`"", '/quiet', '/norestart'
26+
Remove-Item $goMsi
27+
$env:PATH = "$WorkDir;" + [Environment]::GetEnvironmentVariable('Path', 'Machine')
28+
$src = "$WorkDir\vfox-src"
29+
git clone --depth 1 https://github.com/version-fox/vfox $src
30+
Push-Location $src
31+
try { go build -trimpath -o $VfoxExe . } finally { Pop-Location }
32+
}
33+
34+
if ($VfoxVersion -eq 'main') { Install-VfoxMain } else { Install-VfoxRelease }
35+
36+
tar -a -cf $PluginZip -C $RepoRoot metadata.lua hooks lib
37+
38+
$Pwsh = 'C:\Program Files\PowerShell\7\pwsh.exe'
39+
if (-not (Test-Path $PROFILE)) { New-Item -ItemType File -Path $PROFILE -Force | Out-Null }
40+
Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"'
41+
42+
$setup = @'
43+
$ErrorActionPreference = 'Stop'
44+
$PSNativeCommandUseErrorActionPreference = $true
45+
vfox add flutter --source '{0}'
46+
vfox install flutter@3.47.4
47+
vfox use --global flutter@3.47.4
48+
. $PROFILE
49+
dart --version
50+
flutter --version --no-version-check
51+
'@
52+
& $Pwsh -NoLogo -Command ($setup -f $PluginZip)

‎tests/e2e/run.sh‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
4+
VFOX_VERSION="${VFOX_VERSION:-latest}"
5+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
6+
WORK="$(mktemp -d)"
7+
8+
if [ "$VFOX_VERSION" = main ]; then
9+
git clone --depth 1 https://github.com/version-fox/vfox "$WORK/src"
10+
(cd "$WORK/src" && go build -trimpath -o /usr/local/bin/vfox .)
11+
else
12+
curl -sSL https://raw.githubusercontent.com/version-fox/vfox/main/install.sh | bash
13+
fi
14+
15+
(cd "$REPO_ROOT" && zip -qr "$WORK/flutter.zip" metadata.lua hooks lib)
16+
17+
echo 'eval "$(vfox activate bash)"' >> ~/.bashrc
18+
bash -ic "
19+
vfox add flutter --source '$WORK/flutter.zip' &&
20+
vfox install flutter@3.47.4 &&
21+
vfox use --global flutter@3.47.4 &&
22+
source ~/.bashrc &&
23+
dart --version &&
24+
flutter --version --no-version-check
25+
"

0 commit comments

Comments
 (0)