Skip to content

Generate one file per resource in every layer #153

Generate one file per resource in every layer

Generate one file per resource in every layer #153

name: Python Copier API Build
on:
push:
paths:
- python/**
- .github/workflows/build-python-pipeline.yaml
- .github/actions/setup-copier-template/**
branches:
- main
pull_request:
paths:
- python/**
- .github/workflows/build-python-pipeline.yaml
- .github/actions/setup-copier-template/**
jobs:
build-python:
runs-on: ${{ matrix.os }}
strategy:
# Windows and macOS risks don't depend on the cloud, so each runs once.
matrix:
os:
- ubuntu-latest
template-type:
- python
cloud-service:
- "Azure Function App"
- "GCP Cloud Function"
- "AWS Lambda"
python-version:
- "3.14"
fixture:
- single
- edge
include:
- os: windows-latest
template-type: python
cloud-service: "Azure Function App"
python-version: "3.14"
fixture: single
- os: macos-latest
template-type: python
cloud-service: "AWS Lambda"
python-version: "3.14"
fixture: single
fail-fast: false
steps:
- name: Check out
uses: actions/checkout@v7
- name: Setup Copier Template
uses: ./.github/actions/setup-copier-template
with:
template-language: ${{ matrix.template-type }}
template-cloud-service: ${{ matrix.cloud-service }}
resources-fixture: ${{ matrix.fixture }}
python-version: ${{ matrix.python-version }}
- name: Install Poetry
env:
POETRY_VERSION: "2.5.1"
run: curl -sSL https://install.python-poetry.org | python - -y
shell: bash
- name: Add Poetry to Path (Linux and macOS)
if: runner.os != 'Windows'
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: Add Poetry to Path (Windows)
if: runner.os == 'Windows'
run: echo "$HOME\\AppData\\Roaming\\Python\\Scripts" >> $GITHUB_PATH
shell: bash
- name: Configure Poetry virtual environment in project
run: poetry config virtualenvs.in-project true
shell: bash
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v6
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.cloud-service }}-${{ matrix.fixture }}-${{ hashFiles('**/pyproject.toml') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
cd "KittenClaws"
poetry install --no-interaction
shell: bash
- name: Run lint
run: |
cd "KittenClaws"
poetry run ruff check .
shell: bash
- name: Run unit tests
run: |
cd "KittenClaws"
poetry run pytest --cov
shell: bash
- name: Run Makefile targets
if: runner.os != 'Windows'
run: |
cd "KittenClaws"
make install
make test-unit
shell: bash
- name: Run dependency vulnerability scan
continue-on-error: true
uses: ./.github/actions/dependency-audit
with:
command: poetry run pip install -q pip-audit && poetry run pip-audit
title: Python dependency vulnerability scan (${{ matrix.cloud-service }}, ${{ matrix.fixture }})