This repository has been archived by the owner on Apr 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
62 lines (49 loc) · 1.67 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
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)
LDFLAGS=-ldflags "-w -s -X github.com/chanzuckerberg/bff/util.GitSha=${SHA} -X github.com/chanzuckerberg/bff/util.Version=${VERSION} -X github.com/chanzuckerberg/bff/util.Dirty=${DIRTY}"
export GO111MODULE=on
all: test
.PHONY: all
setup: ## setup development dependencies
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.39.0
curl -sSfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
.PHONY: setup
lint: setup ## run the fast go linters
./bin/golangci-lint run
.PHONY: lint
release: build ## run a release
./bff bump
git push
./bin/goreleaser release --rm-dist
.PHONY: release
release-snapshot: ## run a release
./bin/goreleaser release --rm-dist --snapshot
.PHONY: release-snapshot
build: deps ## build the binary
go build ${LDFLAGS} .
.PHONY: build
coverage: ## run the go coverage tool, reading file coverage.txt
go tool cover -html=coverage.txt
.PHONY: coverage
deps:
go mod tidy
.PHONY: deps
test: deps ## run the tests
go test -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: test
install: deps ## install the bff 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 bff 2>/dev/null || true
go clean
rm -rf dist
.PHONY: clean
check-mod:
go mod tidy
git diff --exit-code -- go.mod go.sum
.PHONY: check-mod