-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
67 lines (53 loc) · 1.25 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
55
56
57
58
59
60
61
62
63
64
65
66
67
.PHONY: build
build:
@cargo build --release
.PHONY: up
up:
@docker-compose up
.PHONY: up-detached
up-detached:
@docker-compose up --detach
.PHONY: down
down:
@docker-compose down
.PHONY: test
test:
@cargo test --lib
.PHONY: integration-test
integration-test: clear-db-data
@APP_JWT_SECRET='deadbeef' \
MOCK_ADMIN_URL='http://127.0.0.1:11111/__admin__/register-snap' \
HOST='0.0.0.0' \
PORT='8080' \
cargo test --test '*' $(ARGS)
.PHONY: test-all
test-all: test integration-test
.PHONY: wait-for-server
wait-for-server:
@echo "Waiting for ratings server to start on port 8080..."
@until docker-compose ps | grep -E '^ratings\s' | grep healthy; do \
echo "..."; \
sleep 1; \
done
.PHONY: ci-test
ci-test: up-detached wait-for-server test-all down
.PHONY: clear-db-data
clear-db-data:
@docker-compose exec -T db psql -U postgres ratings < tests/clear-db.sql
.PHONY: rebuild-local
rebuild-local:
@docker-compose build
.PHONY: rm-db
rm-db:
@docker-compose rm db
@docker volume rm -f postgres_data
.PHONY: rm-volumes
rm-volumes:
@docker volume rm -f target-cache
@docker volume rm -f cargo-cache
.PHONY: db-shell
db-shell:
@docker exec -it ratings-db psql -U postgres ratings
.PHONY: ratings-shell
ratings-shell:
@docker exec -it ratings bash