mirror of
https://github.com/Sea-Haven-Industries/.github.git
synced 2026-10-02 22:43:26 +00:00
Add optional CDK synth support to Python CI workflow
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:
parent
d042bd7bdc
commit
1a309d74a1
1 changed files with 28 additions and 3 deletions
31
.github/workflows/ci-python-sam.yaml
vendored
31
.github/workflows/ci-python-sam.yaml
vendored
|
|
@ -23,6 +23,18 @@ on:
|
||||||
description: "Path to SAM template file"
|
description: "Path to SAM template file"
|
||||||
type: string
|
type: string
|
||||||
default: "template.yaml"
|
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:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
|
@ -44,10 +56,12 @@ jobs:
|
||||||
- name: Ruff format check
|
- name: Ruff format check
|
||||||
run: ruff format --check ${{ inputs.source-dirs }}
|
run: ruff format --check ${{ inputs.source-dirs }}
|
||||||
|
|
||||||
- name: Install test dependencies
|
- name: Install Python dependencies
|
||||||
if: ${{ inputs.run-tests }}
|
if: ${{ inputs.run-tests || inputs.run-cdk-synth }}
|
||||||
run: |
|
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
|
for req in $(find . -name requirements.txt -not -path './.aws-sam/*'); do
|
||||||
pip install -r "$req"
|
pip install -r "$req"
|
||||||
done
|
done
|
||||||
|
|
@ -56,6 +70,17 @@ jobs:
|
||||||
if: ${{ inputs.run-tests }}
|
if: ${{ inputs.run-tests }}
|
||||||
run: pytest
|
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
|
- name: Setup SAM CLI
|
||||||
if: ${{ inputs.run-sam-validate }}
|
if: ${{ inputs.run-sam-validate }}
|
||||||
uses: aws-actions/setup-sam@v2
|
uses: aws-actions/setup-sam@v2
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue