-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
99 lines (70 loc) · 2.02 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
.DEFAULT_GOAL := build
BINARY_NAME=song-stitch
mod:
go mod tidy
go mod vendor
go mod verify
go-update:
go list -mod=readonly -m -f '{{if not .Indirect}}{{if not .Main}}{{.Path}}{{end}}{{end}}' all | xargs go get -u
$(MAKE) mod
hadolint:
@printf "%s\n" "==== Running hadolint ====="
hadolint Dockerfile
lint-prettier:
@printf "%s\n" "==== Running prettier lint check ====="
prettier -c .
format-prettier:
@printf "%s\n" "==== Running prettier format ====="
prettier -w .
typos:
@printf "%s\n" "==== Running typos ====="
typos
format-go:
@printf "%s\n" "==== Running go-fmt ====="
gofmt -s -w cmd/ internal/
go-staticcheck:
# https://github.com/dominikh/go-tools
staticcheck ./...
golines-format:
@printf "%s\n" "==== Running golines ====="
golines --write-output --ignored-dirs=vendor .
format-npm:
@printf "%s\n" "==== Running npm format ====="
(cd ui && npm run format)
lint: lint-prettier hadolint go-staticcheck
format: format-go golines-format format-npm format-prettier
format-lint: format lint
build-ui:
(cd ui && npm install && npm run build)
run: build-ui
go run cmd/*.go
watch: build-ui
gow run cmd/*.go
watch-ui: build-ui
(cd ui && npm run watch)
run-debug:
GODEBUG=gctrace=1 go run cmd/*.go
build: format-lint
go build -o bin/${BINARY_NAME} cmd/*.go
darwin:
env GOOS=darwin GOARCH=arm64 go build -o bin/${BINARY_NAME}_darwin_arm64 cmd/*.go
env GOOS=darwin GOARCH=amd64 go build -o bin/${BINARY_NAME}_darwin_amd64 cmd/*.go
lipo -create -output bin/${BINARY_NAME}_darwin bin/${BINARY_NAME}_darwin_arm64 bin/${BINARY_NAME}_darwin_amd64
linux-arm64:
env GOOS=linux GOARCH=arm64 go build -o bin/${BINARY_NAME}_linux_arm64 cmd/*.go
linux-amd64:
env GOOS=linux GOARCH=amd64 go build -o bin/${BINARY_NAME}_linux_amd64 cmd/*.go
docker-build: format-lint
docker-compose build song-stitch
docker-run:
docker-compose up
clean:
rm -rf bin/*
gosec:
gosec -severity medium ./...
test:
go clean -testcache
go test -v ./tests
all: darwin linux-arm64 linux-amd64
deploy-dev:
flyctl deploy -c fly.dev.toml