mattermost-push-proxy-router/Makefile
Felipe M. 357962328d
Some checks failed
CI / format (push) Successful in 1m8s
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled
CI / goreleaser-lint (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:48:50 +02:00

70 lines
2.1 KiB
Makefile

PROJECT_NAME := mattermost-push-proxy-router
CGO_ENABLED ?= 0
PORT ?= 8066
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -X main.version=$(VERSION)
GOLANGCI_LINT_VERSION := v2.12.2
.DEFAULT_GOAL := help
## help: Display this help message
.PHONY: help
help:
@echo "Available targets:"
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## / /' | sort
# ── Build ────────────────────────────────────────────────────────
## build: Build the production binary
.PHONY: build
build:
CGO_ENABLED=$(CGO_ENABLED) go build -ldflags "$(LDFLAGS)" -o $(PROJECT_NAME) .
## build-snapshot: Build all platforms locally via goreleaser (snapshot)
.PHONY: build-snapshot
build-snapshot:
goreleaser build --snapshot --clean
# ── Development ──────────────────────────────────────────────────
## dev: Run the router locally
.PHONY: dev
dev:
go run .
## serve: Build and run the production server
.PHONY: serve
serve: build
./$(PROJECT_NAME)
# ── Quality ──────────────────────────────────────────────────────
## test: Run unit tests
.PHONY: test
test:
go test ./...
## format: Format code and tidy modules
.PHONY: format
format:
go fmt ./...
go mod tidy
## ci-lint: Run linter (auto-installs golangci-lint for CI)
.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
# ── Cleanup ──────────────────────────────────────────────────────
## clean: Remove build artifacts
.PHONY: clean
clean:
rm -f $(PROJECT_NAME) $(PROJECT_NAME)-*
rm -rf dist/