Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (57 loc) · 2.79 KB
/
Copy pathMakefile
File metadata and controls
84 lines (57 loc) · 2.79 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
SHELL=/bin/bash -o pipefail
all: help
build: ## build Flask app
docker compose build app
build-dev: ## build Flask app w/ dev dependencies
docker compose build app --build-arg DEV=True
install-static: ## Installs static assets
cd app/static; \
npm install; \
npm run build
watch-static: ## Rebuild static assets when SCSS/JS changes
cd app/static; \
npm install; \
npm run watch
poetry-update: ## Updates local Poetry to latest
poetry self update
update-dependencies: ## Updates requirements.txt and requirements_dev.txt from pyproject.toml
poetry export --without-hashes --without=dev --format=requirements.txt > requirements.txt
poetry export --without-hashes --only=dev --format=requirements.txt > requirements-dev.txt
test-ci: up test
test:
poetry run pytest tests/unit/
test-pa11y: ## Runs accessibility tests with pa11y-ci (requires running app)
npm run test:pa11y
test-axe: ## Runs axe-core accessibility checks (requires running app w/ test data)
poetry run pytest --browser chromium -m accessibility tests/browser/
load-test-data: ## Loads test fixture data into the database
docker compose exec app flask testdata load_test_data --clear
docker compose exec app flask search compare --force-update
test-a11y-with-data: up load-test-data test-pa11y test-axe ## Runs accessibility tests with test data loaded
# CI skips webkit: Linux WebKitGTK needs apt libs that stall on Azure mirrors.
BROWSER_ARGS ?= --browser chromium --browser firefox --browser webkit
test-browser: ## Runs blocking browser tests (accessibility checks are advisory; see test-axe)
poetry run pytest $(BROWSER_ARGS) -m "not accessibility" tests/browser/
test-browser-with-data: up load-test-data test-browser ## Runs accessibility tests with test data loaded
up: ## Sets up local flask docker environment.
docker compose up -d --wait
up-debug: ## Sets up local docker environment with VSCODE debug support enabled
docker compose -f docker-compose.yml -f docker-compose_debug.yml up -d --wait
up-shared: ## Runs the app against a local datagov-harvester's db/opensearch instead of its own
docker compose -f docker-compose.yml -f docker-compose.shared-harvester.yml up -d --no-deps app
down: ## Tears down the flask and harvester containers
docker compose down
clean: ## Cleans docker images
docker compose down -v --remove-orphans
lint-check: ## Lints wtih ruff, isort, black
poetry run ruff check .
poetry run isort --check .
poetry run black --check .
lint-fix: ## fix linting automatically where possible
poetry run isort .
poetry run black .
# Output documentation for top-level targets
# Thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## This help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)