-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
90 lines (71 loc) · 2.42 KB
/
GNUmakefile
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.PHONY: fun-tests unit-tests test
GORELEASER_VERSION := 2.3.0
LINTER_VERSION := 1.58.1
PATH := $(shell pwd)/bin:$(PATH)
SHELL := bash
ARCH := $(shell uname -m)
OS := $(shell uname -s)
.ONESHELL:
.SHELLFLAGS := -ec
bash-required-version:
$(if $(filter oneshell,${.FEATURES}) \
, \
,$(error oneshell not supported - update your make))
check-bash: bash-required-version
@test $$BASH_VERSINFO = 5 || test $$BASH_VERSINFO = 4
bin: check-bash
@mkdir -p bin/
bin/golangci-lint: bin
@test -f $@ ||
(
curl -fsL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${LINTER_VERSION}
bin/golangci-lint version
)
bin/goreleaser: bin
@test -f $@ ||
(
curl -fsL https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_${OS}_${ARCH}.tar.gz -o goreleaser.tgz
tar xvf goreleaser.tgz -C bin goreleaser
rm goreleaser.tgz
bin/goreleaser --version
)
tools: bin/goreleaser bin/golangci-lint
pre-check: tools
[[ `(gofmt -l .)`x == x ]] || (echo "go fmt failed" && gofmt -l . && exit 1)
go vet ./...
golangci-lint run ./...
release-test: build
bin/vergo check increment-hint
release: release-test check-licenses test
bin/vergo check release || exit 0
bin/vergo bump auto
BUILT_BY="`goreleaser --version | head -n1`, `go version`" \
GORELEASER_CURRENT_TAG=`bin/vergo get latest-release -p` \
GORELEASER_PREVIOUS_TAG=`bin/vergo get previous-release -p` \
goreleaser release --clean
bin/vergo push
unit-tests: pre-check
go clean -testcache
go test ./...
fun-tests: build
./fun-tests/test.sh
./fun-tests/test-bump-auto.sh
./fun-tests/test-empty-repo.sh
test: build unit-tests fun-tests
test-compile:
go test --exec=true ./...
build: pre-check
BUILT_BY="`goreleaser --version | head -n1`, `go version`" \
GORELEASER_CURRENT_TAG=0+`git rev-parse --short HEAD` \
goreleaser build --snapshot --clean
@dist/vergo_`uname | tr A-Z a-z`_${ARCH}/vergo version
@cp dist/vergo_`uname | tr A-Z a-z`_${ARCH}/vergo bin/vergo
@cp dist/vergo_`uname | tr A-Z a-z`_${ARCH}/vergo /usr/local/bin/vergo 2>/dev/null || true
dependency-updates:
@go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all
go-licenses:
@go install github.com/google/go-licenses@latest
print-licenses: go-licenses
@go-licenses csv .
check-licenses: go-licenses
!(go-licenses csv . | grep -E 'GNU|AGPL|GPL|MPL|CPL|CDDL|EPL|CCBYNC|Facebook|WTFPL')