-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (46 loc) · 1.82 KB
/
Copy pathMakefile
File metadata and controls
59 lines (46 loc) · 1.82 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
# Make this makefile self-documented with target `help`
.PHONY: help
.DEFAULT_GOAL := help
help: ## Show help
@grep -Eh '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: fmt
fmt: ## Format go files
golangci-lint fmt --verbose
.PHONY: lint
lint: ## Lint go files
golangci-lint run --verbose
.PHONY: lint-fix
lint-fix: ## Lint go files and apply auto-fixes
golangci-lint run --verbose --fix
.PHONY: test
test: ## Run tests
go test -v -failfast -race -timeout 10m ./...
.PHONY: generate
generate: ## Generate the OpenAPI operation catalog from the pinned SDK
go generate ./internal/apicommands
CODESAMPLES_OUT ?= code-samples.json
.PHONY: generate-codesamples
generate-codesamples: ## Generate CLI code samples for the developer portal
go run ./internal/cmd/generate-samples --cli-version "$(VERSION)" --out "$(CODESAMPLES_OUT)"
.PHONY: vulncheck
vulncheck: ## Check for Vulnerabilities (make sure you have the tools install: `make install-tools`)
govulncheck ./...
.PHONY: vulncheck-sarif
vulncheck-sarif: ## Check for Vulnerabilities
govulncheck -format=sarif ./... > govulncheck.sarif
.PHONY: install-tools
install-tools: # Install development dependencies
go install golang.org/x/vuln/cmd/govulncheck@latest
VERSION ?= dev
COMMIT ?= $(shell git rev-parse --short HEAD)
DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS := -s -w \
-X github.com/sumup/sumup-cli/internal/buildinfo.Version=$(VERSION) \
-X github.com/sumup/sumup-cli/internal/buildinfo.Commit=$(COMMIT) \
-X github.com/sumup/sumup-cli/internal/buildinfo.Date=$(DATE)
.PHONY: build
build: ## Build CLI binary with build metadata
go build -ldflags "$(LDFLAGS)" -o ./bin/sumup ./cmd/sumup
.PHONY: install
install: ## Install CLI binary
go install -ldflags "$(LDFLAGS)" ./cmd/sumup/...