This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (70 loc) · 2.36 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
SHA=$(shell git rev-parse --short HEAD)
VERSION=$(shell cat VERSION)
DIRTY=$(shell if `git diff-index --quiet HEAD --`; then echo false; else echo true; fi)
# TODO add release flag
LDFLAGS=-ldflags "-w -s -X github.com/chanzuckerberg/reaper/cmd.GitSha=${SHA} -X github.com/chanzuckerberg/reaper/cmd.Version=${VERSION} -X github.com/chanzuckerberg/reaper/cmd.Dirty=${DIRTY}"
export GO111MODULE=on
all: test install
.PHONY:all
setup: ## setup development endencies
curl -L https://raw.githubusercontent.com/chanzuckerberg/bff/main/download.sh | sh
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh
.PHONY: setup
lint: ## run the fast go linters
gometalinter --fast ./...
.PHONY: lint
lint-slow: ## run all linters, even the slow ones
gometalinter --deadline 120s ./...
.PHONY:lint-slow
lint-ci: ## run the fast go linters
./bin/reviewdog -conf .reviewdog.yml -reporter=github-pr-review
.PHONY: lint-ci
release: ## run a release
./bin/bff bump
git push
goreleaser release
.PHONY: release
release-prerelease: build ## release to github as a 'pre-release'
version=`./reaper version`; \
git tag v"$$version"; \
git push
git push --tags
goreleaser release -f .goreleaser.prerelease.yml --debug
.PHONY: release-prerelease
release-snapshot: ## run a release
goreleaser release --snapshot
.PHONY: release-snapshot
build: deps ## build the binary
go build ${LDFLAGS} .
.PHONY: build
coverage: ## run the go coverage tool, reading file coverage.out
go tool cover -html=coverage.out
.PHONY: coverage
test: deps ## run the tests
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: test
test-ci: ## run the tests
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: test
deps:
go mod tidy
.PHONY: deps
install: deps ## install the reaper binary in $GOPATH/bin
go install ${LDFLAGS} .
.PHONY: install
help: ## display help for this makefile
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help
clean: ## clean the repo
rm reaper 2>/dev/null || true
go clean
rm -rf dist
.PHONY: clean
docker: ## build docker image
docker build .
.PHONY: docker
check-mod:
go mod tidy
git diff --exit-code -- go.mod go.sum
.PHONY: check-mod