-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (41 loc) · 1.3 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
.DEFAULT_GOAL := test
export GO111MODULE := on
export SHELL := /bin/bash
GOPKG := github.com/veraison/psatoken
GOPKG += github.com/veraison/psatoken/encoding
GOLINT ?= golangci-lint
ifeq ($(MAKECMDGOALS),lint)
GOLINT_ARGS ?= run --timeout=3m -E dupl -E gocritic -E gosimple -E lll -E prealloc
endif
.PHONY: lint
lint: ; $(GOLINT) $(GOLINT_ARGS)
ifeq ($(MAKECMDGOALS),test)
GOTEST_ARGS ?= -v -race $(GOPKG)
else
ifeq ($(MAKECMDGOALS),test-cover)
GOTEST_ARGS ?= -short -cover $(GOPKG)
endif
endif
COVER_THRESHOLD := $(shell grep '^name: cover' .github/workflows/ci-go-cover.yml | cut -c13-)
.PHONY: test test-cover
test test-cover: ; go test $(GOTEST_ARGS)
presubmit:
@echo
@echo ">>> Check that the reported coverage figures are $(COVER_THRESHOLD)"
@echo
$(MAKE) test-cover
@echo
@echo ">>> Fix any lint error"
@echo
$(MAKE) lint
.PHONY: licenses
licenses: ; @./scripts/licenses.sh
.PHONY: help
help:
@echo "Available targets:"
@echo " * test: run unit tests for $(GOPKG)"
@echo " * test-cover: run unit tests and measure coverage for $(GOPKG)"
@echo " * licenses: check licenses of dependent packages"
@echo " * lint: lint sources using default configuration"
@echo " * presubmit: check you are ready to push your local branch to remote"
@echo " * help: print this menu"