-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
81 lines (60 loc) · 2.32 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
export GO111MODULE=on
MAIN_PKG=./cmd/clockify-cli
# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
clean: ## clean all buildable files
rm -rf dist
deps-install: ## install golang dependencies
go mod download
deps-upgrade: ## upgrade go dependencies
go get -u -v $(MAIN_PKG)
go mod tidy
build: dist
dist: deps-install dist/darwin dist/linux dist/windows ## build all cli versions (default)
dist-internal:
mkdir -p dist/$(goos)
GOOS=$(goos) GOARCH=$(goarch) go build -o dist/$(goos)/clockify-cli $(MAIN_PKG)
dist/darwin:
make dist-internal goos=darwin goarch=amd64
dist/linux:
make dist-internal goos=linux goarch=amd64
dist/windows:
make dist-internal goos=windows goarch=amd64
go-install: deps-install ## install dev version
go install $(MAIN_PKG)
go-generate: deps-install ## recreates generate files
go install github.com/vektra/mockery/[email protected]
mockery
test-install: deps-install go-generate
go install gotest.tools/gotestsum@latest
test: test-install ## runs all tests
gotestsum --format dots-v2
test_coverprofile=coverage.txt
test_covermode=atomic
test-coverage: test-install ## runs all tests and output coverage
gotestsum --format dots-v2 -- \
-coverprofile=$(coverprofile) \
-covermode=$(covermode) \
./...
test-watch: test-install ## runs all tests and watch changes
gotestsum --format testname --watch -- -failfast
goreleaser-test: tag=Unreleased
goreleaser-test: release
ifeq ($(tag),Unreleased)
SNAPSHOT=1
endif
tag=
release: ## releases a tagged version
sed "/^## \[$(tag)/, /^## \[/!d" CHANGELOG.md | tail -n +2 | head -n -2 > /tmp/rn.md
curl -sL https://git.io/goreleaser | bash /dev/stdin --release-notes /tmp/rn.md \
--clean $(if $(SNAPSHOT),--snapshot --skip=publish,)
ifneq ($(SNAPSHOT),1)
curl -X POST -d '{"trigger_branch":"$(tag)","trigger_title":"Releasing $(tag)"}' https://api.netlify.com/build_hooks/5eef4f99028bddbb4093e4c6 -v
endif
site/themes/hugo-theme-learn/.git:
git submodule update --init
site-build: site/themes/hugo-theme-learn/.git ## generates command documents and builds the site
./scripts/site-build
site-serve: site-build ## builds the site, and serves it locally
cd site && hugo serve