-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
45 lines (36 loc) · 1017 Bytes
/
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
SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=
export PATH := ./bin:$(PATH)
export GO111MODULE := on
# Install all the build and lint dependencies
setup:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
curl -sfL https://install.goreleaser.com/github.com/gohugoio/hugo.sh | sh
go mod download
.PHONY: setup
# Run all the tests
test:
go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
.PHONY: test
# Run all the tests and opens the coverage report
cover: test
go tool cover -html=coverage.txt
.PHONY: cover
# gofmt and goimports all go files
fmt:
gofmt -w -s $(SOURCE_FILES)
goimports -w $(SOURCE_FILES)
.PHONY: fmt
# Run all the linters
lint:
./bin/golangci-lint run --tests=false --enable-all ./...
.PHONY: lint
# Run all the tests and code checks
ci: lint test
.PHONY: ci
# Build a beta version of releaser
build:
go build
.PHONY: build
.DEFAULT_GOAL := build