-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
78 lines (61 loc) · 3.29 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
deploy:
git pull
$(MAKE) clear-cache
docker-compose down
docker-compose -f docker-compose.yml -f docker-compose.remote.yml up -d backend frontend
local:
docker-compose -f docker-compose.yml -f docker-compose.local.yml up backend frontend
local-db:
docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.override.db.yml up -d db
initialize-local-db:
docker-compose -f docker-compose.yml -f docker-compose.override.db.yml run backend bash -c "python runners/initialize_postgres.py"
echo "Performing load of initial Encompass data."
docker-compose -f docker-compose.yml -f docker-compose.override.db.yml run backend bash -c "python runners/load_representative_points.py -f 'data/sample/los-angeles-points.geojson'"
docker-compose -f docker-compose.yml -f docker-compose.override.db.yml run backend bash -c "python runners/load_addresses.py -f 'data/sample/mock-providers.csv'"
rebuild:
docker-compose build --no-cache
# TODO - Figure out network issue to use docker instead for yarn.
load-local-state:
# Usage 1: make load-local-state filename=sample/los-angeles-points.geojson
# Usage 2: make load-local-state filename=sample/random_state.geojson args="-s fake_state" # This wil force fake all census and urban data.
docker-compose -f docker-compose.yml -f docker-compose.override.db.yml run backend bash -c "python runners/load_representative_points.py -f 'data/$(filename)' $(args)"
docker-compose -f docker-compose.yml -f docker-compose.override.db.yml up -d backend
cd frontend; yarn codegen
cd ..
docker-compose -f docker-compose.yml -f docker-compose.override.db.yml stop backend
load-representative-points:
# Usage: make load-representative-point filename=california.geojson
docker-compose run backend bash -c "python runners/load_representative_points.py -f 'data/$(filename)' $(args)"
normalize-population-totals:
docker-compose run backend bash -c "python runners/normalize_population_totals.py"
# Export representative points data and build a MapBox tileset.
# Note: You may need to run `brew install tippecanoe`.
create-tileset-from-representative-points:
docker-compose run --no-deps backend bash -c "python runners/export_representative_points.py -o data/representative_points_from_db.geojson"
tippecanoe -o data/repr_pop_points.mbtiles -Z 7 -z 22 -r 2.5 -B 8.0 -f data/representative_points_from_db.geojson
# Clear cached adequacy results.
clear-cache:
rm -f .cache/*
# Run the backend in debug mode.
flask-debug:
docker-compose run --service-ports backend bash -c "python main.py"
backend-lint:
docker-compose run --no-deps backend bash -c "flake8 ."
docker-compose run --no-deps backend bash -c "pep257 --match-dir '[^\.*data]' ."
backend-test:
docker-compose run --no-deps backend pytest -s tests
BACKEND_COVERAGE=pytest --cov=backend --cov-config .coveragerc --cov-fail-under=84 --cov-report term-missing
backend-coverage:
docker-compose run --no-deps backend ${BACKEND_COVERAGE}
backend-coverage-ci:
$(MAKE) initialize-local-db
docker-compose -f docker-compose.yml -f docker-compose.override.db.yml run backend ${BACKEND_COVERAGE}
frontend-test:
docker-compose run frontend bash -c "yarn test"
# Run tests for all components.
test:
$(MAKE) backend-lint
$(MAKE) backend-coverage
$(MAKE) frontend-test
# [Dummy dependency to force a make command to always run.]
FORCE: