-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
84 lines (66 loc) · 2.9 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
.DEFAULT_GOAL := help
SHELL := /bin/bash
NOTIFY_CREDENTIALS ?= ~/.notify-credentials
.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
pip install --upgrade pip-tools
python -c "from notifications_utils.version_tools import copy_config; copy_config()"
pip-compile requirements_for_test.in
.PHONY: clean
clean: ## Remove temporary files
rm -rf screenshots/*
rm -rf logs/*
.PHONY: $(filter-out dev%,$(MAKECMDGOALS))
dev%:
$(eval export ENVIRONMENT=$@)
@true
.PHONY: preview
preview:
$(eval export ENVIRONMENT=preview)
@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/functional/preview_and_dev tests/document_download/preview_and_dev
.PHONY: env-smoke-tests
env-smoke-tests: env-environment-check
@./scripts/env-test.sh "${ENVIRONMENT}" tests/functional/staging_and_prod tests/document_download/staging_and_prod
.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: test
test: clean ## Run functional tests against local environment
ruff check .
black --check .
pytest -v tests/functional/preview_and_dev -n auto --dist loadgroup ${FUNCTIONAL_TESTS_EXTRA_PYTEST_ARGS}
pytest -v tests/document_download/preview_and_dev ${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()"