Skip to content

Commit d3f8061

Browse files
authored
Merge branch 'master' into APM-000-AMP-3654-removed-interactive-product-backlog
2 parents 34bd648 + caca6aa commit d3f8061

File tree

246 files changed

+13010
-3597
lines changed

Some content is hidden

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

246 files changed

+13010
-3597
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ updates:
5858
- "/mesh_processor"
5959
- "/recordprocessor"
6060
- "/redis_sync"
61+
- "/lambdas/id_sync"
62+
- "/lambdas/shared"
63+
- "/mns_subscription"
6164
schedule:
6265
interval: "daily"
6366
open-pull-requests-limit: 1
@@ -71,7 +74,6 @@ updates:
7174
directories:
7275
- "/grafana/non-prod/terraform"
7376
- "/infra"
74-
- "/mesh-infra"
7577
- "/terraform"
7678
- "/terraform_aws_backup/**"
7779
schedule:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Deploy Blue Green - INT
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [master]
7+
8+
jobs:
9+
deploy-green:
10+
uses: ./.github/workflows/deploy-template.yml
11+
with:
12+
environment: green
13+
14+
deploy-blue:
15+
needs: deploy-green
16+
uses: ./.github/workflows/deploy-template.yml
17+
with:
18+
environment: blue
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Deploy to INT and run E2e test
2+
on:
3+
workflow_call:
4+
inputs:
5+
environment:
6+
required: true
7+
type: string
8+
9+
jobs:
10+
terraform-plan:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: read
15+
steps:
16+
- name: Debug OIDC
17+
uses: aws-actions/configure-aws-credentials@v4
18+
with:
19+
aws-region: eu-west-2
20+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/auto-ops
21+
role-session-name: github-actions
22+
23+
- name: Whoami
24+
run: aws sts get-caller-identity
25+
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 1
30+
31+
- uses: hashicorp/setup-terraform@v3
32+
with:
33+
terraform_version: "1.12.2"
34+
35+
- name: Terraform Init
36+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
37+
run: |
38+
export ENVIRONMENT=${{ inputs.environment }}
39+
make init
40+
41+
- name: Terraform Plan
42+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
43+
run: |
44+
make plan environment=${{ inputs.environment }} aws_account_name=int
45+
46+
terraform-apply:
47+
needs: terraform-plan
48+
runs-on: ubuntu-latest
49+
permissions:
50+
id-token: write
51+
contents: read
52+
environment:
53+
name: int
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
58+
- uses: aws-actions/configure-aws-credentials@v4
59+
with:
60+
aws-region: eu-west-2
61+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/auto-ops
62+
role-session-name: github-actions
63+
64+
- uses: hashicorp/setup-terraform@v3
65+
with:
66+
terraform_version: "1.12.2"
67+
68+
- name: Terraform Init
69+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
70+
run: |
71+
export ENVIRONMENT=${{ inputs.environment }}
72+
make init
73+
74+
- name: Terraform Apply
75+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
76+
run: |
77+
make apply environment=${{ inputs.environment }} aws_account_name=int
78+
79+
e2e-tests:
80+
needs: terraform-apply
81+
if: ${{ vars.RUN_E2E == 'true' || inputs.environment == vars.ACTIVE_ENVIRONMENT }}
82+
runs-on: ubuntu-latest
83+
permissions:
84+
id-token: write
85+
contents: read
86+
steps:
87+
- name: Checkout
88+
uses: actions/checkout@v4
89+
90+
- uses: aws-actions/configure-aws-credentials@v4
91+
with:
92+
aws-region: eu-west-2
93+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/auto-ops
94+
role-session-name: github-actions
95+
96+
- name: Set up Python
97+
uses: actions/setup-python@v5
98+
with:
99+
python-version: "3.11"
100+
101+
- name: Install Poetry
102+
run: |
103+
curl -sSL https://install.python-poetry.org | python3 -
104+
echo "$HOME/.local/bin" >> $GITHUB_PATH
105+
106+
- name: Set Poetry to use Python 3.11
107+
working-directory: ${{ vars.E2E_DIR_PATH }}
108+
run: |
109+
poetry env use $(which python3.11)
110+
111+
- name: Install dependencies with Poetry
112+
working-directory: ${{ vars.E2E_DIR_PATH }}
113+
run: |
114+
poetry install --no-root
115+
116+
- name: Run e2e tests
117+
working-directory: ${{ vars.E2E_DIR_PATH }}
118+
run: |
119+
apigee_token=$(aws ssm get-parameter \
120+
--name "/imms/apigee/non-prod/token" \
121+
--with-decryption \
122+
--query "Parameter.Value" \
123+
--output text)
124+
125+
status_api_key=$(aws ssm get-parameter \
126+
--name "/imms/apigee/non-prod/status-api-key" \
127+
--with-decryption \
128+
--query "Parameter.Value" \
129+
--output text)
130+
131+
export APIGEE_ACCESS_TOKEN=$apigee_token
132+
133+
export APIGEE_ENVIRONMENT=int
134+
export STATUS_API_KEY=$status_api_key
135+
export PROXY_NAME=immunisation-fhir-api-internal-dev
136+
export SERVICE_BASE_PATH=immunisation-fhir-api/FHIR/R4
137+
export SSO_LOGIN_URL=https://login.apigee.com
138+
139+
make run-immunization

