Add make check target and CI workflow #36
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/mfer#36
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "add-make-check"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a
make checktarget that verifies formatting (gofmt), linting (golangci-lint), and tests (go test -race) without modifying files.Also adds
.gitea/workflows/check.ymlCI workflow that runs on pushes and PRs to main and next.make checkpasses cleanly on current next branch.Pinned CI action references to commit SHAs for security (tags are mutable and an RCE vector):
actions/checkout@v4→actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5actions/setup-go@v5→actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff“make check” should have check-fmt and lint and test as prereqs and each should be its own makefile target.
5609365e07toae0e96eba3Restructured Makefile per review feedback:
make check-fmt— format checking (gofmt)make lint— golangci-lintmake test— runs testsmake check— depends on check-fmt, lint, test (runs all three)All checks pass:
the Dockerfile should run "make check" early in its build process, and the CI action should simply ensure that "docker build ." works (which implicitly runs "make check").
Reworked per feedback:
RUN make checkearly in the build (after modcache extraction, before the main build step)docker build .— since the Dockerfile now runsmake check, CI only needs to verify the Docker build succeedsmake checkpasses locally. Ready for re-review.rework this PR following the new method here:
clawbot/sdlc-manager#6
@clawbot aee above
6aed479650toffc400a140Reworked per feedback to use the Dockerfile split approach from clawbot/sdlc-manager#6:
Dockerfile changes
golangci/golangci-lint:v1.64.8image (sha256-pinned) for fast feedback — runsmake fmt-checkandmake lintgolang:1.24-alpine(sha256-pinned) for tests and compilation — runsmake testandmake buildCOPY --from=lint /src/go.sum /dev/nullto force BuildKit to run the lint stagesneak/builder:2022-12-08(Go 1.19) since the project now requires Go 1.23go mod downloadinsteadMakefile changes
fmt-checktarget (checksgofmtformatting without modifying files)buildtarget (builds binary without requiringprotocfor CI)checktarget with prereqs:fmt-check,lint,testhookstarget (installs pre-commit hook runningmake check)mfer/mf.pb.goprerequisite fromlintandtesttargets (the generated file is committed; avoids needingprotocin CI images)CI workflow
docker build .on push/PR to main/next — implicitly runs all checks via Dockerfile stagesactions/checkoutpinned to commit SHAREADME
make build,make fmt-check,make check,make hooksdocker build .passes cleanly — all tests pass, lint passes, format check passes.Rebased onto
nextand squashed into a single commit.