forked from opendatacube/datacube-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
124 lines (95 loc) · 3.07 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
.DEFAULT_GOAL := help
help: ## Display this help text
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: install
install: ## Install all requirements and explorer
pip install -U setuptools pip
pip install -U -r requirements-test.txt
pip install -e .[test]
.PHONY: format
format: ## Reformat all Python code
isort -rc cubedash integration_tests
black cubedash integration_tests ./*.py
.PHONY: lint
lint: ## Run all Python linting checks
python3 setup.py check -rms
flake8 cubedash/ integration_tests/
black --check cubedash integration_tests ./*.py
.PHONY: weblint
weblint: ## Run stylelint across HTML and SASS
stylelint $(find . -iname '*.html') $(find . -iname '*.sass')
static: style js
.PHONY: style
style: cubedash/static/base.css ## Compile SASS stylesheets to CSS
cubedash/static/base.css: cubedash/static/base.sass
sass $< $@
node_modules:
npm install @types/geojson @types/leaflet
.PHONY: js ## Compile Typescript to JS
js: cubedash/static/overview.js node_modules
cubedash/static/overview.js: cubedash/static/overview.ts
tsc --build cubedash/static/tsconfig.json
.PHONY: test
test: ## Run tests using pytest
pytest --cov=cubedash --cov-report=xml -r sx --durations=5
.PHONY: testcov
testcov:
pytest --cov=cubedash
@echo "building coverage html"
@coverage html
.PHONY: clean
clean: ## Clean all working/temporary files
rm -rf `find . -name __pycache__`
rm -f `find . -type f -name '*.py[co]' `
rm -f `find . -type f -name '*~' `
rm -f `find . -type f -name '.*~' `
rm -rf .cache
rm -rf .pytest_cache
rm -rf .mypy_cache
rm -rf htmlcov
rm -rf *.egg-info
rm -f .coverage
rm -f .coverage.*
rm -rf build
# python setup.py clean
.PHONY: up build schema index
# DOCKER STUFF
up: ## Start server using Docker
docker-compose up
build: ## Build the dev Docker image
docker-compose build
docker-clean: ## Get rid of the local docker env and DB
docker-compose down
build-prod: ## Build the prod Docker image
docker-compose \
--file docker-compose.yml \
build
up-prod: ## Start using the prod Docker image
docker-compose \
--file docker-compose.yml \
up
init-odc: ## Initialise ODC Database
docker-compose exec explorer \
datacube system init
docker-shell: ## Get a shell into local Docker environ
docker-compose exec explorer \
bash
schema: ## Initialise Explorer DB using Docker
docker-compose exec explorer \
python3 /code/cubedash/generate.py --init-database
index: ## Update Explorer DB using Docker
docker-compose exec explorer \
python3 /code/cubedash/generate.py --all
force-refresh: ## Entirely refresh the Explorer tables in Docker
docker-compose exec explorer \
python3 /code/cubedash/generate.py --force-refresh --refresh-stats --all
create-test-db-docker: ## Create a test database inside Docker
sleep 10
docker-compose run -T explorer \
bash /code/.docker/create_db.sh
lint-docker: ## Run linting inside inside Docker
docker-compose run explorer \
make lint
test-docker: ## Run tests inside Docker
docker-compose run explorer \
make test