-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
56 lines (41 loc) · 1.86 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
PWD := `pwd`
DEPLOY_DIR = ./docker
TEST_COMPOSE = $(DEPLOY_DIR)/docker-dev-compose.yml
PROJECT_NAME = sc2infoextractorgo
# REVIEW: Should this be ran with Docker Compose instead?
process_replays: ## Runs the container to process replays.
docker run \
-v "${PWD}/replays:/replays" \
-v "${PWD}/logs:/logs" \
-v "${PWD}/operation_files:/operation_files" \
sc2infoextractorgo \
-log_level 6
###################
#### DOCKER #######
###################
docker_build: ## Builds the "production" container.
docker build --tag=sc2infoextractorgo -f ./docker/Dockerfile .
docker_build_dev: ## Builds the dev container.
docker build --tag=sc2infoextractorgo:dev -f ./docker/Dockerfile.dev .
docker_run_dev: ## Runs the interactive shell in the dev container. Runs bash by default.
docker run -it sc2infoextractorgo:dev
docker_go_lint: ## Runs the linter using the golangci-lint container.
docker run --rm -v .:/app -w /app golangci/golangci-lint:latest golangci-lint run -v --timeout 5m
###################
#### TESTING ######
###################
test_locally:
go test ./... -v -race
compose_build_dev:
docker compose -p $(PROJECT_NAME) -f $(TEST_COMPOSE) build
compose_run_dev_it:
docker compose -p $(PROJECT_NAME) -f $(TEST_COMPOSE) run -it --rm sc2infoextractorgo-dev
compose_run_dev: compose_build_dev compose_run_dev_it
action_compose_test: ## Runs the tests in a container.
docker compose -p $(PROJECT_NAME) -f $(TEST_COMPOSE) run --rm sc2infoextractorgo-test
compose_remove: ## Stops and removes the testing containers, images, volumes.
docker compose -p $(PROJECT_NAME) -f $(TEST_COMPOSE) down --volumes --remove-orphans
compose_test: compose_build_dev action_compose_test compose_remove
.PHONY: help
help: ## Show available make targets.
@awk '/^[^\t ]*:.*?##/{sub(/:.*?##/, ""); printf "\033[36m%-30s\033[0m %s\n", $$1, substr($$0, index($$0,$$2))}' $(MAKEFILE_LIST)