-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (42 loc) · 1.32 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
52
53
54
DOCKER_IP ?= 127.0.0.1
AWS_ENDPOINT ?= $(DOCKER_IP):4100
COVERAGE_FILE = coverage.out
COVERAGE_FILES = coverage/*.cov
-include .env
export
.PHONY: env
env:
@printenv
.PHONY: up
up:
@docker compose up -d
@./scripts/wait-for-sqs.sh 20
@docker compose exec -T postgres /scripts/wait-for-postgres.sh 30
.PHONY: down
down:
@docker compose down
.PHONY: test
test: up integration
integration:
@mkdir -p coverage
@go test -v -tags=integration -coverpkg=./... -coverprofile=./coverage/base.cov ./...
@cd aws && go test -v -tags=integration -coverpkg=./... -coverprofile=../coverage/awsv2.cov ./...
@cd schedule/storage/postgres && go test -v -tags=integration -coverpkg=./... -coverprofile=../../../coverage/postgres.cov ./...
.PHONY: clean
clean:
@rm -rf $(COVERAGE_FILES)
@rm -rf coverage.*
.PHONY: coverage
coverage: clean test coverage-merge
@cd aws && go tool cover -func=../$(COVERAGE_FILE)
.PHONY: coverage-ci
coverage-ci: integration coverage-merge
@cd aws && go tool cover -func=../$(COVERAGE_FILE)
.PHONY: coverage-html
coverage-html: clean test coverage-merge
@cd aws && go tool cover -html=../$(COVERAGE_FILE)
.PHONY: coverage-merge
coverage-merge:
@echo 'mode: atomic' > $(COVERAGE_FILE)
@tail -q -n +2 $(COVERAGE_FILES) >> $(COVERAGE_FILE)
@sed -i'.original' "/internal/d" coverage.out $(COVERAGE_FILE)