From 216c0f046615d8a2c8c0c5b6796a673e8a8c5210 Mon Sep 17 00:00:00 2001 From: Eugene Kalinin Date: Sun, 8 Nov 2026 21:26:34 +0300 Subject: [PATCH 1/4] docs(openspec): propose update-ci-bats change --- .../changes/update-ci-bats/.openspec.yaml | 3 + openspec/changes/update-ci-bats/design.md | 127 ++++++++++++++++++ openspec/changes/update-ci-bats/proposal.md | 51 +++++++ openspec/changes/update-ci-bats/tasks.md | 21 +++ 4 files changed, 202 insertions(+) create mode 100644 openspec/changes/update-ci-bats/.openspec.yaml create mode 100644 openspec/changes/update-ci-bats/design.md create mode 100644 openspec/changes/update-ci-bats/proposal.md create mode 100644 openspec/changes/update-ci-bats/tasks.md diff --git a/openspec/changes/update-ci-bats/.openspec.yaml b/openspec/changes/update-ci-bats/.openspec.yaml new file mode 100644 index 0000000..0acfd37 --- /dev/null +++ b/openspec/changes/update-ci-bats/.openspec.yaml @@ -0,0 +1,3 @@ +schema: spec-driven +created: 2026-11-08 +skip_specs: true diff --git a/openspec/changes/update-ci-bats/design.md b/openspec/changes/update-ci-bats/design.md new file mode 100644 index 0000000..3ae67b9 --- /dev/null +++ b/openspec/changes/update-ci-bats/design.md @@ -0,0 +1,127 @@ +# Design + +## Context + +See proposal.md - Why. + +`.github/workflows/ci.yml` has one job on `ubuntu-latest`: + +``` +Setup bats mig4/setup-bats@v1, bats-version: 1.6.0 +Check out code actions/checkout@v2 +Run tests make test, GH_TOC_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` + +It runs on `pull_request` and `push` to master, on a schedule twice a week, and by hand +(`workflow_dispatch`). + +`bats-core/bats-action@4.1.0` (2026-11-01) is a composite action: + +- It downloads the bats-core tarball of `bats-version` from `api.github.com`, with the + `github-token` input when it is set, and installs it into `~/.local/share/bats`. An + empty version or `latest` is resolved with the GitHub API to the latest release. +- It caches that directory with `actions/cache` (pinned to the commit of v6.1.0, which + runs on `node24`). The cache key is + `${{ runner.os }}-${{ runner.arch }}-bats-${{ inputs.bats-version }}`. +- By default it also installs bats-support, bats-assert, bats-detik and bats-file into + `/usr/lib/...`. + +The tests load only `tests/test_helper.bash`, which has its own `assert_*` functions. +All 76 tests pass locally with bats 1.14.0 (macOS, Homebrew). + +`actionlint` 1.7.12 (run with Docker, `rhysd/actionlint`) reports the current `ci.yml`: +`the runner of "actions/checkout@v2" action is too old to run on GitHub Actions`. + +## Goals / Non-Goals + +**Goals:** + +- The same bats version in CI as from Homebrew, set in one place. +- No action in `ci.yml` that targets Node.js 20. + +**Non-Goals:** + +- Pinning the actions by commit SHA: the workflows of the project use version tags + (`pages.yml`: `actions/checkout@v7`). + +## Decisions + +### `bats-core/bats-action` for bats + +``` + bats-action@4.1.0 git clone + install.sh mig4 with 1.14.0 +---------------- -------------------- ----------------------- ----------------- +maintained by bats-core, 2026-11 our own script no release since 2020 +Node.js 20 no (composite) no yes +exact version bats-version --branch v1.14.0 bats-version +extra installs 4 libraries, can be none none + turned off +cache yes, key by version no no +``` + +The action is the official one and was suggested in #176. A `git clone` of the tag with +`install.sh` has no dependency, but is a script of our own to keep in the workflow. +`mig4` with a new version keeps the Node.js 20 warning. npm (`bats` 1.13.0) and apt on +Ubuntu 24.04 (1.10.0) do not have 1.14.0. + +### An exact bats version, not `latest` + +With an empty version or `latest`, the cache key is always `...-bats-`. The first run +caches the latest bats of that day, and every later run restores it. The scheduled runs +keep the cache in use, so it does not expire, and CI would stay on that bats version. +`bats-version: 1.14.0` gives a key per version: a new version is a one-line change that +also replaces the cache. + +### No bats libraries + +`support-install`, `assert-install`, `detik-install` and `file-install` are `false`. The +tests do not load them, so they would only add downloads to every run without a cache +hit. + +### `github-token` + +`github-token: ${{ secrets.GITHUB_TOKEN }}`, the same secret `make test` gets as +`GH_TOC_TOKEN`. Without it, the tarball is downloaded from `api.github.com` without +authentication, which has a limit of 60 requests per hour per IP, shared by the jobs on +the runner's IP. + +### `actions/checkout@v7` + +v5 moved to `node24` (runner 2.327.1 or newer, GitHub-hosted runners have it), v6 keeps +the credentials in a separate file, v7 blocks checking out a fork PR on +`pull_request_target` and `workflow_run`. `ci.yml` does not use those events, and +`make test` does not use the git credentials. `pages.yml` already uses `@v7`. + +### The new steps + +```yaml + - name: Setup bats + uses: bats-core/bats-action@4.1.0 + with: + bats-version: 1.14.0 + support-install: false + assert-install: false + detik-install: false + file-install: false + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check out code + uses: actions/checkout@v7 +``` + +The step names and their order stay as they are. + +### Checks + +Locally: `yamllint -d relaxed` and `actionlint` (Docker) on `ci.yml`. The workflow +itself runs only on GitHub: the CI of the PR shows `bats-version: 1.14.0` in the inputs +of "Setup bats", the installed bats, the Node.js 20 annotation without these actions, and +the result of the tests. + +## Risks / Trade-offs + +- [A test passes with bats 1.6.0 and 1.14.0 on macOS but not with 1.14.0 on Linux] → + The CI of the PR runs the whole suite before the merge. +- [The remote tests fail now and then on github.com pages] → Not related to this change + (#179); the failed job can be run again. +- [bats-action changes in a later release] → It is pinned to the `4.1.0` tag. diff --git a/openspec/changes/update-ci-bats/proposal.md b/openspec/changes/update-ci-bats/proposal.md new file mode 100644 index 0000000..213848f --- /dev/null +++ b/openspec/changes/update-ci-bats/proposal.md @@ -0,0 +1,51 @@ +# Proposal + +## Why + +CI runs the tests with bats 1.6.0, installed by `mig4/setup-bats@v1` (#176). The latest +bats-core release is 1.14.0 (2026-07-21), and Homebrew installs 1.14.0, so local runs and +CI use different bats versions. All 76 tests pass locally with bats 1.14.0 (macOS). + +`mig4/setup-bats` had its last release (`v1.2.0`) in 2020. Every CI run has the warning +`Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced +to run on Node.js 24: actions/checkout@v2, mig4/setup-bats@v1.` + +## What Changes + +- `.github/workflows/ci.yml`, step "Setup bats": `mig4/setup-bats@v1` with + `bats-version: 1.6.0` is replaced with `bats-core/bats-action@4.1.0` with + `bats-version: 1.14.0`. The bats libraries that the action installs by default + (bats-support, bats-assert, bats-detik, bats-file) are not installed: the tests use + their own `tests/test_helper.bash`. The action gets `github-token`. +- `.github/workflows/ci.yml`, step "Check out code": `actions/checkout@v2` is replaced + with `actions/checkout@v7`, the version `pages.yml` already uses. + +The tests, `gh-md-toc` and the other workflows do not change. + +Non-goals: + +- `.github/workflows/dockerimage.yml` (`actions/checkout@v2`, + `docker/build-push-action@v1`): another workflow, and `docker/build-push-action` has a + different API in its later versions. +- Taking the latest bats in CI on every run instead of a fixed version. +- Automatic updates of the actions and the bats version (Dependabot). +- The remote tests that fail now and then on github.com pages (#179, the HTTP status of + a remote URL is not checked). + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +None. The change is in CI only; the behavior of `gh-md-toc` does not change, so +`skip_specs: true` is set in `.openspec.yaml`. + +## Impact + +- `.github/workflows/ci.yml`: the "Setup bats" and "Check out code" steps. +- CI: bats 1.14.0 instead of 1.6.0, the same version as Homebrew. No Node.js 20 warning + from this workflow. +- Closes #176. diff --git a/openspec/changes/update-ci-bats/tasks.md b/openspec/changes/update-ci-bats/tasks.md new file mode 100644 index 0000000..726351b --- /dev/null +++ b/openspec/changes/update-ci-bats/tasks.md @@ -0,0 +1,21 @@ +# Tasks + +## 1. Workflow + +- [ ] 1.1 `.github/workflows/ci.yml`, step "Setup bats": replace `mig4/setup-bats@v1` + and `bats-version: 1.6.0` with the `bats-core/bats-action@4.1.0` step from design.md + (`bats-version: 1.14.0`, the four `*-install: false`, `github-token`); verify + `yamllint -d relaxed .github/workflows/ci.yml` passes +- [ ] 1.2 `.github/workflows/ci.yml`, step "Check out code": replace `actions/checkout@v2` + with `actions/checkout@v7`; verify + `docker run --rm -i rhysd/actionlint:1.7.12 -color=false - < .github/workflows/ci.yml` + reports nothing, and `git diff` changes only these two steps + +## 2. Verification + +- [ ] 2.1 Run `make test` locally with bats 1.14.0 and `GH_TOC_TOKEN` set; verify all + tests pass +- [ ] 2.2 After the branch is pushed and the PR is opened (each step on request), check + its CI run: "Setup bats" has `bats-version: 1.14.0` in its inputs and installs bats + 1.14.0, the run has no Node.js 20 annotation for `actions/checkout` or the bats step, + and all tests pass From 89a7f69a91ee8a4e873c7042aef1f1636a5d3b73 Mon Sep 17 00:00:00 2001 From: Eugene Kalinin Date: Sun, 8 Nov 2026 21:30:44 +0300 Subject: [PATCH 2/4] chore(ci): update bats to 1.14.0 and checkout to v7 --- .github/workflows/ci.yml | 11 ++++++++--- openspec/changes/update-ci-bats/tasks.md | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e74704..ea923ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,12 +17,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup bats - uses: mig4/setup-bats@v1 + uses: bats-core/bats-action@4.1.0 with: - bats-version: 1.6.0 + bats-version: 1.14.0 + support-install: false + assert-install: false + detik-install: false + file-install: false + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v7 - name: Run tests run: make test diff --git a/openspec/changes/update-ci-bats/tasks.md b/openspec/changes/update-ci-bats/tasks.md index 726351b..58d0a88 100644 --- a/openspec/changes/update-ci-bats/tasks.md +++ b/openspec/changes/update-ci-bats/tasks.md @@ -2,11 +2,11 @@ ## 1. Workflow -- [ ] 1.1 `.github/workflows/ci.yml`, step "Setup bats": replace `mig4/setup-bats@v1` +- [x] 1.1 `.github/workflows/ci.yml`, step "Setup bats": replace `mig4/setup-bats@v1` and `bats-version: 1.6.0` with the `bats-core/bats-action@4.1.0` step from design.md (`bats-version: 1.14.0`, the four `*-install: false`, `github-token`); verify `yamllint -d relaxed .github/workflows/ci.yml` passes -- [ ] 1.2 `.github/workflows/ci.yml`, step "Check out code": replace `actions/checkout@v2` +- [x] 1.2 `.github/workflows/ci.yml`, step "Check out code": replace `actions/checkout@v2` with `actions/checkout@v7`; verify `docker run --rm -i rhysd/actionlint:1.7.12 -color=false - < .github/workflows/ci.yml` reports nothing, and `git diff` changes only these two steps From f1386bed703765290136f4c92c25ec7c604f9589 Mon Sep 17 00:00:00 2001 From: Eugene Kalinin Date: Sun, 8 Nov 2026 21:31:40 +0300 Subject: [PATCH 3/4] chore(openspec): mark update-ci-bats local tasks done --- openspec/changes/update-ci-bats/tasks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openspec/changes/update-ci-bats/tasks.md b/openspec/changes/update-ci-bats/tasks.md index 58d0a88..c3e412c 100644 --- a/openspec/changes/update-ci-bats/tasks.md +++ b/openspec/changes/update-ci-bats/tasks.md @@ -13,7 +13,7 @@ ## 2. Verification -- [ ] 2.1 Run `make test` locally with bats 1.14.0 and `GH_TOC_TOKEN` set; verify all +- [x] 2.1 Run `make test` locally with bats 1.14.0 and `GH_TOC_TOKEN` set; verify all tests pass - [ ] 2.2 After the branch is pushed and the PR is opened (each step on request), check its CI run: "Setup bats" has `bats-version: 1.14.0` in its inputs and installs bats From 72f8c58ca2551b6d2325a51c4149c0b7ff277b85 Mon Sep 17 00:00:00 2001 From: Eugene Kalinin Date: Sun, 8 Nov 2026 21:38:44 +0300 Subject: [PATCH 4/4] chore(openspec): mark update-ci-bats tasks done --- openspec/changes/update-ci-bats/tasks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openspec/changes/update-ci-bats/tasks.md b/openspec/changes/update-ci-bats/tasks.md index c3e412c..cc9780b 100644 --- a/openspec/changes/update-ci-bats/tasks.md +++ b/openspec/changes/update-ci-bats/tasks.md @@ -15,7 +15,7 @@ - [x] 2.1 Run `make test` locally with bats 1.14.0 and `GH_TOC_TOKEN` set; verify all tests pass -- [ ] 2.2 After the branch is pushed and the PR is opened (each step on request), check +- [x] 2.2 After the branch is pushed and the PR is opened (each step on request), check its CI run: "Setup bats" has `bats-version: 1.14.0` in its inputs and installs bats 1.14.0, the run has no Node.js 20 annotation for `actions/checkout` or the bats step, and all tests pass