-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (49 loc) · 1.49 KB
/
Copy pathMakefile
File metadata and controls
63 lines (49 loc) · 1.49 KB
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
GO_META_MOD := github.com/avakarev/go-util/buildmeta
LDFLAGS += -s -w
LDFLAGS += -X ${GO_META_MOD}.Commit=${GITHUB_SHA}
LDFLAGS += -X ${GO_META_MOD}.Ref=${GITHUB_REF}
LDFLAGS += -X ${GO_META_MOD}.BuildTimeUTC=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
ifdef CGO_ENABLED
LDFLAGS += -linkmode external
LDFLAGS += -extldflags "-static"
export CGO_CFLAGS = "-D_LARGEFILE64_SOURCE" # https://github.com/mattn/go-sqlite3/issues/1164
endif
ifneq (,$(wildcard .env))
include .env
endif
lint:
@echo ">> Running revive..."
@revive -config .revive.toml -formatter friendly ./...
@echo ">> Running staticcheck..."
@staticcheck ./...
vet:
@echo ">> Vetting..."
@go vet ./...
sec:
@echo ">> Auditing..."
@gosec -quiet -tests ./...
test:
@echo ">> Running tests..."
@go test -v -race ./...
.PHONY: test
setup-ci:
@go install github.com/mgechev/revive@latest
@go install github.com/securego/gosec/v2/cmd/gosec@latest
@go install honnef.co/go/tools/cmd/staticcheck@latest
ci: lint vet sec test
build:
@echo ">> Building ./bin/server..."
@go build -a -ldflags '${LDFLAGS}' -tags 'sqlite_json' -o ./bin/server ./cmd/server
server-run: build
@while [ ! -f ./ui/dist/index.html ]; do sleep 0.2; done
@./bin/server
ui-clean:
@echo "deleting ./ui/dist"
@rm -rf ./ui/dist
ui-run:
@npm install --prefix ./ui
@npm run --prefix ./ui watch
dev: ui-clean
@go install github.com/mattn/goreman@latest
@echo "running Procfile by goreman $$(goreman version)"
@goreman -exit-on-error=true -rpc-server=false -set-ports=false start