-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
178 lines (113 loc) · 3.11 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
.PHONY: help
help:
@echo "See Makefile for available targets."
.PHONY: install
install: dependencies logs db frontend
.PHONY: dependencies
dependencies: backend-dependencies frontend-dependencies
.PHONY: backend-dependencies
backend-dependencies:
@echo "== Install Python dependencies. =="
pip install -r requirements.txt
.PHONY: frontend-dependencies
frontend-dependencies:
@echo "== Install frontend dependencies. =="
cd frontend && npm install
.PHONY: server
server:
python backend/manage.py runserver
.PHONY: liveserver
liveserver:
# Run both Django and Webpack servers simultaneously:
python backend/manage.py run_liveserver
.PHONY: shell
shell:
python backend/manage.py shell_plus
.PHONY: notebook
notebook:
python backend/manage.py shell_plus --notebook
# Double $$ is needed for expression expansion in Makefile.
INVESTIGATION_NTB="backend/monitoring/notebooks/investigation_$$(date +'%Y_%m_%d').ipynb"
.PHONY: investigation
investigation:
git checkout monitoring 2>/dev/null || git checkout -b monitoring
cp --no-clobber backend/monitoring/notebooks/investigation_template.ipynb ${INVESTIGATION_NTB}
python backend/manage.py shell_plus --notebook
xdg-open http://localhost:8888/notebooks/${INVESTIGATION_NTB}
.PHONY: export_monitoring_notebook
export_monitoring_notebook:
python backend/manage.py export_monitoring_notebook
.PHONY: test
test: test-backend test-frontend
.PHONY: test-backend
test-backend:
cd backend; pytest
.PHONY: test-frontend
test-frontend:
@echo "===== Frontend tests ====="
@echo "TBA"
.PHONY: test-load
test-load:
# assumes that server is already running at http://127.0.0.1:8000
locust -f backend/learn/tests/locustfile.py --host=http://127.0.0.1:8000
# test setting at: http://127.0.0.1:8089/
.PHONY: lint
lint: lint-backend lint-frontend
.PHONY: lint-backend
lint-backend:
@echo "===== Backend linting ====="
pylint --ignore=migrations backend
.PHONY: lint-frontend
lint-frontend:
@echo "===== Frontend linting ====="
@echo "TBA"
.PHONY: storybook
storybook:
cd frontend; npm run storybook
.PHONY: db
db: migrate domain
.PHONY: migrate
migrate:
python backend/manage.py migrate --noinput
.PHONY: flush
flush:
python backend/manage.py flush --noinput
.PHONY: reset_db
reset_db:
python backend/manage.py reset_db
python backend/manage.py migrate
python backend/manage.py load_domain
python backend/manage.py create_admin
python backend/manage.py create_social_apps
.PHONY: admin
admin:
python backend/manage.py create_admin
.PHONY: domain
domain:
python backend/manage.py load_domain
.PHONY: export
export:
python backend/manage.py export_data
.PHONY: metrics
metrics:
python backend/manage.py compute_metrics
.PHONY: frontend
frontend:
cd frontend && npm run build
.PHONY: logs
logs:
mkdir -p logs
.PHONY: schedule_jobs
schedule_jobs:
python backend/manage.py crontab add
.PHONY: socialapps
socialapps:
python backend/manage.py create_social_apps
.PHONY: jupyter_components
jupyter_components:
cd frontend && npm run jupyter-build
python setup.py develop
.PHONY: upload_package
upload_package:
python setup.py sdist
twine upload dist/*