Skip to content

Add automated test harness for bump_version.sh #108

Description

@stslex

Context

.github/scripts/bump_version.sh is in the hot path of every release. It parses the TOML, performs an atomic rewrite, and is the single point where versions get bumped. One edge-case bug (CRLF line endings, BOM, trailing whitespace, an unusual quote style sneaking into the TOML) wedges every future cut.

The script was smoke-tested by hand during the Stage 7 migration (release happy path, hotfix happy path, malformed versionName rejection with file-unchanged assertion, missing/invalid --mode rejection, trailing-newline preservation), but those tests were never committed. They will silently regress on the next edit.

What's needed

  1. Add .github/scripts/bump_version_test.sh (bash or bats) covering at least:

    • --mode=release happy path (e.g. 1.5.0 / 42 → 1.6.0 / 43).
    • --mode=hotfix happy path (1.6.0 / 43 → 1.6.1 / 44).
    • Missing --mode and invalid --mode=<other> are rejected with a non-zero exit and a usage message.
    • Malformed versionName (e.g. "1.5") is rejected and the input file is left byte-identical.
    • Trailing-newline preservation: file ending with \n retains the \n; file ending without \n retains no \n.
    • (Stretch) CRLF line endings are tolerated, or are explicitly rejected with a clear error.
  2. Wire the test into CI so it runs on every PR that touches .github/scripts/**. Easiest path: add a job (or a step in pr_guard.yml) gated by a paths: filter on .github/scripts/**.

References

  • .github/scripts/bump_version.sh.
  • documentation/release-flow.md §4.1, §4.2 — TOML format and bump rules the script implements.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions