butterrobot/Makefile
Felipe M. 9fc6c4878c
Some checks failed
CI / format (push) Has been cancelled
CI / goreleaser-lint (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled
Give golangci-lint five minutes
CI runs on a fresh container with an empty Go build cache now, so the
first analysis compiles every dependency and runs past golangci-lint's
own one minute default. The run itself is unchanged.
2026-09-22 12:47:19 +02:00

57 lines
1.2 KiB
Makefile

PROJECT_NAME := butterrobot
CGO_ENABLED := 0
DIST_PATH := ./dist
TEST_OPTIONS := -v -failfast -race -cover
GOLANGCI_LINT_VERSION := v2.13.2
.DEFAULT_GOAL := help
## help: Display this help message
.PHONY: help
help:
@echo "Available targets:"
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## / /' | sort
## build: Build project using goreleaser (snapshot)
.PHONY: build
build:
goreleaser build --snapshot --clean
## build-docker: Build Docker image locally via goreleaser
.PHONY: build-docker
build-docker:
goreleaser release --snapshot --clean
## run: Run the server directly via go run
.PHONY: run
run:
CGO_ENABLED=$(CGO_ENABLED) go run ./cmd/$(PROJECT_NAME)
## format: Format code and tidy modules
.PHONY: format
format:
go fmt ./...
go mod tidy
## ci-lint: Run golangci-lint (installs if missing)
.PHONY: ci-lint
ci-lint:
@which golangci-lint > /dev/null 2>&1 || go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
golangci-lint run --timeout=5m ./...
## lint: Run linters
.PHONY: lint
lint: ci-lint
## test: Run tests with coverage
.PHONY: test
test:
CGO_ENABLED=1 go test $(TEST_OPTIONS) -timeout 1m ./...
## clean: Remove build artifacts
.PHONY: clean
clean:
rm -rf $(DIST_PATH)
go clean -cache