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
This commit is contained in:
49
.github/workflows/ci.yml
vendored
49
.github/workflows/ci.yml
vendored
@@ -40,13 +40,11 @@ jobs:
|
|||||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||||
echo "$HOME/go/bin" >> $GITHUB_PATH
|
echo "$HOME/go/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Generate protobuf files
|
- name: Generate code
|
||||||
run: make generate-proto
|
|
||||||
|
|
||||||
- name: Generate Ent ORM files
|
|
||||||
run: |
|
run: |
|
||||||
go install entgo.io/ent/cmd/ent@latest
|
make generate-proto
|
||||||
if [ -d "ent" ] && [ -f "ent/generate.go" ]; then
|
if [ -d "ent" ] && [ -f "ent/generate.go" ]; then
|
||||||
|
go install entgo.io/ent/cmd/ent@latest
|
||||||
cd ent && go generate ./...
|
cd ent && go generate ./...
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -68,7 +66,7 @@ jobs:
|
|||||||
if: steps.check-tests.outputs.tests_exist == 'true'
|
if: steps.check-tests.outputs.tests_exist == 'true'
|
||||||
env:
|
env:
|
||||||
CGO_ENABLED: 1
|
CGO_ENABLED: 1
|
||||||
run: go test -v -race -coverprofile=coverage.out -timeout=5m ./...
|
run: make test-coverage
|
||||||
|
|
||||||
- name: Upload coverage
|
- name: Upload coverage
|
||||||
if: steps.check-tests.outputs.tests_exist == 'true'
|
if: steps.check-tests.outputs.tests_exist == 'true'
|
||||||
@@ -79,9 +77,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Verify build (no tests)
|
- name: Verify build (no tests)
|
||||||
if: steps.check-tests.outputs.tests_exist == 'false'
|
if: steps.check-tests.outputs.tests_exist == 'false'
|
||||||
run: |
|
run: make build
|
||||||
echo "No tests found. Verifying code compiles instead..."
|
|
||||||
go build ./...
|
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
@@ -105,21 +101,21 @@ jobs:
|
|||||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||||
echo "$HOME/go/bin" >> $GITHUB_PATH
|
echo "$HOME/go/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Generate protobuf files
|
- name: Generate code
|
||||||
run: make generate-proto
|
|
||||||
|
|
||||||
- name: Generate Ent ORM files
|
|
||||||
run: |
|
run: |
|
||||||
go install entgo.io/ent/cmd/ent@latest
|
make generate-proto
|
||||||
if [ -d "ent" ] && [ -f "ent/generate.go" ]; then
|
if [ -d "ent" ] && [ -f "ent/generate.go" ]; then
|
||||||
|
go install entgo.io/ent/cmd/ent@latest
|
||||||
cd ent && go generate ./...
|
cd ent && go generate ./...
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: golangci-lint
|
- name: Install golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v7
|
run: |
|
||||||
with:
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||||
version: latest
|
echo "$HOME/go/bin" >> $GITHUB_PATH
|
||||||
args: --timeout=5m
|
|
||||||
|
- name: Run linters
|
||||||
|
run: make lint
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@@ -151,13 +147,11 @@ jobs:
|
|||||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||||
echo "$HOME/go/bin" >> $GITHUB_PATH
|
echo "$HOME/go/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Generate protobuf files
|
- name: Generate code
|
||||||
run: make generate-proto
|
|
||||||
|
|
||||||
- name: Generate Ent ORM files
|
|
||||||
run: |
|
run: |
|
||||||
go install entgo.io/ent/cmd/ent@latest
|
make generate-proto
|
||||||
if [ -d "ent" ] && [ -f "ent/generate.go" ]; then
|
if [ -d "ent" ] && [ -f "ent/generate.go" ]; then
|
||||||
|
go install entgo.io/ent/cmd/ent@latest
|
||||||
cd ent && go generate ./...
|
cd ent && go generate ./...
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -190,9 +184,4 @@ jobs:
|
|||||||
go-version: '1.25.3'
|
go-version: '1.25.3'
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: |
|
run: make fmt-check
|
||||||
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
|
|
||||||
echo "The following files need formatting:"
|
|
||||||
gofmt -s -d .
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user