-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (48 loc) · 1.39 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
SHELL := bash
.SHELLFLAGS := -O globstar -e -u -o pipefail -c
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
GOFLAGS := -buildvcs=false -buildmode=pie -mod=readonly -trimpath
# -ldflags="-w -s"
###
.PHONY: dev build fmt lint test clean outdated upgrade
build:
cd ui && make build
CGO_ENABLED=0 go build $(GOFLAGS) -o _build/ ./cmd/...
dev:
make --jobs=2 _dev_ui _dev_server
_dev_ui:
cd ui && make dev
_dev_server:
go run -tags=dev -race ./cmd/feedbox server 2>&1 | \
jq -R '. as $$line | try fromjson catch $$line'
fmt:
gopls format -w **/*.go
gofumpt -w .
lint:
golangci-lint run
test:
ENV=test TZ=UTC go test -race ./internal/util
ENV=test TZ=UTC go test -race ./internal/database/...
ENV=test TZ=UTC go test -race ./server
clean:
# rm -rf ./**/.snapshots
go clean -testcache
-rm -rf ./_build
# outdated:
# go list -u -m -f '{{if not .Indirect}}{{.}}{{end}}' all
upgrade:
go get -v -t -u ./...
go mod tidy -v
###
.PHONY: test_update migrate
test_update:
-ENV=test TZ=UTC UPDATE_SNAPSHOTS=true go test ./internal/util
-ENV=test TZ=UTC UPDATE_SNAPSHOTS=true go test ./internal/database/sqlite
-ENV=test TZ=UTC UPDATE_SNAPSHOTS=true go test ./server
# coverage:
# ENV=test go test -cover -coverprofile=./_build/cover.out ./...
# go tool cover -html=./_build/cover.out
migrate: build
./_build/feedbox migrate up