Makefile

 1all: build
 2
 3UNAME_S := $(shell uname -s)
 4XARGS:=xargs -r
 5ifeq ($(UNAME_S),Darwin)
 6    XARGS:=xargs
 7endif
 8
 9COMMANDS_PATH:=github.com/MichaelMure/git-bug/commands
10
11.PHONY: build
12build:
13	go generate
14	go build .
15
16# produce a build debugger friendly
17.PHONY: debug-build
18debug-build:
19	go generate
20	go build -gcflags=all="-N -l" .
21
22.PHONY: install
23install:
24	go generate
25	go install .
26
27.PHONY: releases
28releases:
29	go generate
30	go run github.com/mitchellh/gox@v1.0.1 -osarch '!darwin/386' -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}"
31
32secure: secure-practices secure-vulnerabilities
33
34.PHONY: secure-practices
35secure-practices:
36# TODO: change pinned version of GoKart to "latest" once PR #84 is merged
37#       https://github.com/praetorian-inc/gokart/pull/84
38# go install github.com/praetorian-inc/gokart@latest
39	go install github.com/selesy/gokart-pre
40	gokart scan
41
42.PHONY: secure-vulnerabilities
43secure-vulnerabilities:
44	go install golang.org/x/vuln/cmd/govulncheck
45	govulncheck ./... 
46
47.PHONY: test
48test:
49	go test -v -bench=. ./...
50
51.PHONY: pack-webui
52pack-webui:
53	npm run --prefix webui build
54	go run webui/pack_webui.go
55
56# produce a build that will fetch the web UI from the filesystem instead of from the binary
57.PHONY: debug-webui
58debug-webui:
59	go build -tags=debugwebui
60
61.PHONY: clean-local-bugs
62clean-local-bugs:
63	git for-each-ref refs/bugs/ | cut -f 2 | $(XARGS) -n 1 git update-ref -d
64	git for-each-ref refs/remotes/origin/bugs/ | cut -f 2 | $(XARGS) -n 1 git update-ref -d
65	rm -f .git/git-bug/bug-cache
66
67.PHONY: clean-remote-bugs
68clean-remote-bugs:
69	git ls-remote origin "refs/bugs/*" | cut -f 2 | $(XARGS) git push origin -d
70
71.PHONY: clean-local-identities
72clean-local-identities:
73	git for-each-ref refs/identities/ | cut -f 2 | $(XARGS) -n 1 git update-ref -d
74	git for-each-ref refs/remotes/origin/identities/ | cut -f 2 | $(XARGS) -n 1 git update-ref -d
75	rm -f .git/git-bug/identity-cache
76
77.PHONY: clean-local-identities
78clean-remote-identities:
79	git ls-remote origin "refs/identities/*" | cut -f 2 | $(XARGS) git push origin -d