-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (51 loc) · 1.56 KB
/
Makefile
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
## ----------------------
## Available make targets
## ----------------------
##
default: help
help: ## Display this message
@grep -E '(^[a-zA-Z0-9_\-\.]+:.*?##.*$$)|(^##)' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
##
## ----------------------
## Builds
## ----------------------
##
artifact: ## Generate binary in dist folder
goreleaser build --clean --snapshot --single-target
image-ci: ## Build an image for CI Test Helm
docker build . --tag "ghcr.io/radiofrance/image-registry-metrics-exporter:ci"
##
## ----------------------
## Q.A
## ----------------------
##
qa: lint test ## Run all Q.A
lint.install: ## Install Go linter
go install github.com/golangci/golangci-lint/cmd/golangci-lint
lint: ## Lint source code
golangci-lint run -v
lint.fix: ## Lint and fix source code
golangci-lint run --fix -v
PKG := "./..."
RUN := ".*"
RED := $(shell tput setaf 1)
GREEN := $(shell tput setaf 2)
BLUE := $(shell tput setaf 4)
RESET := $(shell tput sgr0)
.PHONY: test
test: ## Run tests
@go test -v -race -failfast -coverprofile coverage.output -run $(RUN) $(PKG) | \
sed 's/RUN/$(BLUE)RUN$(RESET)/g' | \
sed 's/CONT/$(BLUE)CONT$(RESET)/g' | \
sed 's/PAUSE/$(BLUE)PAUSE$(RESET)/g' | \
sed 's/PASS/$(GREEN)PASS$(RESET)/g' | \
sed 's/FAIL/$(RED)FAIL$(RESET)/g'
##
## ----------------------
## Development
## ----------------------
##
install: ## Install required goland dependencies
go mod download
start: ## Start project
go run ./cmd/image-registry-metrics-exporter