Repository navigation
Add Windows CI with end-to-end tests - #8
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test the module on real Windows machines with GitHub Actions, on every PR and push to
main.Jobs
windows-latest.\build.ps1 -Bootstrap Test(Analyze + Pester), then the end-to-end testswindows-latestwindows-11-armEnd-to-end tests
Tests/EndToEnd/Invoke-EndToEndTest.ps1runs the built module for real:Invoke-DownloadJavaPackage -Version 21and without-Version(latest LTS by default): download, checksum, extraction, inventory entry, x64 buildAdd-JavaEntrywith a relative path afterPush-LocationSwitch-JavaVersion -WhatIfleavesJAVA_HOMEand the session Path unchangedSwitch-JavaVersionin User scope (twice): UserJAVA_HOME,%JAVA_HOME%\binin the User Path registry value (added once), newbinfirst in the session Path, previous one removed, session-only entries kept,java -versionSwitch-JavaVersion -Target ProcessRemove-JavaEntry -RemoveDirectory: refused for the currentJAVA_HOME, directory kept when shared, removed otherwise[null]inventory bug on 5.1)Switch-JavaVersion -Target Machine: MachineJAVA_HOMEand Path, and noEnvironment\Pathregistry subkey (the Machine registry bug)The script changes the system, so it refuses to run outside GitHub Actions unless
-Forceis given. It is not a*.Tests.ps1file, so the localPestertask 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:
java -versionrunsThe 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
Pestertask still runs only the 33 unit tests.