ci(openemr-cmd): add macOS leg to BATS matrix; fix bash 3.2 compat#785
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves openemr-cmd portability coverage by extending the BATS CI workflow to run on both Linux and macOS, ensuring the host CLI is tested under macOS’s system bash 3.2 (a common source of portability regressions).
Changes:
- Add a
macos-14leg to thetest-bats-openemr-cmdGitHub Actions matrix (withfail-fast: false). - Fix bash 3.2 incompatibility in
openemr-cmdby replacing${var,,}case-modification with a portable[Yy]glob match. - Update the BATS harness to avoid process substitution when “sourcing” function definitions, switching to
eval "$(head -n …)".
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
utilities/openemr-cmd/openemr-cmd |
Bump version and replace bash-4-only ${RESP,,} usage with bash 3.2-compatible input handling. |
tests/bats/openemr-cmd/state.bats |
Replace source <(head -n …) with eval "$(head -n …)" for macOS bash 3.2 compatibility. |
tests/bats/openemr-cmd/helpers.bash |
Update OC_SCRIPT_FUNCS_END and switch function-definition loading to eval "$(head -n …)". |
tests/bats/openemr-cmd/helpers_pure.bats |
Replace source <(head -n …) with eval "$(head -n …)" for macOS bash 3.2 compatibility. |
.github/workflows/test-bats-openemr-cmd.yml |
Convert to an OS matrix including ubuntu-22.04 and macos-14. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
openemr-cmd is a host CLI users run on their Macs, but BATS only ran on ubuntu-22.04 — so macOS portability bugs (e.g. the BSD realpath issue in PR openemr#783) reached users with zero CI coverage. Add a macos-14 leg to the BATS matrix, where the script runs under system bash 3.2. That surfaced two real bash 3.2 incompatibilities: - openemr-cmd used ${RESP,,} (bash 4+ case-modification), which throws "bad substitution" under macOS bash 3.2. Replace with a [Yy] glob match, preserving the [Y/n] default-yes semantics. - The test harness sourced the script via process substitution (source <(head -n ...)), which silently defines no functions under macOS bash 3.2. Switch the three sites to eval "$(head -n ...)". The repo is public, so GitHub-hosted macOS minutes are free. The macOS leg is advisory for now (fail-fast: false, not branch-protection required). Suite passes 39/39 under both bash 3.2 and bash 5. Assisted-by: Claude Code
ce22320 to
1e2fbd0
Compare
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
openemr-cmdis a host CLI developers run on their Macs, but its BATS workflow only ran onubuntu-22.04. So macOS-portability bugs reached users with zero CI coverage — most recently the BSDrealpathfailure fixed manually in #783. This adds amacos-14leg to the BATS matrix, where the script runs under macOS system bash 3.2, the sharpest portability risk.Adding that leg immediately surfaced two real bash 3.2 incompatibilities, both fixed here:
openemr-cmdused${RESP,,}(bash 4+ case-modification), which throwsbad substitutionunder bash 3.2. Replaced with a[Yy]glob match in[[ ]], preserving the[Y/n]default-yes semantics. (Verified identical behavior on bash 3.2 and 5.)source <(head -n …)), which silently defines no functions under macOS bash 3.2. Switched the three sites (helpers.bash,helpers_pure.bats,state.bats) toeval "$(head -n …)".The repo is public, so GitHub-hosted macOS minutes are free. The macOS leg is advisory for now (
fail-fast: false, not branch-protection-required) and can be promoted to required later.Test plan
${RESP,,}→[Yy]glob verified semantically identical across both shells (empty→pull, y/Y→pull, else→skip)helpers.bashandopenemr-cmdshellcheck-cleanubuntu-22.04andmacos-14legs go green