forked from twpayne/chezmoi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (49 loc) · 1.45 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
GOLANGCI_LINT_VERSION=1.28.0
.PHONY: default
default: generate run test lint format
.PHONT: generate
generate:
go generate
.PHONY: run
run:
go run . --version
.PHONY: test
test:
go test -race ./...
.PHONY: lint
lint: ensure-golangci-lint
./bin/golangci-lint run
.PHONY: format
format: ensure-gofumports
find . -name \*.go | xargs ./bin/gofumports -local github.com/twpayne/chezmoi -w
.PHONY: ensure-tools
ensure-tools: ensure-gofumports ensure-golangci-lint
.PHONY: ensure-gofumports
ensure-gofumports:
if [ ! -x bin/gofumports ] ; then \
mkdir -p bin ; \
( cd $$(mktemp -d) && go mod init tmp && GOBIN=${PWD}/bin go get mvdan.cc/gofumpt/gofumports ) ; \
fi
.PHONY: ensure-golangci-lint
ensure-golangci-lint:
if [ ! -x bin/golangci-lint ] || ( ./bin/golangci-lint --version | grep -Fqv "version ${GOLANGCI_LINT_VERSION}" ) ; then \
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- v${GOLANGCI_LINT_VERSION} ; \
fi
.PHONY: release
release:
goreleaser release \
--rm-dist \
${GORELEASER_FLAGS}
.PHONY: test-release
test-release:
goreleaser release \
--rm-dist \
--skip-publish \
--snapshot \
${GORELEASER_FLAGS}
.PHONY: update-install.sh
update-install.sh:
# FIXME install.sh is generated by godownloader, but godownloader is
# currently unmaintained and needs to be run manually:
# godownloader --repo=twpayne/chezmoi .goreleaser.yaml > assets/scripts/install.sh
# cp assets/scripts/install.sh scripts/