-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (66 loc) · 2.53 KB
/
Makefile
File metadata and controls
78 lines (66 loc) · 2.53 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
78
include .envrc
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
.PHONY: confirm
confirm:
@echo -n 'Are you sure? [y/N] ' && read ans && [ $${ans:-N} = y ]
# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #
## audit: tidy and vendor dependencies and format, vet and test all code
.PHONY: audit
audit: vendor
@echo 'Formatting code...'
go fmt ./...
@echo 'Vetting code...'
go vet ./...
staticcheck ./...
@echo 'Running tests...'
go test -race -vet=off ./...
## vendor: tidy and vendor dependencies
.PHONY: vendor
vendor:
@echo 'Tidying and verifying module dependencies...'
go mod tidy
go mod verify
@echo 'Vendoring dependencies...'
go mod vendor
# ==================================================================================== #
# BUILD
# ==================================================================================== #
## build/remix: build the cmd/remix application
.PHONY: build/remix
build/remix:
@echo 'Building cmd/remix...'
GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o=./bin/remix ./cmd/remix
# go build -ldflags="-w -s" -o=./bin/remix ./cmd/remix
## build/docker: build the cmd/remix docker image and push
.PHONY: build/docker
build/docker:
@echo 'Building cmd/remix...'
GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o=./bin/remix ./cmd/remix
@echo 'Building docker image...'
docker buildx build --platform linux/amd64 -t sqlpipe/remix:latest -f dockerfile . --load
@echo 'Pushing docker image...'
docker push sqlpipe/remix:latest
## test: run tests in the /test directory
.PHONY: test
test:
@echo 'Running tests in the /test directory...'
STRIPE_API_KEY=$(STRIPE_API_KEY) go test -v -count=1 ./test/...
## one-model: run the one_model_test.go test in the /test directory
.PHONY: one-model
one-model:
@echo 'Running one_model_test.go in the /test directory...'
STRIPE_API_KEY=$(STRIPE_API_KEY) go test -v -count=1 ./test/stripe_one_model_test.go
## two-models: run the two_models_test.go test in the /test directory
.PHONY: two-models
two-models:
@echo 'Running two_models_test.go in the /test directory...'
STRIPE_API_KEY=$(STRIPE_API_KEY) go test -v -count=1 ./test/stripe_two_models_test.go