Skip to content

Add CI workflows, /ci skill, and test fixes#22

Open
jnasbyupgrade wants to merge 12 commits into
masterfrom
add-ci
Open

Add CI workflows, /ci skill, and test fixes#22
jnasbyupgrade wants to merge 12 commits into
masterfrom
add-ci

Conversation

@jnasbyupgrade
Copy link
Copy Markdown
Contributor

Summary

  • Add GitHub Actions CI workflow (.github/workflows/ci.yml) — matrix of PG 12–17, resolves paired pgxntool branch by name, pre-installs pgtap to prevent concurrent install race condition
  • Add /ci skill for monitoring CI runs after every push (shell-driven, BRANCHES line verification, race condition documentation)
  • Fix fail: command not found in BATS tests — replace undefined fail() with error() (8 sites in concurrent-make-test.bats and make-test.bats)
  • Update CLAUDE.md with CI monitoring rules and multi-session PR guard
  • Add CI and Contributing section to README

Notes

This PR pairs with pgxntool PR #33 (add-ci branch). The CI in this repo resolves the pgxntool branch by matching the PR branch name — since both are now named add-ci, the full cross-repo workflow is exercised.

🤖 Generated with Claude Code

jnasbyupgrade and others added 12 commits May 15, 2026 14:33
Explains the cross-repo PR workflow, branch naming convention,
how the pgxntool CI wait logic works, the no-test-pr label and
its write-protection, and what branch protection enforces.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- .github/workflows/ci.yml: test against matching pgxntool branch
  (falls back to master if no matching branch exists)
- CLAUDE.md: warn before touching existing PRs not opened in this session

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
git subtree add refuses to work with shallow clones; fails with
"shallow roots are not allowed to be updated" which looks like a
remote/ref problem rather than a depth issue.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- gem install asciidoctor instead of apt ruby-asciidoctor: the apt
  package binary is not on PATH in pgxn-tools containers (diagnosed
  from base.mk: "Could not find asciidoc or asciidoctor")
- Print '=== BRANCHES: ===' line in resolve step so CI logs clearly
  show which pgxntool branch was selected for the run

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Shell-script-driven skill that monitors GitHub Actions runs across both
repos after a push. Key features:
- Uses --commit SHA when available to avoid branch-race-condition
- Fast log API path for BRANCHES line extraction (~1s vs 3-10s zip)
- Parallel monitoring of both repos by default
- Per-job pass/fail summary + failure log tail
- 10-min timeout for pgxntool (accounts for 5-min test-PR wait)
- Prefixes all output with [repo] for readability when interleaved

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The concurrent-make-test.bats test runs two `make test` processes
simultaneously to verify database-name isolation. Both processes check
$(datadir)/extension/pgtap.control and, finding it absent, both invoke
`pgxn install pgtap --sudo` concurrently. Their simultaneous `gmake
install` calls race to write files into the shared
/usr/share/postgresql/<pg>/extension/ directory, producing:

  install: cannot create regular file '.../pgtap--X.Y.Z.sql': File exists
  install: cannot change permissions of '...': No such file or directory

The race is most pronounced on older PostgreSQL versions (e.g. PG13)
where pgtap's build applies more compat patches, widening the window
during which both installs run in parallel.

Fix: add a Pre-install pgtap step before `make test`. With pgtap.control
already present, both concurrent make processes find the Make target's
prerequisite satisfied and skip the install entirely — no race occurs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Script now prints OVERALL: ALL_PASS/FAIL/TIMEOUT as the last line
- Exit codes: 0=pass, 1=fail, 2=timeout (distinguishable from failure)
- SKILL.md documents the contract with a table so Claude knows exactly
  what to check without parsing the full output

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- monitor-ci.sh: fix sed delimiter collision when $label contains '/'
  (sed "s/^/$label /" broke because $label = "[repo/name]"; use '|' delimiter)
- monitor-ci.sh: initialize pid_test/pid_pgxn before case statement to
  prevent "unbound variable" error with set -u when repos=both
- SKILL.md: add race condition warning box; clarify BRANCHES line
  verification as primary safeguard against --branch picking wrong run
- CLAUDE.md: replace vague CI monitoring rule with specific SHA + BRANCHES
  line guidance

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
`fail` is not a BATS built-in and is not defined anywhere in the test
helpers. When a test assertion fails and `fail "message"` is called,
bash reports "fail: command not found" (exit 127), which masks the real
failure message entirely.

The correct replacement is `error`, which is defined in test/lib/helpers.bash:
  error() { out "ERROR: $*"; return 1; }

8 sites fixed across two files:
- test/standard/concurrent-make-test.bats (7 uses)
- test/standard/make-test.bats (1 use)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- README: rewrite CI and Contributing section to reflect new fast
  check-test-pr behavior, 'commit-with-no-tests' label, clear
  instructions for "no paired test PR" failures
- Remove references to 5-minute wait and old 'no-test-pr' label name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant