-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (39 loc) · 1.06 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
export GO111MODULE=on
export GOSUMDB=off
IMAGE_TAG := $(shell git rev-parse HEAD)
SHELL=/bin/bash
DOCKER_COMPOSE = docker-compose -f docker-compose.yml
.PHONY: ci
ci: mockgen lint test_unit test_integration build
.PHONY: deps
deps:
go mod download
go mod vendor
.PHONY: build
build:
CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -o artifacts/svc .
.PHONY: mockgen
mockgen:
mockgen -source=service/service.go -destination=service/mock/deps.go -package=mock
.PHONY: lint
lint:
golangci-lint run
.PHONY: test_unit
test_unit:
go test -cover -v `go list ./...`
.PHONY: test_integration
test_integration:
INTEGRATION_TEST=YES go test -cover -v `go list ./...`
.PHONY: dockerise
dockerise:
docker build -t "image-resizer:${IMAGE_TAG}" .
.PHONY: docker-up
docker-up:
$(DOCKER_COMPOSE) down --volumes --remove-orphans
$(DOCKER_COMPOSE) rm --force --stop -v
IMAGE_TAG=${IMAGE_TAG} \
$(DOCKER_COMPOSE) up -d --force-recreate --remove-orphans --build
.PHONY: docker-down
docker-down:
$(DOCKER_COMPOSE) down --volumes --remove-orphans
$(DOCKER_COMPOSE) rm --force --stop -v