-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (93 loc) · 3.95 KB
/
Makefile
File metadata and controls
120 lines (93 loc) · 3.95 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
117
118
119
120
# This file is for you! Edit it to implement your own hooks (make targets) into
# the project as automated steps to be executed on locally and in the CD pipeline.
include scripts/init.mk
# ==============================================================================
# Example CI/CD targets are: dependencies, build, publish, deploy, clean, etc.
dependencies: # Install dependencies needed to build and test the project @Pipeline
# TODO: Implement installation of your project dependencies
build: # Build the project artefact @Pipeline
(cd sdk && make build)
(cd docs && make build)
# Take out for now - might add again in the future
# (cd server && make build)
# (cd src/server && make build)
publish: # Publish the project artefact @Pipeline
# TODO: Implement the artefact publishing step
deploy: # Deploy the project artefact to the target environment @Pipeline
# TODO: Implement the artefact deployment step
clean:: # Clean-up project resources (main) @Operations
rm -f .version
(cd sdk && make clean)
# Take out for now - might add again in the future
# (cd server && make clean)
# (cd src/server && make clean)
guard-%:
@if [ -z "$${$*}" ]; then \
echo "Variable $* not set"; \
echo "Usage: make <target> $*=<env>"; \
exit 1; \
fi
serve:
npm run serve
lint-oas:
npm run lint-oas
publish-oas:
$(MAKE) copy-examples
npm run publish-oas
set-authorization: guard-APIM_ENV
SPEC_DIR=./specification/api/components/environments
COMPONENT_DIR=./specification/api/components/parameters/authorization
./scripts/build/substitute_build_env.sh $$COMPONENT_DIR/authorization-template.yml $$SPEC_DIR/$$APIM_ENV.env $$COMPONENT_DIR/authorization.yml
set-nhsd-apim: guard-APIM_ENV
SPEC_DIR=./specification/api/components/environments
COMPONENT_DIR=./specification/api/components/x-nhsd-apim
./scripts/build/substitute_build_env.sh $$COMPONENT_DIR/x-nhsd-apim-template.yml $$SPEC_DIR/$$APIM_ENV.env $$COMPONENT_DIR/x-nhsd-apim.yml
set-security: guard-APIM_ENV
SPEC_DIR=./specification/api/components/environments
COMPONENT_DIR=./specification/api/components/security
./scripts/build/substitute_build_env.sh $$COMPONENT_DIR/security-template.yml $$SPEC_DIR/$$APIM_ENV.env $$COMPONENT_DIR/security.yml
COMPONENT_DIR=./specification/api/components/security-schemes
./scripts/build/substitute_build_env.sh $$COMPONENT_DIR/security-schemes-template.yml $$SPEC_DIR/$$APIM_ENV.env $$COMPONENT_DIR/security-schemes.yml
construct-spec: guard-APIM_ENV
$(MAKE) set-nhsd-apim APIM_ENV=$$APIM_ENV
$(MAKE) set-authorization APIM_ENV=$$APIM_ENV
$(MAKE) set-security APIM_ENV=$$APIM_ENV
build-json-oas-spec: guard-APIM_ENV
$(MAKE) construct-spec APIM_ENV=$$APIM_ENV
$(MAKE) publish-oas
build-yml-oas-spec: guard-APIM_ENV
$(MAKE) construct-spec APIM_ENV=$$APIM_ENV
$(MAKE) bundle-oas
serve-oas:
$(MAKE) copy-examples
npm run serve-oas
bundle-oas:
$(MAKE) copy-examples
npm run bundle-oas
generate-sandbox:
$(MAKE) build-json-oas-spec APIM_ENV=sandbox
# jq --slurpfile status sandbox/HealthcheckEndpoint.json '.paths += $$status[0]' build/notify-supplier.json > tmp.json && mv tmp.json build/notify-supplier.json
jq '.security = []' build/notify-supplier.json > tmp.json && mv tmp.json build/notify-supplier.json
npm run generate-sandbox
serve-swagger:
npm run serve-swagger-docs
copy-examples:
@scripts/build/copy-examples.sh
config:: _install-dependencies version # Configure development environment (main) @Configuration
npm install
(cd docs && make install && cd ..)
test-component:
(cd tests && npm install && npm run test:component)
test-performance:
(cd tests && npm install && npm run test:performance)
version:
rm -f .version
make version-create-effective-file dir=.
echo "{ \"schemaVersion\": 1, \"label\": \"version\", \"message\": \"$$(head -n 1 .version 2> /dev/null || echo unknown)\", \"color\": \"orange\" }" > version.json
# ==============================================================================
${VERBOSE}.SILENT: \
build \
clean \
config \
dependencies \
deploy \