Add optional CDK synth support to Python CI workflow (#10)

Enables Python CDK repos (po-ingest, workorder-ingest) to use the
same reusable workflow. Adds run-cdk-synth, cdk-dir, and node-version
inputs. Refactors dependency install to be shared between pytest and
cdk synth paths.
This commit is contained in:
Adam Moussa 2026-05-08 15:38:30 -04:00 • committed by GitHub
parent d042bd7bdc
commit f92ac07ce6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,6 +23,18 @@ on:
description: "Path to SAM template file"
type: string
default: "template.yaml"
run-cdk-synth:
description: "Run cdk synth (for Python CDK repos)"
type: boolean
default: false
cdk-dir:
description: "Directory containing cdk.json"
type: string
default: "cdk"
node-version:
description: "Node.js version for CDK CLI"
type: string
default: "22"
jobs:
ci:
@ -44,10 +56,12 @@ jobs:
- name: Ruff format check
run: ruff format --check ${{ inputs.source-dirs }}
- name: Install test dependencies
if: ${{ inputs.run-tests }}
- name: Install Python dependencies
if: ${{ inputs.run-tests || inputs.run-cdk-synth }}
run: |
pip install pytest
if [ "${{ inputs.run-tests }}" = "true" ]; then
pip install pytest
fi
for req in $(find . -name requirements.txt -not -path './.aws-sam/*'); do
pip install -r "$req"
done
@ -56,6 +70,17 @@ jobs:
if: ${{ inputs.run-tests }}
run: pytest
- name: Setup Node.js
if: ${{ inputs.run-cdk-synth }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- name: CDK synth
if: ${{ inputs.run-cdk-synth }}
working-directory: ${{ inputs.cdk-dir }}
run: npx -y cdk synth --quiet
- name: Setup SAM CLI
if: ${{ inputs.run-sam-validate }}
uses: aws-actions/setup-sam@v2