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