.github/workflows/sonarcloud.yml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
pull_request:
88
types: [labeled, opened, synchronize, reopened, unlabeled]
99

10+
env:
11+
SHARED_PATH: ${{ github.workspace }}/lambdas/shared
12+
LAMBDA_PATH: ${{ github.workspace }}/lambdas
13+
1014
jobs:
1115
sonarcloud:
1216
name: SonarCloud
@@ -18,13 +22,11 @@ jobs:
1822
fetch-depth: 0
1923

2024
- name: Install poetry
21-
run: pip install poetry==1.8.4
25+
run: pip install poetry==2.1.2
2226

2327
- uses: actions/setup-python@v5
2428
with:
25-
python-version: |
26-
3.10
27-
3.11
29+
python-version: 3.11
2830
cache: 'poetry'
2931

3032
- name: Set up AWS credentials
@@ -40,7 +42,6 @@ jobs:
4042
id: filenameprocessor
4143
continue-on-error: true
4244
run: |
43-
poetry env use 3.10
4445
poetry install
4546
poetry run coverage run -m unittest discover || echo "filenameprocessor tests failed" >> ../failed_tests.txt
4647
poetry run coverage xml -o ../filenameprocessor-coverage.xml
@@ -50,7 +51,6 @@ jobs:
5051
id: recordprocessor
5152
continue-on-error: true
5253
run: |
53-
poetry env use 3.10
5454
poetry install
5555
poetry run coverage run -m unittest discover || echo "recordprocessor tests failed" >> ../failed_tests.txt
5656
poetry run coverage xml -o ../recordprocessor-coverage.xml
@@ -63,7 +63,6 @@ jobs:
6363
PYTHONPATH: ${{ github.workspace }}/backend/src:${{ github.workspace }}/backend/tests
6464
continue-on-error: true
6565
run: |
66-
poetry env use 3.11
6766
poetry install
6867
poetry run coverage run -m unittest discover -s "./tests" -p "*batch*.py" || echo "recordforwarder tests failed" >> ../failed_tests.txt
6968
poetry run coverage xml -o ../recordforwarder-coverage.xml
@@ -73,7 +72,6 @@ jobs:
7372
id: acklambda
7473
continue-on-error: true
7574
run: |
76-
poetry env use 3.10
7775
poetry install
7876
poetry run coverage run -m unittest discover || echo "ack-lambda tests failed" >> ../failed_tests.txt
7977
poetry run coverage xml -o ../ack-lambda-coverage.xml
@@ -85,7 +83,6 @@ jobs:
8583
PYTHONPATH: delta_backend/src:delta_backend/tests
8684
continue-on-error: true
8785
run: |
88-
poetry env use 3.11
8986
poetry install
9087
poetry run coverage run -m unittest discover || echo "delta tests failed" >> ../failed_tests.txt
9188
poetry run coverage xml -o ../delta-coverage.xml
@@ -97,7 +94,6 @@ jobs:
9794
id: fhirapi
9895
continue-on-error: true
9996
run: |
100-
poetry env use 3.11
10197
poetry install
10298
poetry run coverage run -m unittest discover || echo "fhir-api tests failed" >> ../failed_tests.txt
10399
poetry run coverage xml -o ../backend-coverage.xml
@@ -107,23 +103,57 @@ jobs:
107103
id: meshprocessor
108104
continue-on-error: true
109105
run: |
110-
poetry env use 3.10
111106
poetry install
112107
poetry run coverage run -m unittest discover || echo "mesh_processor tests failed" >> ../failed_tests.txt
113108
poetry run coverage xml -o ../mesh_processor-coverage.xml
114109
110+
- name: Run unittest with coverage-mns-subscription
111+
working-directory: mns_subscription
112+
env:
113+
PYTHONPATH: ${{ github.workspace }}/mns_subscription/src:${{ github.workspace }}/mns_subscription/tests
114+
id: mns_subscription
115+
continue-on-error: true
116+
run: |
117+
poetry install
118+
poetry run coverage run -m unittest discover || echo "mns_subscription tests failed" >> ../failed_tests.txt
119+
poetry run coverage report -m
120+
poetry run coverage xml -o ../mns_subscription-coverage.xml
121+
115122
- name: Run unittest with redis_sync
116123
working-directory: redis_sync
117124
id: redis_sync
118125
env:
119126
PYTHONPATH: ${{ github.workspace }}/redis_sync/src:${{ github.workspace }}/redis_sync/tests
120127
continue-on-error: true
121128
run: |
122-
poetry env use 3.11
123129
poetry install
124130
poetry run coverage run -m unittest discover || echo "redis_sync tests failed" >> ../failed_tests.txt
125131
poetry run coverage xml -o ../redis_sync-coverage.xml
126132
133+
- name: Run unittest with shared
134+
working-directory: lambdas/shared
135+
id: shared
136+
env:
137+
PYTHONPATH: ${{ env.SHARED_PATH }}/src
138+
continue-on-error: true
139+
run: |
140+
poetry env use 3.11
141+
poetry install
142+
poetry run coverage run --rcfile=.coveragerc --source=src -m unittest discover -s tests -p "test_*.py" -v || echo "shared tests failed" >> ../../failed_tests.txt
143+
poetry run coverage xml -o ../../shared-coverage.xml
144+
145+
- name: Run unittest with id_sync
146+
working-directory: lambdas/id_sync
147+
id: id_sync
148+
env:
149+
PYTHONPATH: ${{ env.LAMBDA_PATH }}/id_sync/src:${{ env.SHARED_PATH }}/src
150+
continue-on-error: true
151+
run: |
152+
poetry env use 3.11
153+
poetry install
154+
poetry run coverage run --rcfile=.coveragerc --source=src -m unittest discover || echo "id_sync tests failed" >> ../../failed_tests.txt
155+
poetry run coverage xml -o ../../id_sync-coverage.xml
156+
127157
- name: Run Test Failure Summary
128158
id: check_failure
129159
run: |

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ openapi.json
2929
!**/.vscode/settings.json.default
3030

