Files
flutter-docker-image/test/windows/Windows.Tests.ps1
T
Eligio Mariño 792b91c445 ci: test windows image (#339)
- **`windows.Dockerfile`** — fixes the `COPY` source path from
`./test/Windows.Tests.ps1` to `./test/windows/Windows.Tests.ps1` (root
cause of the 12-month "in_progress forever" state); adds `COPY
./config/version.json` to the `test` stage; replaces the commented `CMD`
with a real `CMD` so `docker run`/`docker compose run` invokes Pester
without arguments.
- **`test/windows/Windows.Tests.ps1`** — fixes the `VC.CMake.Project`
pattern typo (`,versiona*` → `,version=*`) and standardises all three
VS-component patterns to `,version=*`; adds a `Flutter version` test
that reads `config/version.json` and asserts `flutter --version` inside
the container reports the same version; adds a `Flutter doctor` test
with a per-line parser (skip disabled platforms, fail on any non-`[✓]`
for Windows toolchain lines, fail on `[✗]` elsewhere).
- **`script/RunPester.ps1`** — forces `[Console]::OutputEncoding = UTF8`
so the `[✓]`/`[!]`/`[✗]` doctor glyphs survive the `windows-2025`
runner's default OEM codepage.
- **`test/windows/`** — deletes the dead `ory/dockertest` Go skeleton
(`main.go`, `main_test.go`, `go.mod`, `go.sum`) that was never wired
into CI and had its only meaningful assertion commented out.
- **`.github/workflows/windows.yml`** — deletes three commented-out
blocks (`Scan with Docker Scout`, `Push to Docker Hub`,
`validate_version` job referencing the deleted `config/version.cue`);
drops the now-unused elevated permissions (`packages: write`,
`pull-requests: write`, `security-events: write`).

---------

Co-authored-by: verified-commit[bot] <180343340+verified-commit[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 16:15:33 +02:00

83 lines
3.5 KiB
PowerShell

Describe "Flutter version" {
It "Should match the version in config/version.json" {
$manifest = Get-Content "config\version.json" | ConvertFrom-Json
$expectedVersion = $manifest.flutter.version
$firstLine = flutter --version 2>&1 | Select-Object -First 1
$firstLine -match 'Flutter (\S+)' | Out-Null
$actualVersion = $Matches[1]
$actualVersion | Should -Be $expectedVersion -Because "flutter --version reported '$actualVersion' but config/version.json specifies '$expectedVersion'"
}
}
Describe "Flutter doctor" {
BeforeAll {
# Flutter doctor on Windows uses U+221A (SQUARE ROOT) for pass and ASCII X for fail.
# On other platforms it uses U+2713/U+2717. Keep this source pure ASCII so Windows
# PowerShell 5.x does not choke on the file encoding.
$script:passMarkers = @([char]0x221A, [char]0x2713, [char]0x2714)
$script:failMarkers = @('X', 'x', [char]0x2717, [char]0x2718)
$script:doctorOutput = flutter doctor 2>&1
}
It "Should report a healthy Windows toolchain with no unexpected errors" {
$skippedPlatforms = @('Android', 'iOS', 'macOS', 'Linux', 'Web', 'Chrome')
$failures = @()
$expectedMark = "[" + [char]0x221A + "]"
foreach ($line in $script:doctorOutput) {
if ($line -match '^\[(.)\] (.+)$') {
$marker = $Matches[1]
$header = $Matches[2]
$skip = $false
foreach ($platform in $skippedPlatforms) {
if ($header -like "$platform*") { $skip = $true; break }
}
if ($skip) { continue }
$isPass = $script:passMarkers -contains $marker
$isFail = $script:failMarkers -contains $marker
if ($header -like 'Windows Version*' -or $header -like 'Visual Studio*') {
if (-not $isPass) {
$failures += "[$marker] $header (expected $expectedMark)"
}
} elseif ($isFail) {
$failures += "[$marker] $header"
}
}
}
$failures | Should -BeNullOrEmpty -Because ($failures -join '; ')
}
}
Describe "Windows file structure tests" {
It "Should have specific file content in dart telemetry config" {
"$env:APPDATA\.dart-tool\dart-flutter-telemetry.config" | Should -FileContentMatchExactly "reporting=0"
}
Context "VisualStudio components" {
BeforeAll {
$visualStudioPackages = (Get-ChildItem $env:ProgramData\Microsoft\VisualStudio\Packages).Name
}
It "CMake version matches" {
$directoryName = $visualStudioPackages | Select-String -CaseSensitive Microsoft.VisualStudio.Component.VC.CMake.Project
$directoryName | Should -BeLikeExactly "Microsoft.VisualStudio.Component.VC.CMake.Project,version=*"
}
It "Windows11SDK version matches" {
$directoryName = $visualStudioPackages | Select-String -CaseSensitive Microsoft.VisualStudio.Component.Windows11SDK
$directoryName | Should -BeLikeExactly "Microsoft.VisualStudio.Component.Windows11SDK.22621,version=*"
}
It "VCTools version matches" {
$directoryName = $visualStudioPackages | Select-String -CaseSensitive Microsoft.VisualStudio.Workload.VCTools
$directoryName | Should -BeLikeExactly "Microsoft.VisualStudio.Workload.VCTools,version=*"
}
}
}