-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (69 loc) · 3.24 KB
/
Makefile
File metadata and controls
90 lines (69 loc) · 3.24 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
.DEFAULT_GOAL := help
SHELL := /bin/bash
NOTIFY_CREDENTIALS ?= ~/.notify-credentials
EXCLUDE_REQUIREMENTS_NEWER_THAN_DAYS ?= 30
.PHONY: help
help:
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: bootstrap
bootstrap: ## Install build dependencies
mkdir -p logs screenshots
pip install -r requirements_for_test.txt
.PHONY: freeze-requirements
freeze-requirements: ## create static requirements_for_test.txt
uv pip install -r requirements.txt
python -c "from notifications_utils.version_tools import copy_config; copy_config()"
uv pip compile requirements_for_test.in --output-file requirements_for_test.txt $(EXTRA_UV_PIP_COMPILE_FLAGS)
uv pip sync requirements_for_test.txt
.PHONY: refreeze-requirements
refreeze-requirements: ## Upgrade unpinned requirements
EXTRA_UV_PIP_COMPILE_FLAGS="--upgrade --exclude-newer $(EXCLUDE_REQUIREMENTS_NEWER_THAN_DAYS)d" make freeze-requirements
.PHONY: clean
clean: ## Remove temporary files
rm -rf screenshots/*
rm -rf logs/*
.PHONY: $(filter-out dev%,$(MAKECMDGOALS))
dev%:
$(eval export ENVIRONMENT=$@)
@true
.PHONY: staging
staging:
$(eval export ENVIRONMENT=staging)
@true
.PHONY: prod
prod:
$(eval export ENVIRONMENT=prod)
@true
env-environment-check:
@test -n "${ENVIRONMENT}" || (echo "ENVIRONMENT variable is not set"; exit 1)
.PHONY: env-functional-tests
env-functional-tests: env-environment-check
@./scripts/env-test.sh "${ENVIRONMENT}" tests/notifications/functional_tests tests/document_download/functional_tests
.PHONY: env-smoke-tests
env-smoke-tests: env-environment-check
@./scripts/env-test.sh "${ENVIRONMENT}" tests/notifications/smoke_tests tests/document_download/smoke_tests
.PHONY: env-provider-tests
env-provider-tests: env-environment-check
@./scripts/env-test.sh "${ENVIRONMENT}" tests/provider_delivery/test_provider_delivery_email.py tests/provider_delivery/test_provider_delivery_sms.py
.PHONY: lint
lint: ## Run static analysis
ruff check .
ruff format --check .
.PHONY: test
test: clean lint ## Run functional tests against local environment
pytest tests/notifications/functional_tests -n auto --dist loadgroup ${FUNCTIONAL_TESTS_EXTRA_PYTEST_ARGS}
pytest tests/document_download/functional_tests ${FUNCTIONAL_TESTS_EXTRA_PYTEST_ARGS}
.PHONY: generate-staging-db-fixtures
generate-staging-db-fixtures: ## Generates DB fixtures for the staging database
$(if $(shell which gpg2), $(eval export GPG=gpg2), $(eval export GPG=gpg))
$(if ${GPG_PASSPHRASE_TXT}, $(eval export DECRYPT_CMD=echo -n $$$${GPG_PASSPHRASE_TXT} | ${GPG} --quiet --batch --passphrase-fd 0 --pinentry-mode loopback -d), $(eval export DECRYPT_CMD=${GPG} --quiet --batch -d))
@jinja2 --strict db_fixtures/staging.sql.j2 \
--format=json \
-o db_fixtures/staging.sql \
<(${DECRYPT_CMD} ${NOTIFY_CREDENTIALS}/credentials/functional-tests/staging-functional-db-fixtures.gpg) 2>&1
.PHONY: generate-local-dev-db-fixtures
generate-local-dev-db-fixtures:
$(MAKE) -C ../notifications-local generate-local-dev-db-fixtures
.PHONY: bump-utils
bump-utils: # Bump notifications-utils package to latest version
${PYTHON_EXECUTABLE_PREFIX}python -c "from notifications_utils.version_tools import upgrade_version; upgrade_version()"