-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (82 loc) · 2.54 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
SHELL=/bin/bash -euo pipefail
#Installs dependencies using poetry.
install-python:
poetry install
#Installs dependencies using npm.
install-node:
npm install --legacy-peer-deps
cd sandbox && npm install --legacy-peer-deps
#Configures Git Hooks, which are scripts that run given a specified event.
install-hooks:
cp scripts/pre-commit .git/hooks/pre-commit
#Condensed Target to run all targets above.
install: install-hooks install-node install-python
#Install tooling using asdf
install-tools:
scripts/install-tools.sh "python java nodejs poetry"
#Run the npm linting script (specified in package.json). Used to check the syntax and formatting of files.
lint:
npm run lint
find . -name '*.py' -not -path '**/.venv/*' | xargs poetry run flake8
#Removes build/ + dist/ directories
clean:
rm -rf build
rm -rf dist
#Creates the fully expanded OAS spec in json
publish: clean
mkdir -p build
npm run publish 2> /dev/null
#Serves the published OAS spec locally
serve:
npm run serve
#Runs build proxy script
build-proxy:
scripts/build_proxy.sh
#Files to loop over in release
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests"
#Create /dist/ sub-directory and copy files into directory
release: clean publish build-proxy
mkdir -p dist
for f in $(_dist_include); do cp -r $$f dist; done
cp ecs-proxies-deploy.yml dist/ecs-deploy-sandbox.yml
cp ecs-proxies-deploy.yml dist/ecs-deploy-internal-qa-sandbox.yml
cp ecs-proxies-deploy.yml dist/ecs-deploy-internal-dev-sandbox.yml
# Regenerate JSON example payloads from signal schemas (extract from YAML-formatted JSON schemas)
# and write out as JSON files
signal-examples:
scripts/make-signal-examples.sh
#################
# Test commands #
#################
TEST_CMD := @APIGEE_ACCESS_TOKEN=$(APIGEE_ACCESS_TOKEN) \
poetry run pytest -v \
--color=yes \
--api-name=multicast-notification-service \
--proxy-name=$(PROXY_NAME) \
-s
PROD_TEST_CMD := $(TEST_CMD) \
--apigee-app-id=$(APIGEE_APP_ID) \
--apigee-organization=nhsd-prod \
--status-endpoint-api-key=$(STATUS_ENDPOINT_API_KEY) \
-k "test_wait_for_status"
#Command to run end-to-end smoketests post-deployment to verify the environment is working
smoketest:
$(TEST_CMD) \
--junitxml=smoketest-report.xml \
-m smoketest
test:
$(TEST_CMD) \
--junitxml=test-report.xml \
smoketest-prod:
$(PROD_TEST_CMD) \
--junitxml=smoketest-report.xml \
-m smoketest
test-prod:
$(PROD_TEST_CMD) \
--junitxml=test-report.xml \
docker-build:
make -C sandbox build
up:
make -C sandbox up
down:
make -C sandbox down