-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
116 lines (79 loc) · 4.53 KB
/
Makefile
File metadata and controls
116 lines (79 loc) · 4.53 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
SHELL=/bin/bash -o pipefail
all: help
pypi-upload: build-dist ## Uploads new package to PyPi after clean, build
poetry publish
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
# pypi-upload-test: build-dist ## Uploads new package to TEST PyPi after clean, build
# twine upload -r testpypi dist/*
build-dist: clean-dist ## Builds new package dist
poetry build --verbose
build: ## build Flask app
docker compose build app
build-dev: ## build Flask app w/ dev dependencies
docker compose build app --build-arg DEV=True
clean-dist: ## Cleans dist dir
rm -rf dist/*
install-static: ## Installs static assets
cd app/static; \
npm install; \
npm run build
update-fixtures: ## Updates test fixtures with fresh dates
python tests/generate_fixtures.py
test-fresh: update-fixtures ## Run tests with fresh fixtures
pytest
test-unit-fresh: update-fixtures ## Run unit tests with fresh fixtures
pytest tests/unit/
test-functional-fresh: update-fixtures ## Run functional tests with fresh fixtures
pytest tests/functional/
load-test-data: ## Loads fixture test data
docker compose exec app flask testdata load_test_data
ensure-badge-dirs: ## Creates local badge output dirs used by pytest-local-badge
mkdir -p tests/badges/unit tests/badges/integration tests/badges/functional tests/badges/playwright
test-unit: ensure-badge-dirs ## Runs unit tests.
poetry run pytest --local-badge-output-dir tests/badges/unit/ --cov-report term-missing --junitxml=pytest-unit.xml --cov=harvester ./tests/unit | tee pytest-coverage-unit.txt
test-integration: ensure-badge-dirs ## Runs integration tests.
poetry run pytest --local-badge-output-dir tests/badges/integration/ --cov-report term-missing --junitxml=pytest-integration.xml --cov=harvester ./tests/integration | tee pytest-coverage-integration.txt
test-functional: ensure-badge-dirs ## Runs functional tests.
poetry run pytest --local-badge-output-dir tests/badges/functional/ --noconftest --cov-report term-missing --junitxml=pytest-functional.xml --cov=harvester ./tests/functional | tee pytest-coverage-functional.txt
test-playwright: ensure-badge-dirs ## Runs playwright tests.
poetry run pytest --local-badge-output-dir tests/badges/playwright/ --cov-report term-missing --junitxml=pytest-playwright.xml --cov=app ./tests/playwright | tee pytest-coverage-playwright.txt
test-scripts: ## Runs script tests.
poetry run pytest --cov-report term-missing --cov=harvester ./tests/scripts | tee pytest-coverage-scripts.txt
test: up test-unit test-integration ## Runs all local tests
test-e2e-ci: re-up test-playwright test-functional ## All e2e/expensive tests. Run on PR into main.
test-ci: up test-unit test-integration test-scripts ## All simulated tests using only db and required test resources. Run on commit.
re-up: clean up sleep-5 load-test-data ## resets system to clean fixture status
re-up-debug: clean up-debug load-test-data ## resets system to clean fixture status for flask debugging
up: ## Sets up local flask and harvest runner docker environments. harvest runner gets DATABASE_PORT from .env
DATABASE_PORT=5433 docker compose up -d
docker compose -p harvest-app up db -d
up-unified: ## For testing when you want a shared db between flask and harvester
docker compose up -d
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
up-prod: ## Sets up local flask env running gunicorn instead of standard dev server
docker compose -f docker-compose.yml -f docker-compose_prod.yml up -d
down: ## Tears down the flask and harvester containers
docker compose down
docker compose -p harvest-app down
clean: ## Cleans docker images
docker compose down -v --remove-orphans
docker compose -p harvest-app down -v --remove-orphans
sleep-5:
sleep 5
lint-check: ## Lints wtih ruff, isort, black
poetry run ruff check .
poetry run isort --check .
poetry run black --check .
lint-fix: ## Fix lints with isort and black
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)