3131
devtools/volume/
32-
backend/tests/.coverage
32+
**/.coverage

.tool-versions

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
poetry 2.1.2
2+
nodejs 23.11.0
3+
python 3.11.12

Makefile

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
SHELL=/usr/bin/env bash -euo pipefail
22

3+
PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS = ack_backend backend delta_backend filenameprocessor mesh_processor recordprocessor redis_sync lambdas/id_sync lambdas/shared mns_subscription
4+
PYTHON_PROJECT_DIRS = e2e e2e_batch $(PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS)
5+
36
#Installs dependencies using poetry.
47
install-python:
58
poetry lock --no-update
@@ -38,7 +41,7 @@ build-proxy:
3841
scripts/build_proxy.sh
3942

4043
#Files to loop over in release
41-
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. e2e e2e_batch specification sandbox terraform scripts backend delta_backend ack_backend filenameprocessor recordprocessor mesh_processor redis_sync"
44+
_dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. specification sandbox terraform scripts $(PYTHON_PROJECT_DIRS) $(PYTHON_LAMBDA_DEPENDENCIES)"
4245

4346

4447
#Create /dist/ sub-directory and copy files into directory
@@ -85,3 +88,39 @@ test-prod:
8588

8689
setup-python-envs:
8790
scripts/setup-python-envs.sh
91+
92+
initialise-all-python-venvs:
93+
for dir in $(PYTHON_PROJECT_DIRS); do ( \
94+
cd $$dir && \
95+
pwd && \
96+
rm -rf .venv && \
97+
python -m venv .venv && \
98+
source .venv/bin/activate && \
99+
poetry install --no-root && \
100+
deactivate \
101+
); done
102+
103+
update-all-python-dependencies:
104+
for dir in $(PYTHON_PROJECT_DIRS); do ( \
105+
cd $$dir && \
106+
pwd && \
107+
source .venv/bin/activate && \
108+
poetry update && \
109+
deactivate \
110+
); done
111+
112+
run-all-python-unit-tests:
113+
for dir in $(PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS); do ( \
114+
cd $$dir && \
115+
pwd && \
116+
source .venv/bin/activate && \
117+
poetry run make test && \
118+
deactivate \
119+
); done
120+
121+
build-all-docker-images:
122+
for dir in $(PYTHON_PROJECT_DIRS_WITH_UNIT_TESTS); do \
123+
for dockerfile in $$(ls $$dir/*Dockerfile); do \
124+
echo $$dockerfile && docker build --file $$dockerfile $$dir; \
125+
done; \
126+
done

0 commit comments

Comments
 (0)