Skip to content

Commit 10a994a

Browse files
authored
Merge pull request #7 from NHSDigital/feature/eja-eli-225-fixing-make
eli-225 adding back in poetry, updating make and readme
2 parents de26709 + 838ed4c commit 10a994a

35 files changed

+1904
-825
lines changed

.github/actions/lint-and-validate-specification/action.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ runs:
3131
3232
- name: Lint OpenAPI Spec with Spectral
3333
shell: bash
34-
run: spectral lint --ruleset .spectral.yaml build/specification/eligibility-signposting-api.yaml
34+
run: |
35+
spectral lint --ruleset .spectral.yaml build/specification/${{ inputs.apim-env }}/eligibility-signposting-api.yaml
3536
3637
- name: Validate OpenAPI Spec with Swagger CLI
3738
shell: bash
38-
run: swagger-cli validate build/specification/eligibility-signposting-api.yaml
39+
run: swagger-cli validate build/specification/${{ inputs.apim-env }}/eligibility-signposting-api.yaml

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public/
2020
sandbox/tests
2121
sandbox/__pycache__
2222
/specification/tmp/*
23+
/specification/tmp/working/*
2324
/sandbox/specification/*
2425
sandbox/specification/*
25-
/specification/postman
2626
/coverage.xml
2727
*/package-lock.json
2828

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
pre-commit 3.6.0
44
vale 3.6.0
5+
poetry 2.1.1
56

67
# ==============================================================================
78
# The section below is reserved for Docker image versions.
@@ -14,6 +15,7 @@ vale 3.6.0
1415
# docker/ghcr.io/make-ops-tools/gocloc latest@sha256:6888e62e9ae693c4ebcfed9f1d86c70fd083868acb8815fe44b561b9a73b5032 # SEE: https://github.com/make-ops-tools/gocloc/pkgs/container/gocloc
1516
# docker/ghcr.io/nhs-england-tools/github-runner-image 20230909-321fd1e-rt@sha256:ce4fd6035dc450a50d3cbafb4986d60e77cb49a71ab60a053bb1b9518139a646 # SEE: https://github.com/nhs-england-tools/github-runner-image/pkgs/container/github-runner-image
1617
# docker/hadolint/hadolint 2.12.0-alpine@sha256:7dba9a9f1a0350f6d021fb2f6f88900998a4fb0aaf8e4330aa8c38544f04db42 # SEE: https://hub.docker.com/r/hadolint/hadolint/tags
18+
# docker/hashicorp/terraform 1.5.6@sha256:180a7efa983386a27b43657ed610e9deed9e6c3848d54f9ea9b6cb8a5c8c25f5 # SEE: https://hub.docker.com/r/hashicorp/terraform/tags
1719
# docker/jdkato/vale v3.6.0@sha256:0ef22c8d537f079633cfff69fc46f69a2196072f69cab1ab232e8a79a388e425 # SEE: https://hub.docker.com/r/jdkato/vale/tags
1820
# docker/koalaman/shellcheck latest@sha256:e40388688bae0fcffdddb7e4dea49b900c18933b452add0930654b2dea3e7d5c # SEE: https://hub.docker.com/r/koalaman/shellcheck/tags
1921
# docker/mstruebing/editorconfig-checker 2.7.1@sha256:dd3ca9ea50ef4518efe9be018d669ef9cf937f6bb5cfe2ef84ff2a620b5ddc24 # SEE: https://hub.docker.com/r/mstruebing/editorconfig-checker/tags

Makefile

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@ MAKE_DIR := $(abspath $(shell pwd))
77

88
#Installs dependencies using poetry.
99
install-python:
10-
poetry install
10+
poetry install --no-root
1111

1212
#Installs dependencies using npm.
1313
install-node:
1414
npm install --legacy-peer-deps
1515

16-
#Configures Git Hooks, which are scripts that run given a specified event.
17-
.git/hooks/pre-commit:
18-
cp scripts/pre-commit .git/hooks/pre-commit
19-
2016
#Condensed Target to run all targets above.
2117
install: install-node install-python .git/hooks/pre-commit
2218

@@ -33,11 +29,12 @@ format: ## Format and fix code
3329
poetry run ruff check . --fix-only
3430

