From 950dd50c2ee8772a64d2e22c19d51d5401037c96 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 20 Feb 2026 02:53:26 -0800 Subject: [PATCH 1/5] add make check target --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index e27258f..34e4102 100644 --- a/Makefile +++ b/Makefile @@ -79,3 +79,12 @@ modcache.tzst: go.mod go.sum go mod download -x cd $(shell go env GOMODCACHE) && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp mv $@.tmp $@ + +# Run all checks (formatting, linting, tests) without modifying files +check: + @echo "==> Checking formatting..." + @test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1) + @echo "==> Running linter..." + golangci-lint run ./... + @echo "==> Running tests..." + go test -race -timeout 30s ./... -- 2.45.2 From f310001d1ef91a4b167922e0ff55b63ace7fa24b Mon Sep 17 00:00:00 2001 From: user Date: Fri, 20 Feb 2026 02:53:26 -0800 Subject: [PATCH 2/5] add CI workflow for make check --- .gitea/workflows/check.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .gitea/workflows/check.yml diff --git a/.gitea/workflows/check.yml b/.gitea/workflows/check.yml new file mode 100644 index 0000000..a3a860d --- /dev/null +++ b/.gitea/workflows/check.yml @@ -0,0 +1,24 @@ +name: check +on: + push: + branches: [main, next] + pull_request: + branches: [main, next] +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install golangci-lint + run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + - name: Install protoc-gen-go + run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 + - name: Generate protobuf + run: | + sudo apt-get update && sudo apt-get install -y protobuf-compiler + cd mfer && go generate . + - name: Run checks + run: make check -- 2.45.2 From b19dff2456213fdcea323a167cacf17dd16ae5fe Mon Sep 17 00:00:00 2001 From: user Date: Fri, 20 Feb 2026 02:58:26 -0800 Subject: [PATCH 3/5] security: pin CI actions to commit SHAs --- .gitea/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/check.yml b/.gitea/workflows/check.yml index a3a860d..5b55f7e 100644 --- a/.gitea/workflows/check.yml +++ b/.gitea/workflows/check.yml @@ -8,8 +8,8 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: go-version-file: go.mod - name: Install golangci-lint -- 2.45.2 From 4f7459d509c9511838d000c14f9de054a258dd82 Mon Sep 17 00:00:00 2001 From: clawbot Date: Fri, 20 Feb 2026 03:10:59 -0800 Subject: [PATCH 4/5] security: pin all go install refs to commit SHAs --- .gitea/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/check.yml b/.gitea/workflows/check.yml index 5b55f7e..3d3aba0 100644 --- a/.gitea/workflows/check.yml +++ b/.gitea/workflows/check.yml @@ -13,9 +13,9 @@ jobs: with: go-version-file: go.mod - name: Install golangci-lint - run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@5d1e709b7be35cb2025444e19de266b056b7b7ee # v2.10.1 - name: Install protoc-gen-go - run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 + run: go install google.golang.org/protobuf/cmd/protoc-gen-go@4dfe9d308b477d29e8c2b6d75abf3e78aafe3cb8 # v1.28.1 - name: Generate protobuf run: | sudo apt-get update && sudo apt-get install -y protobuf-compiler -- 2.45.2 From ae0e96eba30d075bab0a0ca0da40ae6d1b62ab37 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 20 Feb 2026 03:17:38 -0800 Subject: [PATCH 5/5] refactor: split check into check-fmt, lint, test targets make check now depends on check-fmt, lint, and test as prerequisites, each runnable independently. --- Makefile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 34e4102..53f4fb3 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ GOLDFLAGS += -X main.Version=$(VERSION) GOLDFLAGS += -X main.Gitrev=$(GITREV_BUILD) GOFLAGS := -ldflags "$(GOLDFLAGS)" -.PHONY: docker default run ci test fixme +.PHONY: docker default run ci test fixme check check-fmt lint default: fmt test @@ -51,9 +51,8 @@ fmt: mfer/mf.pb.go -prettier -w *.json -prettier -w *.md -lint: - golangci-lint run - sh -c 'test -z "$$(gofmt -l .)"' +lint: mfer/mf.pb.go + golangci-lint run ./... docker: sneak-mfer.$(ARCH).tzst.dockerimage @@ -80,11 +79,10 @@ modcache.tzst: go.mod go.sum cd $(shell go env GOMODCACHE) && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp mv $@.tmp $@ -# Run all checks (formatting, linting, tests) without modifying files -check: +# Individual check targets +check-fmt: @echo "==> Checking formatting..." @test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1) - @echo "==> Running linter..." - golangci-lint run ./... - @echo "==> Running tests..." - go test -race -timeout 30s ./... + +# Run all checks (formatting, linting, tests) without modifying files +check: check-fmt lint test -- 2.45.2