From 54b29cd6a0eb799c9a0def425fea7ec6fa8fd879 Mon Sep 17 00:00:00 2001 From: 0x1d Date: Thu, 6 Nov 2025 22:42:17 +0100 Subject: [PATCH] Update CI to use Makefile commands - Use 'make test-coverage' instead of direct go test command - Use 'make build' for build verification - Use 'make lint' instead of golangci-lint-action - Use 'make fmt-check' for format checking - Combine code generation steps into single 'Generate code' step - All CI jobs now use Makefile commands for consistency and maintainability --- .github/workflows/ci.yml | 49 ++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d03cf9e..e985ac7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,13 +40,11 @@ jobs: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest echo "$HOME/go/bin" >> $GITHUB_PATH - - name: Generate protobuf files - run: make generate-proto - - - name: Generate Ent ORM files + - name: Generate code run: | - go install entgo.io/ent/cmd/ent@latest + make generate-proto if [ -d "ent" ] && [ -f "ent/generate.go" ]; then + go install entgo.io/ent/cmd/ent@latest cd ent && go generate ./... fi @@ -68,7 +66,7 @@ jobs: if: steps.check-tests.outputs.tests_exist == 'true' env: CGO_ENABLED: 1 - run: go test -v -race -coverprofile=coverage.out -timeout=5m ./... + run: make test-coverage - name: Upload coverage if: steps.check-tests.outputs.tests_exist == 'true' @@ -79,9 +77,7 @@ jobs: - name: Verify build (no tests) if: steps.check-tests.outputs.tests_exist == 'false' - run: | - echo "No tests found. Verifying code compiles instead..." - go build ./... + run: make build lint: name: Lint @@ -105,21 +101,21 @@ jobs: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest echo "$HOME/go/bin" >> $GITHUB_PATH - - name: Generate protobuf files - run: make generate-proto - - - name: Generate Ent ORM files + - name: Generate code run: | - go install entgo.io/ent/cmd/ent@latest + make generate-proto if [ -d "ent" ] && [ -f "ent/generate.go" ]; then + go install entgo.io/ent/cmd/ent@latest cd ent && go generate ./... fi - - name: golangci-lint - uses: golangci/golangci-lint-action@v7 - with: - version: latest - args: --timeout=5m + - name: Install golangci-lint + run: | + go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + echo "$HOME/go/bin" >> $GITHUB_PATH + + - name: Run linters + run: make lint build: name: Build @@ -151,13 +147,11 @@ jobs: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest echo "$HOME/go/bin" >> $GITHUB_PATH - - name: Generate protobuf files - run: make generate-proto - - - name: Generate Ent ORM files + - name: Generate code run: | - go install entgo.io/ent/cmd/ent@latest + make generate-proto if [ -d "ent" ] && [ -f "ent/generate.go" ]; then + go install entgo.io/ent/cmd/ent@latest cd ent && go generate ./... fi @@ -190,9 +184,4 @@ jobs: go-version: '1.25.3' - name: Check formatting - run: | - if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then - echo "The following files need formatting:" - gofmt -s -d . - exit 1 - fi + run: make fmt-check