P1 — deploy-k8s.yaml: - Add set -euo pipefail to all run blocks - Replace sed-based image tag patching with yq for YAML-safe updates - Add source commit SHA and CI run link to deploy commit messages - Install yq v4.44.1 as prerequisite step P1 — build-push.yaml: - Add runner input parameter for future ARM64 self-hosted runners (default: ubuntu-latest with QEMU emulation) P2 — test-python.yaml: - Add pyproject.toml support (pip install -e) before requirements.txt fallback P2 — build-push.yaml: - Pin catthehacker/ubuntu container image to act-22.04 (was act-latest) Ref: CON-578
55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
# Reusable workflow: Python testing with pytest
|
|
# Usage: uses: wectrl-net/ci-templates/.gitea/workflows/test-python.yaml@main
|
|
name: Test Python (pytest)
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
python-version:
|
|
description: "Python version to use"
|
|
required: false
|
|
type: string
|
|
default: "3.13"
|
|
working-directory:
|
|
description: "Directory containing the Python project"
|
|
required: false
|
|
type: string
|
|
default: "."
|
|
install-command:
|
|
description: "Command to install dependencies (empty = pip install pytest pytest-asyncio)"
|
|
required: false
|
|
type: string
|
|
default: ""
|
|
pytest-args:
|
|
description: "Additional pytest arguments"
|
|
required: false
|
|
type: string
|
|
default: "--ignore=venv -q"
|
|
|
|
jobs:
|
|
test:
|
|
name: pytest
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ inputs.python-version }}
|
|
- name: Install dependencies
|
|
run: |
|
|
if [ -n "${{ inputs.install-command }}" ]; then
|
|
${{ inputs.install-command }}
|
|
elif [ -f "${{ inputs.working-directory }}/pyproject.toml" ]; then
|
|
pip install -e "${{ inputs.working-directory }}"
|
|
pip install pytest pytest-asyncio
|
|
elif [ -f "${{ inputs.working-directory }}/requirements.txt" ]; then
|
|
pip install -r ${{ inputs.working-directory }}/requirements.txt
|
|
pip install pytest pytest-asyncio
|
|
else
|
|
pip install pytest pytest-asyncio
|
|
fi
|
|
working-directory: ${{ inputs.working-directory }}
|
|
- name: Run tests
|
|
run: pytest ${{ inputs.pytest-args }}
|
|
working-directory: ${{ inputs.working-directory }}
|