Skip to content

ci: run the hook suites on macOS's stock bash and the secret-scan test cross-platform - #778

Merged
addyosmani merged 1 commit into
addyosmani:mainfrom
ayobamiseun:ci/macos-hooks-and-secret-scan
Nov 14, 2026
Merged

addyosmani merged 1 commit into
addyosmani:mainfrom
ayobamiseun:ci/macos-hooks-and-secret-scan

Conversation

@ayobamiseun

Copy link
Copy Markdown
Contributor

Two CI coverage gaps, both in .github/workflows/test-plugin-install.yml, so one PR.

1. The hook suites never run on macOS

test-hooks runs sdd-cache-test.sh and simplify-ignore-test.sh on ubuntu-latest only, under bash 5. The hooks run under whatever bash the host has, and the versions have already disagreed in this repo: 7b31a90 fixed protected blocks being corrupted under bash 5.2 on Linux, a bug invisible on macOS because bash 3.2 has no patsub_replacement. The reverse failure, a bash 4 construct (declare -A, mapfile, ${var,,}) that the stock /bin/bash 3.2 on a Mac rejects, has no coverage. A Mac without Homebrew bash runs the hooks under 3.2.

The job becomes an ubuntu-latest and macos-latest matrix. On macOS, /bin goes first on PATH, so the suites, and the bash hooks/... calls they make, run under the stock 3.2 rather than a newer bash the runner image may carry. A first step prints bash --version and jq --version. The jq check matters because without jq both suites skip their round-trip tests and still pass, so a runner without jq would turn the macOS leg into a silent no-op.

Locally, with the same PATH prefix on macOS (bash 3.2.57, jq 1.7.1): sdd-cache-test.sh 29 passed, simplify-ignore-test.sh 74 passed. Nothing fails today. This guards a known class of failure, not a hypothetical one.

2. The staged-secret-scan test runs on Linux only

scripts/staged-secret-scan-test.js arrived with #718 and has a step in the Linux job, but it is missing from the hand-kept node --test list in validate-platforms, which you pointed out on #671 is a list, not a glob. Added. It passes on macOS locally. On Windows it shells out to bash and skips itself if none is available, so the worst case there is a skip, not a failure; the run will show which.

Overlap

#665 and #548 each add a test file to the same node --test list, so whichever of the three merges second needs a one-line rebase. No other open PR touches these lines.

…t cross-platform

The hook suites run only on ubuntu-latest, under bash 5. The hooks run
under whatever bash the host has, and the versions disagree: 7b31a90
fixed protected blocks corrupted under bash 5.2 on Linux while macOS
stayed clean. A regression in the other direction, a bash 4 construct
the stock /bin/bash 3.2 on a Mac rejects, has no CI coverage at all.
Make the hooks job an ubuntu and macOS matrix, put /bin first on macOS
so the suites run under bash 3.2, and print bash and jq so a missing
jq cannot turn the round-trip tests into silent skips. Both suites
pass under /bin/bash 3.2 locally: 29 and 74 checks.

Also add scripts/staged-secret-scan-test.js (from addyosmani#718) to the
hand-kept node --test list of the macOS and Windows job. It ran on
Linux only.

@addyosmani addyosmani left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: stock bash 3.2 is what a Mac without Homebrew runs, so this covers a real gap, and the jq --version step stops the macOS leg from silently skipping. Thanks.

@addyosmani
addyosmani merged commit e982f64 into addyosmani:main Nov 14, 2026
8 checks passed
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.

2 participants