Skip to content

Commit f8c9b59

Browse files
committed
Merge branch 'develop' of github.com:NHSDigital/NRLF into feature/eema1-NRL-708-fixValidationExceptionErrors
2 parents 18f558f + 01784e4 commit f8c9b59

File tree

335 files changed

+30646
-8905
lines changed

Some content is hidden

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

335 files changed

+30646
-8905
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Switch Active Stack
2+
run-name: Switch active stack to ${{ inputs.stack_name }} in ${{ inputs.environment }} by ${{ github.actor }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
environment:
8+
description: "Environment to activate the stack in"
9+
required: true
10+
default: "dev"
11+
type: environment
12+
13+
stack_name:
14+
description: Name of stack to activate
15+
required: true
16+
type: string
17+
18+
permissions:
19+
id-token: write
20+
contents: read
21+
actions: write
22+
23+
jobs:
24+
activate-stack:
25+
name: Activate ${{ inputs.stack_name }} for ${{ inputs.environment }}
26+
runs-on: [self-hosted, ci]
27+
environment: ${{ inputs.environment }}
28+
29+
steps:
30+
- name: Git clone - ${{ github.ref }}
31+
uses: actions/checkout@v4
32+
with:
33+
ref: ${{ github.ref }}
34+
35+
- name: Setup asdf cache
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.asdf
39+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
40+
restore-keys: |
41+
${{ runner.os }}-asdf-
42+
43+
- name: Install asdf
44+
uses: asdf-vm/actions/[email protected]
45+
with:
46+
asdf_branch: v0.13.1
47+
48+
- name: Configure Management Credentials
49+
uses: aws-actions/configure-aws-credentials@v4
50+
with:
51+
aws-region: eu-west-2
52+
role-to-assume: ${{ secrets.MGMT_ROLE_ARN }}
53+
role-session-name: github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
54+
55+
- name: Install zip
56+
run: sudo apt-get install zip
57+
58+
- name: Setup Python environment
59+
run: |
60+
poetry install --no-root
61+
source $(poetry env info --path)/bin/activate
62+
63+
- name: Get current environment config
64+
run: |
65+
poetry run python ./scripts/get_env_config.py all ${{ inputs.environment }}
66+
67+
- name: Activate Stack
68+
run: |
69+
poetry run python ./scripts/activate_stack.py ${{ inputs.stack_name }} ${{ inputs.environment }}

.github/workflows/daily-build.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build NRL Project on Environment
2+
run-name: Build NRL Project on ${{ inputs.environment || 'dev' }}
3+
permissions:
4+
id-token: write
5+
contents: read
6+
actions: write
7+
8+
on:
9+
schedule:
10+
- cron: "0 1 * * *"
11+
workflow_dispatch:
12+
inputs:
13+
environment:
14+
type: environment
15+
description: "The environment to deploy changes to"
16+
default: "dev"
17+
required: true
18+
19+
jobs:
20+
build:
21+
name: Build - develop
22+
runs-on: [self-hosted, ci]
23+
24+
steps:
25+
- name: Git clone - develop
26+
uses: actions/checkout@v4
27+
with:
28+
ref: develop
29+
30+
- name: Setup asdf cache
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.asdf
34+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
35+
restore-keys: |
36+
${{ runner.os }}-asdf-
37+
38+
- name: Install asdf
39+
uses: asdf-vm/actions/[email protected]
40+
with:
41+
asdf_branch: v0.13.1
42+
43+
- name: Install zip
44+
run: sudo apt-get install zip
45+
46+
- name: Setup Python environment
47+
run: |
48+
poetry install --no-root
49+
source $(poetry env info --path)/bin/activate
50+
51+
- name: Run Linting
52+
run: make lint
53+
54+
- name: Run Unit Tests
55+
run: make test
56+
57+
- name: Build Project
58+
run: make build
59+
60+
- name: Configure Management Credentials
61+
uses: aws-actions/configure-aws-credentials@v4
62+
with:
63+
aws-region: eu-west-2
64+
role-to-assume: ${{ secrets.MGMT_ROLE_ARN }}
65+
role-session-name: github-actions-ci-${{ inputs.environment || 'dev' }}-${{ github.run_id }}
66+
67+
- name: Add S3 Permissions to Lambda
68+
run: |
69+
account=$(echo '${{ inputs.environment || 'dev' }}' | cut -d '-' -f1)
70+
inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment || 'dev' }})
71+
make get-s3-perms ENV=${account} TF_WORKSPACE_NAME=${inactive_stack}
72+
73+
- name: Save Build Artifacts
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: build-artifacts
77+
path: |
78+
dist/*.zip
79+
!dist/nrlf_permissions.zip
80+
81+
- name: Save NRLF Permissions cache
82+
uses: actions/cache/save@v4
83+
with:
84+
key: ${{ github.run_id }}-nrlf-permissions
85+
path: dist/nrlf_permissions.zip

0 commit comments

Comments
 (0)