-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
66 lines (51 loc) · 2.01 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
SHELL = /bin/bash -o pipefail
BENCHSTAT := $(GOPATH)/bin/benchstat
BUMP_VERSION := $(GOPATH)/bin/bump_version
RELEASE := $(GOPATH)/bin/github-release
WRITE_MAILMAP := $(GOPATH)/bin/write_mailmap
UNAME = $(shell uname -s)
test:
go test ./...
ci-install:
curl -s https://packagecloud.io/install/repositories/meter/public/script.deb.sh | sudo bash
sudo apt-get -qq -o=Dpkg::Use-Pty=0 install staticcheck
ci: lint race-test
race-test: lint
go test -race ./...
lint:
go vet ./...
staticcheck ./...
bench: | $(BENCHSTAT)
go list ./... | grep -v vendor | xargs go test -benchtime=2s -bench=. -run='^$$' 2>&1 | $(BENCHSTAT) /dev/stdin
$(BUMP_VERSION):
go get -u github.com/kevinburke/bump_version
$(BENCHSTAT):
go get golang.org/x/perf/cmd/benchstat
$(RELEASE):
go get -u github.com/aktau/github-release
$(GOPATH)/bin:
mkdir -p $(GOPATH)/bin
release: race-test | $(BUMP_VERSION) $(RELEASE)
ifndef version
@echo "Please provide a version"
exit 1
endif
ifndef GITHUB_TOKEN
@echo "Please set GITHUB_TOKEN in the environment"
exit 1
endif
$(BUMP_VERSION) --version=$(version) main.go
git push origin --tags
mkdir -p releases/$(version)
GOOS=linux GOARCH=amd64 go build -o releases/$(version)/tss-linux-amd64 .
GOOS=darwin GOARCH=amd64 go build -o releases/$(version)/tss-darwin-amd64 .
GOOS=windows GOARCH=amd64 go build -o releases/$(version)/tss-windows-amd64 .
# These commands are not idempotent, so ignore failures if an upload repeats
$(RELEASE) release --user kevinburke --repo tss --tag $(version) || true
$(RELEASE) upload --user kevinburke --repo tss --tag $(version) --name tss-linux-amd64 --file releases/$(version)/tss-linux-amd64 || true
$(RELEASE) upload --user kevinburke --repo tss --tag $(version) --name tss-darwin-amd64 --file releases/$(version)/tss-darwin-amd64 || true
$(RELEASE) upload --user kevinburke --repo tss --tag $(version) --name tss-windows-amd64 --file releases/$(version)/tss-windows-amd64 || true
force: ;
AUTHORS.txt: force | $(WRITE_MAILMAP)
$(WRITE_MAILMAP) > AUTHORS.txt
authors: AUTHORS.txt