Skip to content

Commit a39fbcb

Browse files
Merge pull request #101 from NHSDigital/develop
Develop
2 parents 33627ab + dca84de commit a39fbcb

File tree

64 files changed

+3348
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3348
-191
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ __pycache__/
2121
tests/test-report.xml
2222
tests/functional-test-report.xml
2323
.orig
24+
25+
.python-version

Makefile

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
SHELL=/bin/bash -euo pipefail
22

3-
install: install-node install-python install-hooks
3+
install: install-node install-poetry install-hooks
44

5-
install-python:
5+
install-poetry:
66
poetry install
77

88
install-node:
@@ -13,8 +13,11 @@ install-hooks:
1313
cp scripts/pre-commit .git/hooks/pre-commit
1414

1515
lint: copy-examples
16-
npm run lint
16+
npm run lint-oas
17+
cd sandbox && make lint
18+
poetry run python scripts/xml_validator.py
1719
poetry run flake8 **/*.py
20+
@printf "\nLinting passed.\n\n"
1821

1922
clean:
2023
rm -rf build
@@ -35,9 +38,6 @@ check-licenses:
3538
npm run check-licenses
3639
scripts/check_python_licenses.sh
3740

38-
format:
39-
poetry run black **/*.py
40-
4141
sandbox: update-examples
4242
cd sandbox && npm run start
4343

@@ -53,3 +53,23 @@ release: clean publish build-proxy
5353

5454
test:
5555
echo "TODO: add tests"
56+
57+
setup-environment:
58+
@if [ -e /usr/bin/yum ]; then \
59+
scripts/rhel_setup_environment.sh; \
60+
elif [ -e /usr/local/bin/brew ]; then \
61+
echo "TODO is Mac"; \
62+
else \
63+
echo "Environment not Mac or RHEL"; \
64+
fi
65+
66+
clean-environment:
67+
@if [ -e /usr/bin/yum ]; then \
68+
scripts/rhel_clean_environment.sh; \
69+
elif [ -e /usr/local/bin/brew ]; then \
70+
echo "TODO is Mac"; \
71+
else \
72+
echo "Environment not Mac or RHEL"; \
73+
fi
74+
75+
.PHONY: setup-environment clean-environment

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,34 @@ The contents of this repository are protected by Crown Copyright (C).
2626
* nodejs + npm/yarn
2727
* [poetry](https://github.com/python-poetry/poetry)
2828

29-
### Install
29+
### Environment setup
30+
Currently, automation for setting up the right environment is only available for machines based on RedHatEnterpriseLinux (RHEL).
31+
Running the following will ensure your environment is ready for development.
32+
It will install [pyenv](https://github.com/pyenv/pyenv), Python 3.8.2 and its dependencies (yum), create a virtual environment (named apigee), and ensure poetry is installed under it.
3033
```
31-
$ make install
34+
$ make setup-environment
3235
```
36+
>Activating apigee is now done by the file .python-version, so cd'ing into the repository directory will suffice to use the virtual environment.
3337
34-
#### Updating hooks
35-
You can install some pre-commit hooks to ensure you can't commit invalid spec changes by accident. These are also run
36-
in CI, but it's useful to run them locally too.
38+
If you wish to remove all changes made by setup-environment, you can run the following:
39+
```
40+
$ make clean-environment
41+
```
42+
> This will erase your ~/.pyenv directory, where pyenv stores the different Python versions, and will revert ~/.bashrc and ~./bash_profile. You may want to logout/login for changes to take effect.
3743
44+
### Install
45+
After setting up and activating the right environment, running make install will set up additional configuration pertaining to node, poetry and githooks.
3846
```
39-
$ make install-hooks
47+
$ make install
4048
```
4149

50+
> #### Updating hooks
51+
> You can install/update some pre-commit hooks to ensure you can't commit invalid spec changes by accident. These are also run in CI, but it's useful to run them locally too.
52+
>
53+
>```
54+
>$ make install-hooks
55+
>```
56+
4257
### Environment Variables
4358
Various scripts and commands rely on environment variables being set. These are documented with the commands.
4459

azure/azure-release-pipeline.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extends:
3232
service_base_path: ${{ variables.service_base_path }}
3333
product_display_name: ${{ variables.product_display_name }}
3434
product_description: ${{ variables.product_description }}
35-
enable_status_monitoring: false
35+
enable_status_monitoring: true
3636
manual_approval_env: manual-approval-ptl
3737
spec_file: ${{ variables.spec_file }}
3838
apigee_deployments:
@@ -89,6 +89,13 @@ extends:
8989
make_spec_visible: true
9090
depends_on:
9191
- manual_approval_int
92+
- environment: manual-approval
93+
stage_name: manual_approval_nft2
94+
- environment: ref
95+
stage_name: ers_nft2_release
96+
make_spec_visible: true
97+
depends_on:
98+
- manual_approval_nft2
9299
- environment: internal-qa-sandbox
93100
proxy_path: sandbox
94101
depends_on:

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.1",
44
"description": "OAS (Swagger v3) API Definition for Template API",
55
"scripts": {
6-
"lint": "node_modules/.bin/speccy lint -s openapi-tags -s operation-tags specification/e-referrals-service-api.yaml --skip default-and-example-are-redundant",
6+
"lint-oas": "node_modules/.bin/speccy lint -s openapi-tags -s operation-tags specification/e-referrals-service-api.yaml --skip default-and-example-are-redundant",
77
"publish": "mkdir -p build && node_modules/.bin/speccy resolve specification/e-referrals-service-api.yaml -i | poetry run python scripts/yaml2json.py | poetry run python scripts/set_version.py | poetry run python scripts/populate_placeholders.py > build/e-referrals-service-api.json",
88
"serve": "node_modules/.bin/speccy serve build/e-referrals-service-api.json",
99
"check-licenses": "node_modules/.bin/license-checker --failOn GPL --failOn LGPL"
@@ -15,11 +15,11 @@
1515
"speccy": "^0.11.0"
1616
},
1717
"devDependencies": {
18-
"newman": "^4.5.7",
19-
"newman-reporter-html": "^1.0.5",
20-
"newman-reporter-htmlextra": "^1.11.3",
2118
"apigeetool": "^0.14.2",
2219
"license-checker": "^25.0.1",
23-
"minimist": "^1.2.2"
20+
"minimist": "^1.2.2",
21+
"newman": "^4.5.7",
22+
"newman-reporter-html": "^1.0.5",
23+
"newman-reporter-htmlextra": "^1.11.3"
2424
}
2525
}

0 commit comments

Comments
 (0)