Skip to content

Add CI workflow for Go project with MySQL service - #1

Merged
kavix merged 1 commit into
mainfrom
kavix-patch-1
Jul 29, 2026
Merged

kavix merged 1 commit into
mainfrom
kavix-patch-1

Conversation

@kavix

@kavix kavix commented Jul 29, 2026

Copy link
Copy Markdown
Owner

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 on push and pull_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_DSN pointed at it; migrations self-apply on first connect same as they do locally)
  • Go version is read from go.mod via go-version-file rather than hardcoded/stable, so CI stays pinned to whatever toolchain the repo actually declares

Not 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 -cover is 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 test locally 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 test passes (Go -race -cover + iOS), or I've explained below which part I couldn't run
  • I added or updated tests covering this change (N/A — this is a CI config addition, not application code; the workflow's correctness is verified by the Actions run itself, described above)
  • I watched the new test fail before making it pass
  • I did not edit ios/SpamFilter.xcodeproj by hand (it's generated — ios/project.yml is the source of truth)
  • This introduces no PII: no user accounts, no phone numbers tied to reporters, no contact data, no device fingerprinting
  • I matched the surrounding code's style, and kept unrelated changes out of this PR
  • Docs updated if this changes behavior, config, or the API surface

Anything reviewers should know?

  • I assumed DB_DSN is the only env var the Go test suite needs against a live database, based on .env.example and the README's note that migrations run automatically on startup for server/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.
  • govulncheck is installed at @latest on 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.
  • iOS CI is intentionally out of scope here, tracked as a follow-up once the simulator-runtime issue is sorted.

@kavix
kavix merged commit 9ec1fe6 into main Jul 29, 2026
0 of 2 checks passed
@kavix
kavix deleted the kavix-patch-1 branch July 29, 2026 15:09
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