-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
126 lines (97 loc) · 2.78 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
BINARY_NAME=s6-cli
S6_PATH := ./examples/s6-overlay/s6-rc.d
ARGS := -p $(S6_PATH)
.DEFAULT: help
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #
.PHONY: docker
docker: docker-build docker-run
.PHONY: docker-build
docker-build:
docker build -t hakindazz/s6-cli:dev-latest .
.PHONY: docker-run
docker-run:
docker run -it --rm -v ./examples/s6-overlay:/etc/s6-overlay hakindazz/s6-cli:dev-latest
## tidy: format code and tidy modfile
.PHONY: tidy
tidy:
go fmt ./...
go mod tidy -v
## audit: run quality control checks
.PHONY: audit
audit:
go mod verify
go vet ./...
go run honnef.co/go/tools/cmd/staticcheck@latest -checks=all,-ST1000,-U1000 ./...
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
go test -race -buildvcs -vet=off ./...
# ==================================================================================== #
# DEVELOPMENT
# ==================================================================================== #
.PHONY: no-dirty
no-dirty:
git diff --exit-code
.PHONY: dep
dep:
@go mod download
## build: build binary file
.PHONY: build
build:
@GOARCH=amd64 GOOS=linux go build -o ./${BINARY_NAME} -v ./cmd/s6cli
## build: build binary file
.PHONY: build-darwin
build-darwin:
@GOARCH=amd64 GOOS=darwin go build -o ./${BINARY_NAME} -v ./cmd/s6cli
## clean: clean binary file
.PHONY: clean
clean:
@go clean
@rm -f ${BINARY_NAME}
## run: run binary file with good args
.PHONY: run
run:
@go run ./cmd/s6cli $(ARGS)
## test: run all tests
.PHONY: test
test:
@go test ./...
## test-coverage: run all tests with coverage
.PHONY: test-coverage
test-coverage:
@go test -coverprofile=coverage.out -v ./...
@go tool cover -html=coverage.out
## nix: build binary file with nix
.PHONY: nix
nix:
@nix-shell --show-trace
# ==================================================================================== #
# RUN COMMANDS OF CLI WITH DEFAULT ARGS
# ==================================================================================== #
## lint: lint s6-overlay directories and files
.PHONY: lint
lint:
@go run ./cmd/s6cli $(ARGS) lint
## mermaid: generate mermaid graph
.PHONY: mermaid
mermaid:
@go run ./cmd/s6cli $(ARGS) mermaid
.PHONY: create-oneshot
create-oneshot:
go run ./cmd/s6cli $(ARGS) create oneshot test
.PHONY: create-longrun
create-longrun:
go run ./cmd/s6cli $(ARGS) create longrun test
.PHONY: create-bundle
create-bundle:
go run ./cmd/s6cli $(ARGS) create bundle test
.PHONY: remove
remove:
go run ./cmd/s6cli $(ARGS) remove test
.PHONY: re-create
re-create: remove create-oneshot