-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (63 loc) · 1.84 KB
/
Makefile
File metadata and controls
77 lines (63 loc) · 1.84 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.PHONY: clean
clean:
@rm -rf dist
@go clean -i
# Find each Go submodule from the top-level directory. Go commands only
# consider the current module, so they must run separately for every module.
submodules := $(shell find . -name 'go\.mod' -exec dirname {} \;)
.PHONY: dev
dev: fake_assets
npm run dev
.PHONY: fake_assets
fake_assets:
@echo 'Skipping asset build'
@mkdir -p dist
@echo "assets build was skipped" > dist/index.html
.PHONY: dist
dist:
@npm run build
.PHONY: build
build: dist
CGO_ENABLED=0 go build
.PHONY: docker-db/up
docker-db/up:
docker compose -f docker-compose.dev.yaml down
docker compose -f docker-compose.dev.yaml up
.PHONY: docker-db/down
docker-db/down:
docker compose -f docker-compose.dev.yaml down
# Definitions of following tasks look ugly, but they're done this way because to
# produce the best/most comprehensible output by far (e.g. compared to a shell
# loop).
.PHONY: lint
lint:: ## Run linter (golangci-lint) for all submodules
define lint-target
lint:: ; cd $1 && golangci-lint run --fix
endef
$(foreach mod,$(submodules),$(eval $(call lint-target,$(mod))))
.PHONY: test
test:: ## Run test suite for all submodules
define test-target
test:: ; cd $1 && go test ./... -timeout 2m
endef
$(foreach mod,$(submodules),$(eval $(call test-target,$(mod))))
.PHONY: test/race
test/race:: ## Run test suite for all submodules with race detector
define test-race-target
test/race:: ; cd $1 && go test ./... -race -timeout 2m
endef
$(foreach mod,$(submodules),$(eval $(call test-race-target,$(mod))))
.PHONY: tidy
tidy:: ## Run `go mod tidy` for all submodules
define tidy-target
tidy:: ; cd $1 && go mod tidy
endef
$(foreach mod,$(submodules),$(eval $(call tidy-target,$(mod))))
preview: build
npm run preview
.PHONY: verify
verify:
verify: verify/sqlc
.PHONY: verify/sqlc
verify/sqlc:
cd internal/dbsqlc && sqlc diff