-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
51 lines (40 loc) · 1.1 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
ifndef $(GOPATH)
GOPATH=$(shell go env GOPATH)
export GOPATH
endif
# Migration Tools
MIGRATE_VERSION ?=v4.10.0
# Option:
# - darwin(Mac OS)
# - linux (choose this as the default since most of our server run on linux)
# - windows
MIGRATE_PLATFORM ?=linux
.PHONY: init
init: init-env
.PHONY: init-env
init-env:
.PHONY: init-test
init-test: init
@go get -v
@go install -v github.com/jstemmer/go-junit-report
.PHONY: migrate-prepare
migrate-prepare:
@rm -rf bin
@mkdir bin
# Reference: https://github.com/golang-migrate/migrate/tree/master/cmd/migrate#download-pre-built-binary-windows-macos-or-linux
curl -L https://github.com/golang-migrate/migrate/releases/download/$(MIGRATE_VERSION)/migrate.$(MIGRATE_PLATFORM)-amd64.tar.gz | tar xvzO > ./bin/migrate
chmod +x ./bin/migrate
.PHONY: migrate-create
migrate-create:
@bin/migrate create -ext sql -dir repositories/migrations ${name}
.PHONY: test
test:
@go test -v -race --short ./...
.PHONY: e2e-test
e2e-test: init-test
@go test -v -race ./e2e 2>&1 | $(GOPATH)/bin/go-junit-report > junit.xml
.PHONY: run
run:
go run main.go
clean:
@rm -rf user.db