diff --git a/GNUmakefile b/GNUmakefile index 65c2aaf..43efddc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,5 +1,8 @@ default: fmt lint install generate +clean: + go clean -cache -modcache -testcache + build: go build -v ./... @@ -7,6 +10,7 @@ install: build go install -v ./... lint: + go mod tidy golangci-lint run generate: @@ -15,6 +19,14 @@ generate: fmt: gofmt -s -w -e . +fmtcheck: + @if [ -n "$$(gofmt -s -l .)" ]; then \ + echo "The following files are not formatted:"; \ + gofmt -s -l .; \ + echo "Run 'make fmt' to fix formatting issues."; \ + exit 1; \ + fi + test: go test -v -cover -timeout=120s -parallel=10 ./... @@ -33,13 +45,17 @@ e2e: echo "✓ E2E test completed successfully" ci: - @echo "1/4 Running linter..." - $(MAKE) lint - @echo "2/4 Building provider..." + @echo "Running CI pipeline..." + @echo "1/5 Checking code formatting..." + $(MAKE) fmtcheck + @echo "2/5 Building provider..." $(MAKE) build - @echo "3/4 Running acceptance tests..." + @echo "3/5 Running linter..." + $(MAKE) lint + @echo "4/5 Running acceptance tests..." $(MAKE) testacc - @echo "4/4 Running end-to-end tests..." + @echo "5/5 Running end-to-end tests..." $(MAKE) e2e + @echo "✓ CI pipeline completed successfully!" -.PHONY: fmt lint test testacc build install generate e2e ci +.PHONY: fmt fmtcheck lint test testacc build install generate e2e ci clean