-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (45 loc) · 1.4 KB
/
Copy pathMakefile
File metadata and controls
57 lines (45 loc) · 1.4 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
.DEFAULT_GOAL := help
ifneq (,$(wildcard ./.env))
include .env
export
endif
TIMEOUT ?= 120m
GOMAXPROCS ?= 5
TESTARGS ?= ./...
COVEROUT ?= .coverage/coverage.out
TESTRESULTS ?= test-results.xml
.PHONY: build
build: ## build program
go build cmd/azdo/azdo.go
.PHONY: dist
dist: ## create new release
goreleaser release --clean --skip publish
.PHONY: clean
clean: ## clean repositorty
rm -f azdo
rm -rf dist .coverage test-results.xml
.PHONY: fmt
fmt: ## format source with gofumpt
gofumpt -w ./internal ./cmd
.PHONY: lint
lint: ## lint source
@echo "Check for golangci-lint"; [ -e "$(shell which golangci-lint)" ]
@echo "Executing golangci-lint"; golangci-lint run -v --timeout $(TIMEOUT) ./internal/...
.PHONY: test
test: ## run unit tests with gotestsum
mkdir -p $(dir $(COVEROUT)) \
&& gotestsum --format testname --junitfile $(TESTRESULTS) -- -timeout=$(TIMEOUT) -coverprofile=$(COVEROUT) $(TESTARGS)
.PHONY: tidy
tidy: ## call go mod tidy on all existing go.mod files
find . -name go.mod -execdir go mod tidy \;
.PHONY: docs
docs: ## create documentation
go run cmd/gen-docs/gen-docs.go --doc-path ./docs --website
.PHONY: generate-mocks
generate-mocks: ## regenerate Go mocks (requires mockgen)
bash scripts/generate_mocks.sh
.PHONY: help
help:
@grep '^[^#.][A-Za-z._/]\+:\s\+.*#' Makefile | \
sed "s/\(.\+\):\s*\(.*\) #\s*\(.*\)/`printf "\033[93m"`\1`printf "\033[0m"` \3 [\2]/" | \
expand -t30