Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (102 loc) · 3.66 KB
/
Copy pathMakefile
File metadata and controls
132 lines (102 loc) · 3.66 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
.DEFAULT_GOAL := help
SWC_CONFIG = .swcrc
TS_CONFIG = cubedash/static/tsconfig.json
TS_DIST = cubedash/static/ts-dist
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 -e .[test]
.PHONY: format
format: ## Reformat all Python code
ruff format cubedash integration_tests ./*.py
.PHONY: lint
lint: ## Run all Python linting checks
git config --global --add safe.directory /code
python3 setup.py check -ms
pre-commit run -a
.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
npx sass --style=compressed $< $@
node_modules:
npm install typescript @swc/cli @swc/core @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 $(TS_CONFIG) $(SWC_CONFIG)
tsc --noEmit $(TS_CONFIG)
swc $< --out-file $@
.PHONY: test
test: ## Run tests using pytest
pytest $(PYTEST_PARAMS) --cov=cubedash --cov-report=xml -r sx --durations=5
.PHONY: testcov
testcov:
pytest $(PYTEST_PARAMS) --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
export EXPLORER_VERSION=$$(git describe --tag | sed 's#\-g#+g#') && \
docker compose up --quiet-pull
up-d: ## Start server using Docker in background
export EXPLORER_VERSION=$$(git describe --tag | sed 's#\-g#+g#') && \
docker compose up -d --wait --quiet-pull
build: ## Build the dev Docker image
export EXPLORER_VERSION=$$(git describe --tag | sed 's#\-g#+g#') && \
docker compose build
docker-clean: ## Get rid of the local docker env and DB
docker compose down
# These rules pass --file to avoid loading docker-compose.override.yml.
build-prod: ## Build the prod Docker image
export EXPLORER_VERSION=$$(git describe --tag | sed 's#\-g#+g#') && \
docker compose \
--file docker-compose.yml \
build
up-prod: ## Start using the prod Docker image
export EXPLORER_VERSION=$$(git describe --tag | sed 's#\-g#+g#') && \
docker compose \
--file docker-compose.yml \
up -d --wait --quiet-pull
init-odc: ## Initialise ODC Database
docker compose exec -T explorer \
datacube system init
docker-shell: ## Get a shell into local Docker environ
docker compose exec -T explorer \
bash
schema: ## Initialise Explorer DB using Docker
docker compose exec -T explorer \
cubedash-gen -v --init
index: ## Update Explorer DB using Docker
docker compose exec -T explorer \
cubedash-gen --all
force-refresh: ## Entirely refresh the Explorer tables in Docker
docker compose exec -T explorer \
cubedash-gen --force-refresh --refresh-stats --all
lint-docker: ## Run linting inside inside Docker
docker compose run --rm explorer \
make lint
test-docker: ## Run tests inside Docker
docker compose run --rm explorer \
bash --login -c \
"cd /code && pytest $(PYTEST_PARAMS) --cov=cubedash --cov-report=xml -r sx --durations=5"