3531
#Creates the fully expanded OAS spec in json
36-
publish: clean
32+
generate-sandbox-spec: clean
3733
mkdir -p build
3834
mkdir -p sandbox/specification
3935
npm run publish 2> /dev/null
40-
cp build/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json
36+
cp build/specification/sandbox/eligibility-signposting-api.json sandbox/specification/eligibility-signposting-api.json
37+
4138
#Files to loop over in release
4239
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests"
4340

@@ -66,6 +63,26 @@ get-spec: # Get the most recent specification live in proxygen
6663
$(MAKE) setup-proxygen-credentials
6764
proxygen spec get
6865

66+
get-spec-uat: # Get the most recent specification live in proxygen
67+
$(MAKE) setup-proxygen-credentials
68+
proxygen spec get --uat
69+
70+
publish-spec: # Publish the specification to proxygen
71+
$(MAKE) setup-proxygen-credentials
72+
proxygen spec publish --specification-file build/prod/eligibility-signposting-api.yaml
73+
74+
publish-spec-uat: # Publish the specification to proxygen
75+
$(MAKE) setup-proxygen-credentials
76+
proxygen spec publish --specification-file build/preprod/eligibility-signposting-api.yaml --uat
77+
78+
delete-spec: # Delete the specification from proxygen
79+
$(MAKE) setup-proxygen-credentials
80+
proxygen spec delete
81+
82+
delete-spec-uat: # Delete the specification from proxygen
83+
$(MAKE) setup-proxygen-credentials
84+
proxygen spec delete --uat
85+
6986
# Specification
7087

7188
guard-%:
@@ -107,9 +124,12 @@ endif
107124

108125
construct-spec: guard-APIM_ENV
109126
@ $(MAKE) update-spec-template APIM_ENV=$$APIM_ENV
110-
mkdir -p build/specification && \
127+
mkdir -p build/specification/$(APIM_ENV) && \
111128
npx redocly bundle specification/eligibility-signposting-api.yaml --remove-unused-components --keep-url-references --ext yaml \
112-
> build/specification/eligibility-signposting-api.yaml
129+
> build/specification/$(APIM_ENV)/eligibility-signposting-api.yaml
130+
ifeq ($(APIM_ENV),sandbox)
131+
yq 'del(.components.securitySchemes)' build/specification/sandbox/eligibility-signposting-api.yaml > build/specification/sandbox/eligibility-signposting-api.yaml.tmp && mv build/specification/sandbox/eligibility-signposting-api.yaml.tmp build/specification/sandbox/eligibility-signposting-api.yaml
132+
endif
113133

114134
SPEC_DIR := $(CURDIR)/specification
115135
POSTMAN_DIR := $(SPEC_DIR)/postman
@@ -118,8 +138,9 @@ convert-postman: # Create Postman collection from OAS spec
118138
mkdir -p $(POSTMAN_DIR)
119139
cp $(SPEC_DIR)/eligibility-signposting-api.yaml $(POSTMAN_DIR)/
120140
docker build -t portman-converter -f $(POSTMAN_DIR)/Dockerfile $(SPEC_DIR)
121-
docker run --rm -v $(SPEC_DIR):/app portman-converter \
141+
docker run --rm -u $(shell id -u):$(shell id -g) -v $(SPEC_DIR):/app portman-converter \
122142
portman -l /app/eligibility-signposting-api.yaml -o /app/postman/collection.json
143+
echo >> $(POSTMAN_DIR)/collection.json
123144
rm $(POSTMAN_DIR)/eligibility-signposting-api.yaml
124145
# ==============================================================================
125146

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "OAS (Swagger v3) API Definition for Template API",
55
"scripts": {
66
"lint": "node_modules/.bin/openapi-generator-cli validate -i specification/eligibility-signposting-api.yaml",
7-
"publish": "./node_modules/.bin/openapi-generator-cli generate -i build/specification/eligibility-signposting-api.yaml --generator-key v3.0 -g openapi -o build && rm openapitools.json && mv build/openapi.json build/eligibility-signposting-api.json",
7+
"publish": "./node_modules/.bin/openapi-generator-cli generate -i build/specification/sandbox/eligibility-signposting-api.yaml --generator-key v3.0 -g openapi -o build && rm openapitools.json && mv build/openapi.json build/specification/sandbox/eligibility-signposting-api.json",
88
"check-licenses": "node_modules/.bin/license-checker --failOn GPL --failOn LGPL"
99
},
1010
"author": "NHS Digital",

0 commit comments

Comments
 (0)