-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (78 loc) · 2.85 KB
/
Makefile
File metadata and controls
95 lines (78 loc) · 2.85 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
SHELL=/usr/bin/env bash -euo pipefail
PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS = lambdas/backend lambdas/ack_backend lambdas/batch_processor_filter lambdas/delta_backend lambdas/filenameprocessor lambdas/id_sync lambdas/mesh_processor lambdas/mns_subscription lambdas/recordforwarder lambdas/recordprocessor lambdas/redis_sync lambdas/shared
PYTHON_PROJECT_DIRS = tests/e2e_automation quality_checks $(PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS)
.PHONY: install lint format format-check clean publish oas build-proxy release initialise-all-python-venvs update-all-python-dependencies run-all-python-unit-tests build-all-docker-images
#Installs dependencies using npm.
install:
npm install --legacy-peer-deps
#Run the npm linting script (specified in package.json). Used to check the syntax and formatting of files.
lint:
npm run lint
format:
npm run format
format-check:
npm run format-check
#Removes build/, dist/ and sandbox/specification/ directories
clean:
rm -rf build
rm -rf dist
rm -rf sandbox/specification
#Creates the OAS spec in JSON for sandbox
publish: clean
mkdir -p build
npm run publish 2> /dev/null
cp build/immunisation-fhir-api.json sandbox/
cp -r specification sandbox/specification
make serve: publish
npm run serve
#Creates a minified OAS spec in JSON for sending to APIM
oas: publish
mkdir -p oas
rm -f specification/immunisation-fhir-api.json
jq -c . build/immunisation-fhir-api.json > oas/immunisation-fhir-api.json
chmod -w oas/immunisation-fhir-api.json
#Runs build proxy script
build-proxy:
utilities/scripts/build_proxy.sh
#Files to loop over in release
_dist_include="poetry.toml Makefile build/. specification sandbox utilities/scripts"
#Create /dist/ sub-directory and copy files into directory
#Ensure full dir structure is preserved for Lambdas
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
initialise-all-python-venvs:
for dir in $(PYTHON_PROJECT_DIRS); do ( \
cd $$dir && \
pwd && \
rm -rf .venv && \
python -m venv .venv && \
source .venv/bin/activate && \
poetry install --no-root && \
deactivate \
); done
update-all-python-dependencies:
for dir in $(PYTHON_PROJECT_DIRS); do ( \
cd $$dir && \
pwd && \
source .venv/bin/activate && \
poetry update && \
deactivate \
); done
run-all-python-unit-tests:
for dir in $(PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS); do ( \
cd $$dir && \
pwd && \
source .venv/bin/activate && \
poetry run make test && \
deactivate \
); done
build-all-docker-images:
for dir in $(PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS); do \
for dockerfile in $$(ls $$dir/*Dockerfile); do \
echo $$dockerfile && docker build --file $$dockerfile $$dir; \
done; \
done