Skip to content

Run the test suites on every push - #14

Merged
pavel-te merged 1 commit into
mainfrom
self-test-workflow
Aug 6, 2026
Merged

Run the test suites on every push#14
pavel-te merged 1 commit into
mainfrom
self-test-workflow

Conversation

@pavel-te

@pavel-te pavel-te commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

There was no CI in this repository — no workflow file, nothing ran the suites automatically. They take four seconds and need no network (four stub curl, the rest only use --dry-run, which skips preflight), so nothing stood in the way.

It matters more than usual here: the script is downloaded by tag from customer pipelines and vendored into the action, so a broken main becomes a release, and a release becomes what those pipelines fetch.

suites — the same tests, twice

runner bash
macos-latest /bin/bash, still 3.2.57
ubuntu-latest current bash

The macOS leg is not decoration: the CLI targets bash 3.2 deliberately, and current bash quietly accepts syntax 3.2 rejects — a contributor on Linux cannot see that break. Each suite gets its own log group, and one failure does not mask the rest.

checks — four things that used to need a human

  • --version agrees with the VERSION constant.
  • No config/examples/*.config comes back — those were KEY=VALUE files the parser rejected.
  • Every fenced block in README.md and docs/*.md is what it claims to be: yaml parses, bash survives bash -n. Output samples belong in text.
  • Only the double-brace placeholder appears; a single-brace one is taken literally.

The guards were verified against the broken state, not just the fixed one:

  • the block check catches both bad blocks in the previous revision of the README
  • single-bracing a placeholder in an example is caught
  • a deliberately failing suite dropped into tests/ turns the step red and names it

What adding CI found on its first run

A CI checkout leaves the tree on a detached HEAD, and there the file-tag auto-detection produces nothing — six of the twelve invocation tests stopped before doing any work.

The workflow puts the checkout on a branch, and the behaviour itself is now asserted deliberately in tests/test-git-context.sh rather than left to whichever checkout style a runner uses:

  • on a branch → tag detected, run completes
  • detached HEAD → refused with an explicit message
  • detached HEAD + explicit --file-tag-name → completes

That file also records an asymmetry it exposed: no repository at all falls back to a default tag, while a repository on a detached HEAD falls back to nothing. The chain is

git branch --show-current || git rev-parse --abbrev-ref HEAD || echo "main"

which assumes the first command fails on a detached HEAD. It does not — it prints an empty string and exits 0, so neither fallback is reached. Left exactly as it stands and asserted, because changing it changes CLI behaviour and belongs in its own change.

Verification

  • 234 assertions across eight suites, no failures
  • links is a separate advisory job: a dead link is a real defect, but an upstream hiccup must not turn main red

Also fixes what the new checks immediately found in docs/DEVELOPMENT.md, which nothing had ever validated: git clone <repository-url> is not valid shell, the directory it then entered was never the repository name, three examples used the single-brace placeholder, and the --timeout illustration is a fragment rather than a script.

There was no CI here — no workflow file, nothing ran the suites automatically.
They take four seconds and need no network (four stub curl, the rest only use
--dry-run, which skips preflight), so there was nothing standing in the way.
That matters more than usual in this repository: the script is downloaded by
tag from customer pipelines and vendored into the action, so a broken main
becomes a release and a release becomes what those pipelines fetch.

The suites run twice: on ubuntu-latest with current bash, and on macos-latest
against /bin/bash, which is still 3.2.57. The CLI targets 3.2 deliberately and
current bash quietly accepts syntax 3.2 rejects, so a contributor on Linux
cannot see that break. Each suite gets its own log group and one failure does
not hide the others.

Four repository checks beyond the suites, each one something that had to be
noticed by hand before:

- --version agrees with the VERSION constant.
- No config/examples/*.config comes back; those were KEY=VALUE files the parser
  rejected, and the extension is what suggested the format.
- Every fenced block in README.md and docs/*.md is what it claims to be: yaml
  parses, bash survives bash -n. Verified against the previous revision of the
  README, where it catches the two blocks that showed CLI output while tagged
  bash.
- Only the double-brace placeholder appears; a single-brace one is taken
  literally and yields a path nobody has.

Link checking is a separate advisory job, because a dead link is a real defect
but an upstream hiccup must not turn main red.

Adding the workflow surfaced something immediately: a CI checkout leaves the
tree on a detached HEAD, and there the file-tag auto-detection produces
nothing, so six of the twelve invocation tests stopped before doing any work.
The workflow puts the checkout on a branch, and the git-context behaviour is
now asserted on purpose in tests/test-git-context.sh instead of depending on
how a runner happens to check out: detected on a branch, refused with an
explicit message on a detached HEAD, and satisfied by passing the tag
explicitly. That file also records the asymmetry it exposed — no repository at
all falls back to a default tag, while a repository on a detached HEAD falls
back to nothing, because the fallback chain assumes the first command fails
where it actually succeeds and prints an empty string. Left as it stands;
changing it changes CLI behaviour.

Suites: 234 assertions across eight files, no failures.

Fixing what the new checks found in docs/DEVELOPMENT.md: `git clone
<repository-url>` is not valid shell, and the directory it then entered was
never the repository name; three examples used the single-brace placeholder;
the --timeout illustration is a fragment rather than a script. Also documented
the CI and the offline property of the suites, and added the status badge.
@pavel-te
pavel-te merged commit cb63d78 into main Aug 6, 2026
4 checks passed
@pavel-te
pavel-te deleted the self-test-workflow branch August 6, 2026 07:52
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