From f92ac07ce69d324f6ad868721bb6f348f85d29d1 Mon Sep 17 00:00:00 2001 From: Adam Moussa <166072409+amoussa1229@users.noreply.github.com> Date: Fri, 8 May 2026 15:38:30 -0400 Subject: [PATCH] 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. --- .github/workflows/ci-python-sam.yaml | 31 +++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-python-sam.yaml b/.github/workflows/ci-python-sam.yaml index 045924d..eae99be 100644 --- a/.github/workflows/ci-python-sam.yaml +++ b/.github/workflows/ci-python-sam.yaml @@ -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