-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (32 loc) · 996 Bytes
/
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
.PHONY: gen build
BINARY_NAME ?= url_shortener
BINARY_PATH ?= bin
COVERAGE_FILE ?= coverage.txt
PORT=8080
check:
go vet ./...
golangci-lint run
gen_mocks:
minimock -g -i ./service/database.* -o ./service/database -s _mock.go
minimock -g -i ./service/domain.* -o ./service/domain -s _mock.go
precompile:
go build ./...
compile:
go build -o bin/binary cmd/${BINARY_NAME}/main.go
compile_linux:
GOOS=linux GOARCH=amd64 go build -v -o bin/binary cmd/${BINARY_NAME}/main.go
short_test:
go test -v -short -race -coverprofile=${COVERAGE_FILE} -covermode=atomic ./...
test:
go test -v -race -coverprofile=${COVERAGE_FILE} -covermode=atomic ./...
test_local:
set -o allexport && source .env && \
export DB_HOST=127.0.0.1 && \
go test -v -race -coverprofile=${COVERAGE_FILE} -covermode=atomic ./...
docker: compile_linux
docker build --no-cache -t ${BINARY_NAME} .
docker-compose: docker
docker-compose up -d db
sleep 3
docker-compose up db_migrator
docker-compose up service