forked from robinjoseph08/redisqueue
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
73 lines (58 loc) · 1.66 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
BIN_DIR ?= ./bin
GO_TOOLS := \
github.com/git-chglog/git-chglog/cmd/git-chglog \
github.com/mattn/goveralls \
TFLAGS ?=
COVERAGE_PROFILE ?= coverage.out
HTML_OUTPUT ?= coverage.html
PSQL := $(shell command -v psql 2> /dev/null)
TEST_DATABASE_USER ?= go_pg_migrations_user
TEST_DATABASE_NAME ?= go_pg_migrations
default: install
.PHONY: clean
clean:
@echo "---> Cleaning"
go clean
coveralls:
@echo "---> Sending coverage info to Coveralls"
$(BIN_DIR)/goveralls -coverprofile=$(COVERAGE_PROFILE) -service=travis-ci
.PHONY: enforce
enforce:
@echo "---> Enforcing coverage"
./scripts/coverage.sh $(COVERAGE_PROFILE)
.PHONY: html
html:
@echo "---> Generating HTML coverage report"
go tool cover -html $(COVERAGE_PROFILE) -o $(HTML_OUTPUT)
open $(HTML_OUTPUT)
.PHONY: install
install:
@echo "---> Installing dependencies"
go mod download
.PHONY: lint
lint: $(BIN_DIR)/golangci-lint
@echo "---> Linting"
$(BIN_DIR)/golangci-lint run
.PHONY: release
release:
@echo "---> Creating new release"
ifndef tag
$(error tag must be specified)
endif
$(BIN_DIR)/git-chglog --output CHANGELOG.md --next-tag $(tag)
sed -i "" "s/version-.*-green/version-$(tag)-green/" README.md
git add CHANGELOG.md README.md
git commit -m $(tag)
git tag $(tag)
git push origin master --tags
.PHONY: setup
setup: $(BIN_DIR)/golangci-lint
@echo "--> Setting up"
GOBIN=$(PWD)/$(subst ./,,$(BIN_DIR)) go install $(GO_TOOLS)
$(BIN_DIR)/golangci-lint:
@echo "--> Installing linter"
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(BIN_DIR) v1.27.0
.PHONY: test
test:
@echo "---> Testing"
go test ./... -coverprofile $(COVERAGE_PROFILE) $(TFLAGS)