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",