forked from veraison/corim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
67 lines (54 loc) · 1.68 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
67
.DEFAULT_GOAL := help
SHELL := /bin/bash
GO111MODULE := on
GOPKG := github.com/jraman567/corim/corim
GOPKG += github.com/jraman567/corim/comid
GOPKG += github.com/jraman567/corim/cots
GOPKG += github.com/jraman567/corim/encoding
GOPKG += github.com/jraman567/corim/extensions
GOLINT ?= golangci-lint
ifeq ($(MAKECMDGOALS),lint)
GOLINT_ARGS ?= run --timeout=3m
else
ifeq ($(MAKECMDGOALS),lint-extra)
GOLINT_ARGS ?= run --timeout=3m --issues-exit-code=0 -E dupl -E gocritic -E gosimple -E lll -E prealloc
endif
endif
.PHONY: lint lint-extra
lint lint-extra:
$(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)
realtest:
go test $(GOTEST_ARGS)
.PHONY: realtest
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-extra
.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 " * lint: lint sources using default configuration"
@echo " * lint-extra: lint sources using default configuration and some extra checkers"
@echo " * presubmit: check you are ready to push your local branch to remote"
@echo " * help: print this menu"
@echo " * licenses: check licenses of dependent packages"