Skip to content

Run the repo checks on pull requests - #58

Merged
esnible merged 1 commit into
mainfrom
ci-workflow
Aug 13, 2026
Merged

Run the repo checks on pull requests#58
esnible merged 1 commit into
mainfrom
ci-workflow

Conversation

@esnible

@esnible esnible commented Aug 13, 2026

Copy link
Copy Markdown
Member

Adds .github/workflows/ci.yml — one job on every PR and on pushes to main:

Step Command
Check formatting gofmt -l ., failing if non-empty
Check go.mod is tidy go mod tidy then git diff --quiet
Vet make vet
Build go build ./...
Test go test ./... -count=1
Race go test ./... -race -count=1
Shuffle go test ./... -count=1 -shuffle=on

Mirrors the Makefile targets, so a CI failure reproduces locally. gofmt -l rather than make fmt, which rewrites files — CI should report formatting, not fix it and test something the author never wrote.

The shuffled run is deliberate: the suite mutates process state (HOME, cobra flag values), and cmd/root_test.go documents a pflag hazard where a slice flag's first Set in a later test appends rather than replaces. Better caught here than on an unrelated PR. All three test passes take ~25s.

Pushes to main are included so a breaking merge is attributed to the merge, not the next PR. Concurrency cancels superseded PR runs, never main-branch runs.

Conventions follow release.yml (checkout@v7, setup-go@v7, go-version-file: go.mod). permissions: contents: read.

Verified each gate actually fails, not just that the workflow is valid and currently green: bad formatting, an unused require, a bad Printf verb, and a broken assertion were each caught by the intended step. No services, credentials, or egress needed.

Assisted by Claude.

Signed-off-by: Ed Snible snible@us.ibm.com

🤖 Generated with Claude Code

Adds .github/workflows/ci.yml: one job running gofmt, a go.mod tidy check,
vet, build, and the test suite on every pull request and on pushes to main.

The steps mirror the Makefile targets a contributor runs locally, so a CI
failure means the same command fails on their machine. gofmt is checked with
-l rather than `make fmt`, which rewrites files — CI must report formatting,
not silently fix it and then test code the author never wrote.

Tests run three times: plain, under -race, and with -shuffle=on. The shuffle
is not redundant. The suite mutates process state (HOME, XDG_CONFIG_HOME,
cobra flag values), and cmd/root_test.go documents a pflag hazard where a
slice flag's first Set in a later test appends rather than replaces, so an
order-dependent test is a real risk. Better surfaced here than on an
unrelated PR. All three passes together take about 25 seconds.

Pushes to main are included so a merge that breaks something is attributed
to the merge rather than to the next pull request. Concurrency cancels
superseded pull-request runs but never cancels main-branch runs, so
consecutive merges each get a result.

Conventions follow release.yml: checkout@v7, setup-go@v7, and
go-version-file: go.mod so the Go version stays in one place. Permissions
are contents: read, since nothing here writes.

No services, credentials, or network egress are needed: tests bind ephemeral
localhost ports and point HOME at a temp directory, and the container tests
assert on the command strings they would run rather than invoking a real
runtime.

Assisted by Claude.

Signed-off-by: Ed Snible <snible@us.ibm.com>
@esnible
esnible merged commit c76896c into main Aug 13, 2026
2 checks passed
@esnible
esnible deleted the ci-workflow branch August 13, 2026 19:22
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