-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
152 lines (114 loc) · 4.4 KB
/
Makefile
File metadata and controls
152 lines (114 loc) · 4.4 KB
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
MAKEFLAGS += --silent
.PHONY: clean clean-test clean-pyc clean-build restart test develop up down dev-server help build release
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -maxdepth 3 -name '*.egg-info' -exec rm -fr {} +
find . -maxdepth 3 -name '*.egg' -exec rm -f {} +
clean-pyc: ## remove Python file artifacts
find stormpiper -path '*/node_modules' -prune -o -name '*.pyo' -o -name '*.pyc' -exec rm -f {} +
clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -fr .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
rm -fr .mypy_cache
export COMPOSE_DOCKER_CLI_BUILD=1
export COMPOSE_FILE=docker-stack.yml
stack: ## write the docker-stack.yml file
docker compose \
-f docker-compose.develop.yml \
-f docker-compose.dev-volume.yml \
-f docker-compose.dev-environment.yml \
config > docker-stack.yml
stack-ci: ## write the docker-stack.yml file for ci
docker compose \
-f docker-compose.gar-image-ci.yml \
-f docker-compose.dev-postgis.yml \
-f docker-compose.dev-environment-ci.yml \
config > docker-stack.yml
stack-fe: ## make stack for front end development
docker compose \
-f docker-compose.develop.yml \
-f docker-compose.dev-environment.yml \
config > docker-stack.yml
stack-test: ## make stack for testing on local
docker compose \
-f docker-compose.develop.yml \
-f docker-compose.dev-volume.yml \
-f docker-compose.dev-environment.yml \
-f docker-compose.dev-postgis.yml \
config > docker-stack.yml
build: ## build the docker-stack.yml file
docker compose build
restart: ## restart the redis server and the background workers
docker compose restart redis bg_worker beat_worker
test: stack-test ## run tests quickly with the default Python
bash scripts/test.sh -sv
lint: clean
bash scripts/lint.sh
init-test:
docker compose up -d stormpiper-test postgis redis bg_worker
docker compose exec stormpiper-test bash prestart-tests.sh
test-ci: stack-ci init-test ## run tests quickly with the default Python
docker compose exec stormpiper-test pytest -xsv
coverage-ci: stack-ci init-test ## run tests on CI with the default Python
docker compose exec stormpiper-test coverage run -m pytest -v
alert-dev-unreachable: stack-ci
docker compose up -d stormpiper-test
docker compose exec stormpiper-test python -m stormpiper.if_error "ERROR: Dev Site is not reachable."
alert-prod-unreachable: stack-ci
docker compose up -d stormpiper-test
docker compose exec stormpiper-test python -m stormpiper.if_error "ERROR: Prod Site is not reachable."
coverage: clean stack-test restart init-test ## check code coverage quickly with the default Python
docker compose exec stormpiper-test coverage run -m pytest -x
docker compose exec stormpiper-test coverage report -mi
typecheck: clean ## run static type checker
mypy stormpiper/stormpiper
develop: clean stack build ## build the development environment
up: stack ## bring up the containers and run startup commands
docker compose up
up-d: stack ## bring up the containers in '-d' mode
docker compose up -d
up-test: stack-test init-test
up-fe-dev: stack-fe ## bring up the containers without mounting volumes for `npm run dev`
docker compose up
up-fe-watch: up ## bring up the containers with mounted volumes for `npm run watch`
down: ## bring down the containers
docker compose down
down-v: ## bring down the containers and detach volumes
docker compose down -v
dev-server: stack ## start a development server
docker compose up stormpiper-pod
release: ## push production images to registry
bash scripts/push_release.sh
cluster: ## bring up local kubenertes cluster
bash scripts/local_cluster.sh
fe-dev:
( cd stormpiper/stormpiper/spa && npm run dev )
fe-watch:
( cd stormpiper/stormpiper/spa && npm run watch )