From e29f95b6a74a72f60b9bd0af6e665b0f22a3ee31 Mon Sep 17 00:00:00 2001 From: Hector Ventura Date: Wed, 18 Nov 2026 23:14:51 -0600 Subject: [PATCH] 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 --- .github/workflows/ci.yml | 8 ++++++++ src/test/java/io/floci/cli/unit/ZshCompletionTest.java | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94ad0a9..0b6d6d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/src/test/java/io/floci/cli/unit/ZshCompletionTest.java b/src/test/java/io/floci/cli/unit/ZshCompletionTest.java index 25a56ff..48ce32c 100644 --- a/src/test/java/io/floci/cli/unit/ZshCompletionTest.java +++ b/src/test/java/io/floci/cli/unit/ZshCompletionTest.java @@ -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",