File tree Expand file tree Collapse file tree 6 files changed +140
-13
lines changed
Expand file tree Collapse file tree 6 files changed +140
-13
lines changed Original file line number Diff line number Diff line change 1+ name : ' CDK Synth'
2+ description : ' Check CDK output is valid'
3+ inputs :
4+ dc-environment :
5+ description : ' Environment to deploy to (development, staging, production)'
6+ required : true
7+ aws-role-arn :
8+ description : ' ARN of AWS account to assume'
9+ required : true
10+
11+ runs :
12+ using : composite
13+ steps :
14+
15+ - name : Check out repository
16+ uses : actions/checkout@v4
17+
18+ - name : Python setup
19+ uses : ./.github/actions/python-setup
20+
21+ - name : Node setup
22+ uses : ./.github/actions/node-setup
23+
24+ - name : Configure AWS Credentials
25+ uses : aws-actions/configure-aws-credentials@v4
26+ with :
27+ aws-region : eu-west-2
28+ role-to-assume : ${{ inputs.aws-role-arn }}
29+
30+ - name : CDK Synth
31+ run : scripts/cdk-synth --all
32+ shell : bash
33+ env :
34+ DC_ENVIRONMENT : ${{ inputs.dc-environment }}
Original file line number Diff line number Diff line change 1+ name : ' Node Setup'
2+ description : ' Install node/npm and dependencies'
3+
4+ runs :
5+ using : composite
6+ steps :
7+ - name : Install node
8+ uses : actions/setup-node@v4
9+ with :
10+ node-version : " 18"
11+ cache : ' npm'
12+
13+ - name : Install node modules
14+ run : npm ci
15+ shell : bash
Original file line number Diff line number Diff line change 1+ name : ' Python Setup'
2+ description : ' Install uv, python and dependencies'
3+
4+ runs :
5+ using : composite
6+ steps :
7+ - name : Install python
8+ uses : actions/setup-python@v5
9+
10+ - name : Install uv
11+ uses : astral-sh/setup-uv@v5
12+ with :
13+ enable-cache : true
14+ cache-suffix : " uv-cache-v1"
15+ cache-dependency-glob : |
16+ **/uv.lock
17+ **/pyproject.toml
18+
19+ - name : Create venv
20+ run : uv sync
21+ shell : bash
Original file line number Diff line number Diff line change @@ -15,19 +15,11 @@ jobs:
1515 with :
1616 persist-credentials : false
1717
18- - name : Install python
19- uses : actions/setup-python@v5
20- with :
21- python-version : ' 3.12'
18+ - name : Python setup
19+ uses : ./.github/actions/python-setup
2220
23- - name : Install uv
24- uses : astral-sh/setup-uv@v5
25- with :
26- enable-cache : true
27- cache-suffix : " uv-cache-v1"
28- cache-dependency-glob : |
29- **/uv.lock
30- **/pyproject.toml
21+ - name : Node setup
22+ uses : ./.github/actions/node-setup
3123
3224 - name : Check Workflows
3325 run : uvx zizmor --format sarif . > zizmor-results.sarif
4032# sarif_file: zizmor-results.sarif
4133# category: zizmor
4234
43-
4435 - name : Pre-test checks
4536 run : uv run scripts/code-check
4637
Original file line number Diff line number Diff line change 1+ name : CDK Synth
2+
3+ on :
4+ # workflow_run:
5+ # workflows: ["Build and Test"]
6+ # types: [completed]
7+ push :
8+ branches : [github-actions-deploy]
9+
10+ permissions :
11+ id-token : write
12+
13+ jobs :
14+ cdk-synth-development :
15+ name : CDK Synth (Development)
16+ runs-on : ubuntu-22.04
17+ environment : development
18+ steps :
19+ - name : CDK Synth Development
20+ uses : ./.github/actions/cdk-synth
21+ with :
22+ dc-environment : ${{ vars.DC_ENVIRONMENT }}
23+ aws-role-arn : ${{ secrets.AWS_ROLE_ARN }}
24+
25+ cdk-synth-staging :
26+ name : CDK Synth (Staging)
27+ if : ${{ github.ref == 'refs/heads/github-actions-deploy' }} # ToDo: Change to main
28+ needs : cdk-synth-development
29+ runs-on : ubuntu-22.04
30+ environment : staging
31+ steps :
32+ - name : CDK Synth Staging
33+ uses : ./.github/actions/cdk-synth
34+ with :
35+ dc-environment : ${{ vars.DC_ENVIRONMENT }}
36+ aws-role-arn : ${{ secrets.AWS_ROLE_ARN }}
37+
38+ cdk-synth-production :
39+ name : CDK Synth (Production)
40+ if : ${{ github.ref == 'refs/heads/main' }}
41+ needs : cdk-synth-staging
42+ runs-on : ubuntu-22.04
43+ environment : production
44+ steps :
45+ - name : CDK Synth Production
46+ uses : ./.github/actions/cdk-synth
47+ with :
48+ dc-environment : ${{ vars.DC_ENVIRONMENT }}
49+ aws-role-arn : ${{ secrets.AWS_ROLE_ARN }}
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -euxo pipefail
3+
4+ # Echo environment information
5+ echo " Running CDK synth with DC_ENVIRONMENT=$DC_ENVIRONMENT "
6+ if [ -n " ${AWS_PROFILE+x} " ]; then
7+ echo " Using AWS_PROFILE=$AWS_PROFILE "
8+ fi
9+
10+ # Check if CDK is available in node_modules
11+ if [ -f " ./node_modules/.bin/cdk" ]; then
12+ echo " Using CDK from node_modules"
13+ uv run ./node_modules/.bin/cdk synth " $@ "
14+ else
15+ echo " Error: CDK not found in node_modules. Make sure it's installed with 'npm ci'"
16+ exit 1
17+ fi
You can’t perform that action at this time.
0 commit comments