forked from preply/graphene-federation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
159 lines (115 loc) · 5.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
### <summary>
### Build a Python 3 image for instlaling development dependencies and local
### development.
### </summary>
.PHONY: build
build:
@docker compose \
-f docker-compose.yaml \
build
.PHONY: build.all
build.all: build build.integration-tests
### <summary>
### Build both Graphene 2.x and Graphene 3.x integration test environments.
### </summary>
.PHONY: build.integration-tests
build.integration-tests: build.integration-tests.graphene2 build.integration-tests.graphene3
### <summary>
### Build the images for integration testing on Graphene 2.x
### </summary>
.PHONY: build.integration-tests.graphene2
build.integration-tests.graphene2:
@echo "Building integration test environment for: Graphene 2.x"
@cd integration_tests/graphene-2.x && docker compose \
-f docker-compose.yaml \
build
### <summary>
### Build the images for integration testing on Graphene 3.x
### </summary>
.PHONY: build.integration-tests.graphene3
build.integration-tests.graphene3:
@echo "Building integration test environment for: Graphene 3.x"
@cd integration_tests/graphene-3.x && docker compose \
-f docker-compose.yaml \
build
### <summary>
###
### </summary>
.PHONY: clean
clean: docker.clean
.PHONY: clean.full
clean: .remove-integration-images clean
.PHONY: docker.clean
docker.clean:
@echo "> Perform docker system prune..."
@docker system prune -f
.PHONY: shell.dev
shell.dev:
@docker compose -f docker-compose.yaml run graphene_federation /bin/bash
.PHONY: shell.integration.graphene2
shell.integration.graphene2:
@docker compose -f integration_tests/graphene-2.x/docker-compose.yaml run service /bin/sh
.PHONY: stop
stop:
@echo "Stopping all containers..."
@docker compose -f integration_tests/graphene-2.x/docker-compose.yaml down
@docker compose -f integration_tests/graphene-3.x/docker-compose.yaml down
### <summary>
### Run Graphene unit tests.
### </summary>
.PHONY: test
test:
@docker compose run graphene_federation pytest graphene_federation --cov=graphene_federation -vv
## Run unit tests
.PHONY: test.all
test.all: build test build.integration-tests test.integration
## Run integration tests
.PHONY: test.integration
test.integration: test.integration.graphene2 test.integration.graphene3
.PHONY: test.integration.graphene2
test.integration.graphene2:
@echo "Running integration tests for: Graphene 2"
@docker compose -f integration_tests/graphene-2.x/docker-compose.yaml down
@docker compose -f integration_tests/graphene-2.x/docker-compose.yaml up -d
@docker compose -f integration_tests/graphene-2.x/docker-compose.yaml run --rm test_runner
.PHONY: test.integration.graphene3
test.integration.graphene3:
@echo "Running integration tests for: Graphene 3"
@docker compose -f integration_tests/graphene-3.x/docker-compose.yaml down
@docker compose -f integration_tests/graphene-3.x/docker-compose.yaml up -d
@docker compose -f integration_tests/graphene-3.x/docker-compose.yaml run --rm test_runner
# .PHONY: test.integration.graphene3.clean
# test.integration.graphene3.clean: clean .prepare-graphene3-integration-tests build.integration-tests.graphene3 test.integration.graphene3
# test-service-a:
# @echo "Checking if service_a, when started, occurs in some hicup. This is used in development, to check if a dn why a container is not running"
# docker rmi --force integration_test_service_a_run_check:latest
# cd integration_tests/service_a && docker build --progress="plain" --tag integration_test_service_a_run_check . && docker run integration_test_service_a_run_check:latest
# test-service-3-a: .prepare-graphene3-integration-tests
# @echo "Checking if service_3_a, when started, occurs in some hiccups..."
# docker rmi --force integration_test_service_3_a_run_check:latest
# cd integration_tests/service_3_a && docker build --progress="plain" --tag integration_test_service_3_a_run_check . && docker run integration_test_service_3_a_run_check:latest
### <summary>
###
### </summary>
.PHONY: .remove-integration-images
.remove-integration-images:
@echo "Remove all docker containers and images..."
# Remove all of the Graphene 2 images
@echo "Removing Graphene 2 images..."
@docker rmi --force graphene_federation/integration-tests/service:graphene-2
@docker rmi --force graphene_federation/integration-tests/federation:graphene-2
@docker rmi --force graphene_federation/integration-tests/test_runner:graphene-2
# Remove all of the Graphene 3 images
@echo "Removing Graphene 3 images..."\
@docker rmi --force graphene_federation/integration-tests/service:graphene-3
@docker rmi --force graphene_federation/integration-tests/federation:graphene-3
@docker rmi --force graphene_federation/integration-tests/test_runner:graphene-3
# .PHONY: .prepare-graphene3-integration-tests
# .prepare-graphene3-integration-tests:
# @echo "Building graphene-federation wheel file..."
# @python3 setup.py bdist_wheel
# @echo "Sending the wheel file to each docker image build folder..."
# @cp dist/$(shell ls -t dist/ | egrep .whl | head -n1) integration_tests/graphene-3.x/service_a/
# @cp dist/$(shell ls -t dist/ | egrep .whl | head -n1) integration_tests/graphene-3.x/service_b/
# @cp dist/$(shell ls -t dist/ | egrep .whl | head -n1) integration_tests/graphene-3.x/service_c/
# @cp dist/$(shell ls -t dist/ | egrep .whl | head -n1) integration_tests/graphene-3.x/service_d/