ci: install zsh so the zsh completion tests run instead of skipping (#84)

ZshCompletionTest sources the completion script in a real zsh and skips
where zsh is missing, which the runner image is. CI now installs zsh
and sets FLOCI_TEST_REQUIRE_ZSH, which turns that skip into a failure
so a missing zsh cannot pass unnoticed.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-11-18 23:14:51 -06:00
1 parent 73d13b520e
commit e29f95b6a7
2 files changed
+14 -1

No files matched your search

+8
View File
@@ -36,7 +36,15 @@ jobs:
distribution: 'temurin'
cache: maven
# ZshCompletionTest sources the completion script in a real zsh, which the runner image does
# not ship. FLOCI_TEST_REQUIRE_ZSH turns its skip into a failure, so a missing zsh cannot
# pass silently.
- name: Install zsh
run: sudo apt-get update -q && sudo apt-get install -y -q zsh
- name: Run unit tests
env:
FLOCI_TEST_REQUIRE_ZSH: 'true'
run: mvn test -B
native-linux-arm64:
@@ -81,7 +81,12 @@ class ZshCompletionTest {
@ValueSource(strings = {"unsetopt", "setopt"})
@DisabledOnOs(OS.WINDOWS)
void sourcingItLeavesTheShellAsItWas(String completeAliases) throws Exception {
assumeTrue(Files.isExecutable(Path.of("/bin/zsh")) || onPath("zsh"), "zsh is not installed");
boolean zshInstalled = Files.isExecutable(Path.of("/bin/zsh")) || onPath("zsh");
// CI installs zsh and sets this, so the test cannot skip there without anyone noticing.
if (Boolean.parseBoolean(System.getenv("FLOCI_TEST_REQUIRE_ZSH"))) {
assertTrue(zshInstalled, "FLOCI_TEST_REQUIRE_ZSH is set but zsh is not installed");
}
assumeTrue(zshInstalled, "zsh is not installed");
Path completion = tempDir.resolve("floci.zsh");
Files.writeString(completion, script("zsh"));
String probe = String.join("\n",