-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (37 loc) · 1.7 KB
/
Makefile
File metadata and controls
50 lines (37 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# SPDX-License-Identifier: LGPL-3.0-or-later
CMD := ./cmd/sind
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
BINARY := sind-$(GOOS)-$(GOARCH)
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT)
CGO_ENABLED ?= 0
GOBUILD ?= go build
GOTEST ?= go test
.PHONY: build install lint lint-docs test test-integration coverage image clean help
build: ## Build the sind binary
CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags='$(LDFLAGS)' -o $(BINARY) $(CMD)
install: ## Install sind to GOPATH/bin
CGO_ENABLED=$(CGO_ENABLED) go install -trimpath -ldflags='$(LDFLAGS)' $(CMD)
lint: ## Run golangci-lint
golangci-lint run
lint-docs: ## Lint documentation markdown files
npx markdownlint-cli2 "docs/content/**/*.md"
test: ## Run unit tests
$(GOTEST) -race ./...
test-integration: ## Run integration tests (requires Docker)
$(GOTEST) -race -tags integration ./...
coverage: ## Generate HTML coverage report
go test -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
check-coverage: ## Check coverage thresholds (requires go-test-coverage)
go test -race -coverprofile=coverage.out ./...
go-test-coverage --config .testcoverage.yml
image: ## Build the container image via docker buildx bake
docker buildx bake
clean: ## Remove build artifacts
rm -f sind-* coverage.out coverage.html
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " %-20s %s\n", $$1, $$2}'