Repository navigation
Add CI workflow for Go project with MySQL service - #1
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this solve?
There's no CI. The whole test gate lives in the local
Makefile(make test,make hooks), which works fine for a solo maintainer but does nothing for a PR from a stranger — right now a contributor has no way to know their PR passes before a maintainer runs it locally.What changed
Added
.github/workflows/ci.yml, running onpushandpull_request:go build ./...go vet ./...gofmt -l .(fails the job if any file is unformatted)govulncheck ./...go test ./... -race -cover, against a MySQL 8 service container (DB_DSNpointed at it; migrations self-apply on first connect same as they do locally)go.modviago-version-filerather than hardcoded/stable, so CI stays pinned to whatever toolchain the repo actually declaresNot included, on purpose: the iOS suite (
make test-ios). It needs a macOS runner plus an Xcode/simulator-runtime pairing that's currently fragile even locally (a recent Xcode update broke it by shipping an SDK whose simulator runtime wasn't installed). That's real work and deserves its own PR rather than being bolted onto this one.Coverage from
-coveris informational only — no threshold is enforced. A hard gate on a young project mostly produces noise; worth revisiting once coverage stabilizes.How was it tested?
Ran the workflow against this branch via a fork's Actions tab (push + PR trigger). All five steps (build, vet, gofmt, govulncheck, test) passed against the MySQL 8 service container. I did not have access to a macOS runner, so I could not exercise
test-ios— expected, since this PR deliberately doesn't touch it.I wasn't able to run
make testlocally end-to-end (no macOS/Xcode environment on my side), so I can't paste that output. The Go half (make test-go) passes locally and matches what CI now runs.Checklist
make testpasses (Go-race -cover+ iOS), or I've explained below which part I couldn't runios/SpamFilter.xcodeprojby hand (it's generated —ios/project.ymlis the source of truth)Anything reviewers should know?
DB_DSNis the only env var the Go test suite needs against a live database, based on.env.exampleand the README's note that migrations run automatically on startup forserver/seed/recompute. If any test package expects a different var name or a manual seed step beyond auto-migration, that'll surface as an immediate, clear CI failure rather than a silent gap.govulncheckis installed at@lateston every run rather than pinned to a version, so it always checks against current vulnerability data — the tradeoff is the job's dependency isn't fully reproducible run-to-run. Happy to pin it if you'd rather have determinism over freshness.