-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (33 loc) · 1.75 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
DOCKER_COMPOSE_FILENAME=deployments/docker-compose/docker-compose.yaml
start: vendor-install
docker compose -f ${DOCKER_COMPOSE_FILENAME} up -d
start-from-scratch: stop
docker compose --file ${DOCKER_COMPOSE_FILENAME} up --remove-orphans --renew-anon-volumes --force-recreate --build -d
stop:
docker compose -f ${DOCKER_COMPOSE_FILENAME} down
restart: stop start
logs-api:
docker compose -f ${DOCKER_COMPOSE_FILENAME} logs -f api
logs-verifier:
docker compose -f ${DOCKER_COMPOSE_FILENAME} logs -f verifier
test-unit: vendor-install
docker run -v $(shell pwd):/app -w /app golang:1.20.0 /bin/bash \
-c 'go test -covermode=count -coverprofile=assets/coverage/unit/coverage.out -v ./internal/... && go tool cover -html=assets/coverage/unit/coverage.out -o=assets/coverage/unit/coverage.html'
test-integration-api: start
if ! docker compose -f ${DOCKER_COMPOSE_FILENAME} run test-integration-api; then \
echo "\nLogs for api from docker-compose:" ;\
docker compose -f ${DOCKER_COMPOSE_FILENAME} logs api; \
echo "\nServices status:" ;\
docker compose -f ${DOCKER_COMPOSE_FILENAME} ps ;\
exit 255 ;\
fi
lint-golangci: vendor-install
docker run --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v1.55.1 \
golangci-lint run --timeout 5m30s -v
lint-architecture:
docker run --rm -v $(shell pwd):/app -w /app golang:1.20.0 /bin/bash \
-c "go install github.com/fdaines/[email protected] && arch-go -v"
generate-go:
docker run --rm -v $(shell pwd):/app -w /app golang:1.20.0 /bin/bash -c 'go install go.uber.org/mock/[email protected] && go generate ./...'
vendor-install:
@if [ -d "vendor" ]; then echo "Vendor folder already exists. Skip vendor installing."; else docker run --rm -v $(shell pwd):/app -w /app golang:1.20.0 /bin/bash -c "go mod tidy && go mod vendor"; fi