Skip to content

Add Windows CI with end-to-end tests - #8

Merged
VouDoo merged 4 commits into
mainfrom
ci/windows
Nov 20, 2026
Merged

VouDoo merged 4 commits into
mainfrom
ci/windows

Conversation

@VouDoo

@VouDoo VouDoo commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Test the module on real Windows machines with GitHub Actions, on every PR and push to main.

Jobs

Job Runner What it runs
Test (Windows PowerShell 5.1) windows-latest .\build.ps1 -Bootstrap Test (Analyze + Pester), then the end-to-end tests
Test (PowerShell 7) windows-latest Same
ARM64 download (PowerShell 7) windows-11-arm Build, then download Java 21 and check it is an ARM64 build

End-to-end tests

Tests/EndToEnd/Invoke-EndToEndTest.ps1 runs the built module for real:

  • Invoke-DownloadJavaPackage -Version 21 and without -Version (latest LTS by default): download, checksum, extraction, inventory entry, x64 build
  • Add-JavaEntry with a relative path after Push-Location
  • Switch-JavaVersion -WhatIf leaves JAVA_HOME and the session Path unchanged
  • Switch-JavaVersion in User scope (twice): User JAVA_HOME, %JAVA_HOME%\bin in the User Path registry value (added once), new bin first in the session Path, previous one removed, session-only entries kept, java -version
  • Switch-JavaVersion -Target Process
  • Remove-JavaEntry -RemoveDirectory: refused for the current JAVA_HOME, directory kept when shared, removed otherwise
  • Removing the last entry, then adding one again (the [null] inventory bug on 5.1)
  • Switch-JavaVersion -Target Machine: Machine JAVA_HOME and Path, and no Environment\Path registry subkey (the Machine registry bug)

The script changes the system, so it refuses to run outside GitHub Actions unless -Force is given. It is not a *.Tests.ps1 file, so the local Pester task does not run it.

Not covered: the interactive menu (no console on CI runners).

Also adds a CI badge to the README.

Testing

CI run on this PR, all green:

Job Pester End-to-end
Windows PowerShell 5.1 33/33 39/39
PowerShell 7 (x64) 33/33 39/39
ARM64 (PowerShell 7) — ARM64 build downloaded, java -version runs

The first run found two Inventory tests that were too strict on Windows PowerShell 5.1: ConvertTo-Json @() writes an empty array with a blank line inside, not [] (still valid JSON, read back correctly). Fixed by ignoring whitespace in those checks. No module code changed.

Locally: the script refuses to run outside CI, and the Pester task still runs only the 33 unit tests.

@VouDoo
VouDoo merged commit d2f4dfa into main Nov 20, 2026
3 checks passed
@VouDoo
VouDoo deleted the ci/windows branch November 20, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant