-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (51 loc) · 1.89 KB
/
Copy pathMakefile
File metadata and controls
66 lines (51 loc) · 1.89 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Makefile for oidc-cli
BINARY := oidc-cli
PKG := ./...
COVERAGE_OUT := coverage.out
COVERAGE_HTML := coverage.html
ACCEPTANCE_BIN := tmp/oidc-cli-acceptance
.DEFAULT_GOAL := help
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
.PHONY: build
build: ## Build the oidc-cli binary
go build -v -o $(BINARY) .
.PHONY: test
test: ## Run tests
go test $(PKG)
.PHONY: test-race
test-race: ## Run tests with the race detector
go test -race -count=1 $(PKG)
.PHONY: lint
lint: ## Run golangci-lint
golangci-lint run
.PHONY: tidy
tidy: ## Tidy go.mod and go.sum
go mod tidy
.PHONY: coverage
coverage: ## Run tests with coverage; print total % and write an HTML report
go test -race -covermode=atomic -coverprofile=$(COVERAGE_OUT) $(PKG)
@go tool cover -func=$(COVERAGE_OUT) | tail -n 1
@go tool cover -html=$(COVERAGE_OUT) -o $(COVERAGE_HTML)
.PHONY: acceptance
acceptance: ## Run CLI acceptance tests
@mkdir -p $(dir $(ACCEPTANCE_BIN))
go build -v -o $(ACCEPTANCE_BIN) .
OIDC_CLI_BIN=$$(pwd)/$(ACCEPTANCE_BIN) go test -tags=acceptance ./test/acceptance
.PHONY: ci
ci: tidy lint coverage acceptance ## Run the full local gate (tidy + lint + coverage + acceptance)
@echo "ci: ok"
.PHONY: clean
clean: ## Remove build and coverage artifacts and the test cache
rm -f $(BINARY) $(ACCEPTANCE_BIN) $(COVERAGE_OUT) $(COVERAGE_HTML)
go clean -testcache
.PHONY: lint-clean
lint-clean: ## Purge the golangci-lint cache
golangci-lint cache clean
.PHONY: realclean
realclean: clean lint-clean ## Run clean, purge the lint cache, and purge the Go build cache
go clean -cache
# fmt / fmt-check (golangci-lint fmt / --diff) are intentionally omitted for
# now: they require a formatters (gofumpt/goimports) block in .golangci.yaml,
# which is tracked as separate work. Add them once that configuration lands.