-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (60 loc) · 2.12 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
# ==================================================================================== #
# BUILD VARIABLES
# ==================================================================================== #
GOOS = 'linux'
GOARCH = 'amd64'
DOCKER_IMAGE_NAME = "as207414_ui"
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
# ==================================================================================== #
# DEVELOPMENT
# ==================================================================================== #
## run/ui: run the website ui
.PHONY: run/ui
run/ui:
@go run ./cmd/ui
## run/ui/docker: run the website ui from docker image
.PHONY: run/ui/docker
run/ui/docker:
@docker run --rm -p 4000:4000 -it ${DOCKER_IMAGE_NAME}
# ==================================================================================== #
# BUILD
# ==================================================================================== #
## build/ui: build the cmd/ui application
.PHONY: build/ui
build/ui:
@echo 'Building for ${GOOS}_${GOARCH}'
@CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} scripts/build-go.sh -s ui
## build/ui/docker: build the cmd/ui docker image
.PHONY: build/ui/docker
build/ui/docker:
@echo 'Building docker image for ${GOOS}_${GOARCH} to ${DOCKER_IMAGE_NAME}'
@scripts/build-docker.sh -f ${DOCKER_IMAGE_NAME}
# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #
## tidy: tidy dependencies and format
.PHONY: tidy
tidy:
@echo 'Tidying and verifying module dependencies...'
go mod tidy
go mod verify
@echo 'Formatting code...'
go fmt ./...
## vet: vet all code
.PHONY: vet
vet:
@echo 'Vetting code...'
go vet ./...
staticcheck ./...
## test: run go tests
.PHONY: test
test:
@echo 'Running tests...'
go test -race -vet=off ./...