Reusable Gitea Actions workflows for lint, test, build, and deploy: - lint-python, lint-node, lint-rust - test-python, test-node, test-rust - build-push (Docker build + push to Gitea registry) - deploy-k8s (GitOps image tag update in cluster repo) Plus example caller workflows for python-fullstack, rust-service, and node-frontend stacks. Branch refs aligned to staging per CON-570 standards.
52 lines
1.6 KiB
YAML
52 lines
1.6 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 }}/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 }}
|