This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (62 loc) · 1.73 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
PKG_TARGET=linux
PKG_BIN=./bin/rpasswd
PKG_TAG=$(shell git tag -l --contains HEAD)
export GO111MODULE := on
# enable consistent Go 1.12/1.13 GOPROXY behavior.
export GOPROXY = https://proxy.golang.org,https://gocenter.io,direct
#######################################
############# Development #############
#######################################
install:
@go version
@go get -v golang.org/x/lint/golint
@curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
@curl -L https://git.io/misspell | sh
@go mod download
@go mod tidy
.ONESHELL: install
watch:
@refresh run
.ONESHELL: watch
dev.release:
set -e
set -u
@goreleaser release --skip-publish --rm-dist --snapshot
.ONESHELL: dev.release
#######################################
########### Utility tasks #############
#######################################
test: lint
@go test -v -timeout 30s -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: test
coverage:
@bash -c "bash <(curl -s https://codecov.io/bash)"
.PHONY: coverage
tidy:
@go mod tidy
.PHONY: tidy
fmt:
@find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
.PHONY: fmt
lint:
@go version
@./bin/golangci-lint run --tests=false --enable-all --disable=lll --disable funlen --disable godox ./...
@./bin/misspell -error **/*
.PHONY: lint
#######################################
########## Production tasks ###########
#######################################
prod.release:
set -e
set -u
@go version
@git tag $(GIT_TAG)
@goreleaser release --rm-dist
.ONESHELL: prod.release
prod.release.ci:
set -e
set -u
@go version
@git tag $(DRONE_TAG)
@curl -sL https://git.io/goreleaser | bash
.ONESHELL: prod.release.ci