forked from scoringengine/scoringengine
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
72 lines (65 loc) · 3.36 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
MAIN_DOCKER := docker-compose.yml
TESTBED_DOCKER := docker/testbed/docker-compose.yml
INTEGRATION_DOCKER := tests/integration/docker-compose.yml
TESTS_DOCKER:= tests/docker-compose.yml
PROJECT_NAME := scoringengine
BUILD_MODE := build ## Pass `pull` in order to pull images instead of building them
GIT_HASH=$(shell git rev-parse --short HEAD)
.PHONY:all
all:
@echo 'Available make targets:'
@grep '^[^#[:space:]^\.PHONY.*].*:' Makefile
## Run Commands
.PHONY: run run-tests run-testbed run-integration run-integration-tests
run:
SCORINGENGINE_VERSION=$(GIT_HASH) docker-compose -f $(MAIN_DOCKER) -p $(PROJECT_NAME) up -d
run-tests:
docker-compose -f $(TESTS_DOCKER) -p $(PROJECT_NAME) up -d
# Flake8 checks
docker run -it scoringengine/tester bash -c "flake8 --config .flake8 ./"
# Run unit tests
docker run -it -v artifacts:/app/artifacts scoringengine/tester bash -c "py.test --cov=scoring_engine --cov-report=xml:/app/artifacts/coverage.xml tests"
run-testbed:
SCORINGENGINE_VERSION=$(GIT_HASH) docker-compose -f $(MAIN_DOCKER) -f $(TESTBED_DOCKER) -p $(PROJECT_NAME) up -d
run-integration:
SCORINGENGINE_VERSION=$(GIT_HASH) docker-compose -f $(MAIN_DOCKER) -f $(TESTBED_DOCKER) -f $(INTEGRATION_DOCKER) -p $(PROJECT_NAME) up -d
run-integration-tests:
SCORINGENGINE_VERSION=$(GIT_HASH) docker-compose -f $(MAIN_DOCKER) -f $(TESTBED_DOCKER) -f $(INTEGRATION_DOCKER) -p $(PROJECT_NAME) run tester bash -c "py.test --integration tests"
## Build Commands
.PHONY: build build-tests build-testbed build-integration
build:
docker-compose -f $(MAIN_DOCKER) -p $(PROJECT_NAME) $(BUILD_MODE)
build-tests:
docker-compose -f $(MAIN_DOCKER) -f $(TESTS_DOCKER) -p $(PROJECT_NAME) $(BUILD_MODE) base
docker-compose -f $(MAIN_DOCKER) -f $(TESTS_DOCKER) -p $(PROJECT_NAME) $(BUILD_MODE) tester redis
build-testbed:
docker-compose -f $(MAIN_DOCKER) -f $(TESTBED_DOCKER) -p $(PROJECT_NAME) $(BUILD_MODE)
build-integration:
docker-compose -f $(MAIN_DOCKER) -f $(TESTBED_DOCKER) -f $(INTEGRATION_DOCKER) -p $(PROJECT_NAME) $(BUILD_MODE)
## Stop Commands
.PHONY: stop stop-tests stop-testbed stop-integration
stop:
-docker-compose -f $(MAIN_DOCKER) -p $(PROJECT_NAME) stop
stop-tests:
-docker-compose -f $(MAIN_DOCKER) -f $(TESTS_DOCKER) -p $(PROJECT_NAME) stop
stop-testbed:
-docker-compose -f $(MAIN_DOCKER) -f $(TESTBED_DOCKER) -p $(PROJECT_NAME) stop
stop-integration:
-docker-compose -f $(MAIN_DOCKER) -f $(TESTBED_DOCKER) -f $(INTEGRATION_DOCKER) -p $(PROJECT_NAME) stop
## Clean Commands
.PHONY: clean clean-testbed clean-integration
clean:
-docker-compose -f $(MAIN_DOCKER) -p $(PROJECT_NAME) down -v --remove-orphans
clean-testbed:
-docker-compose -f $(MAIN_DOCKER) -f $(TESTBED_DOCKER) -p $(PROJECT_NAME) down -v --remove-orphans
clean-integration:
-docker-compose -f $(MAIN_DOCKER) -f $(TESTBED_DOCKER) -f $(INTEGRATION_DOCKER) -p $(PROJECT_NAME) down -v --remove-orphans
## Rebuild Commands
.PHONY: rebuild rebuild-new rebuild-tests rebuild-testbed rebuild-testbed-new rebuild-integration rebuild-integration-new
rebuild: build stop run
rebuild-new: build stop clean run
rebuild-tests: build-tests stop-tests run-tests
rebuild-testbed: build-testbed stop-testbed run-testbed
rebuild-testbed-new: build-testbed stop-testbed clean-testbed run-testbed
rebuild-integration: build-integration stop-integration run-integration
rebuild-integration-new: build-integration stop-integration clean-integration run-integration