Skip to content

Clean up CI matrix#574

Merged
nertzy merged 4 commits into
masterfrom
clean-up-ci-matrix
May 22, 2026
Merged

Clean up CI matrix#574
nertzy merged 4 commits into
masterfrom
clean-up-ci-matrix

Conversation

@nertzy
Copy link
Copy Markdown
Collaborator

@nertzy nertzy commented May 22, 2026

Summary

Tidies up .github/workflows/ci.yml across four small commits.

  • Drop the separate bundle update step from the matrix. Previously the matrix prepended ACTIVE_RECORD_VERSION=... (or ACTIVE_RECORD_BRANCH=...) onto a follow-up bundle update step because setup-ruby's bundler-cache install ran before those env vars were in scope — the cached install resolved the gemspec's default Active Record, so a second resolution was needed to swap in the matrix's chosen version. The matrix value is now written to $GITHUB_ENV in a step that runs before setup-ruby, the cached install picks up the right gems on the first try, and the extra step disappears. The new cache-version input on setup-ruby partitions the bundler cache per matrix entry so different Active Record versions don't collide on the same cache key.
  • Give matrix jobs readable names. The Active Record matrix axis is now an object with a short label and the env payload, and the job name template renders as Ruby <ruby-version> / Active Record <label> — e.g. Ruby 3.3 / Active Record 7.2 or Ruby 4.0 / Active Record main — instead of the default test (3.3, ACTIVE_RECORD_VERSION="~> 7.2.0", false). The ruby-head row is also sorted to the bottom of the include block so the unstable entries are visually grouped.
  • Drop the dead PGPASS env. PGPASS is not a libpq variable (the right name is PGPASSWORD) and nothing in the repo reads it. The actual password comes from PGPASSWORD on the createdb step and from a hardcoded "postgres" in spec/support/database.rb when CI=true.
  • Tighten workflow defaults. Three defensive additions: permissions: contents: read at the workflow level so the default GITHUB_TOKEN is least-privilege; a concurrency group keyed on workflow + ref that cancels superseded PR runs (master pushes and the Saturday cron run to completion); and timeout-minutes: 20 on the test job to guard against a hung runner — most likely on the ruby-head row — eating six hours of the GH Actions budget.

Test plan

  • CI runs green across the matrix
  • Job names in the Actions UI read as Ruby <version> / Active Record <label>
  • A second push to this PR cancels the first run

Generated with Claude Code

Previously the matrix prepended ACTIVE_RECORD_VERSION (or
ACTIVE_RECORD_BRANCH) onto a separate `bundle update` step because
setup-ruby's bundler-cache install ran before those env vars were in
scope. The cached install resolved the gemspec's default ActiveRecord,
so a follow-up `bundle update` was needed to swap in the matrix's
chosen version.

Write the matrix's KEY=value to $GITHUB_ENV in a step that runs before
setup-ruby instead. The cached install now resolves the right gems on
the first try, and cache-version partitions the bundler cache per
matrix entry so different ActiveRecord versions don't collide.
Comment thread .github/workflows/ci.yml Fixed
nertzy added 3 commits May 22, 2026 15:20
GitHub renders matrix job names from raw axis values by default, so
runs showed up as `test (3.3, ACTIVE_RECORD_VERSION=~> 7.2.0, false)`
— readable only after squinting.

Group the ActiveRecord axis into an object with a short `label` and a
`env` payload, then set the job `name:` to
`Ruby <ruby-version> / <label>`. Runs now show up as e.g.
`Ruby 3.3 / AR 7.2` or `Ruby 4.0 / AR main`.
PGPASS is not a libpq variable (the correct name is PGPASSWORD) and
nothing in the repo reads it. The actual password is supplied by
PGPASSWORD on the createdb step and by a hardcoded "postgres" in
spec/support/database.rb when CI=true. Removing the line so the job
env block accurately reflects what's in use.
Three defensive additions to .github/workflows/ci.yml:

- `permissions: contents: read` at the workflow level. Nothing in the
  workflow needs write access to the repo, and least-privilege defaults
  shrink the blast radius if any action ever turns out to be hostile.

- A `concurrency` group keyed on the workflow and ref, cancelling
  in-progress runs only when triggered by a pull request. Stacked PR
  pushes no longer waste CI minutes on superseded matrices; pushes to
  master and the Saturday cron still run to completion.

- `timeout-minutes: 20` on the test job. The suite finishes in well
  under that locally; the timeout guards against a hung runner (most
  likely on the ruby-head row) eating the GH Actions budget for six
  hours.
@nertzy nertzy force-pushed the clean-up-ci-matrix branch from e89769f to 39f9a66 Compare May 22, 2026 20:20
@nertzy nertzy merged commit 39f9a66 into master May 22, 2026
17 checks passed
@nertzy nertzy deleted the clean-up-ci-matrix branch May 22, 2026 20:28
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