c16b182607
- aggiunto esempio workflow CI per python con quality gates
- aggiunto esempio workflow manutenzione con branch cleanup, audit sicurezza e check pacchetti obsoleti
- aggiunto esempio workflow release per build docker e auto-release gitea
📦 build(shared-actions): aggiungi shared-actions python per CI/CD
- aggiunto python-quality-gates.yml per lint, format, type check e test
- aggiunto python-auto-release.yml per changelog e rilascio automatico
- aggiunto python-docker-release.yml per build e push immagini docker
- aggiunto python-dependency-check.yml per audit sicurezza dipendenze
- aggiunto python-dependency-outdated.yml per verifica pacchetti obsoleti
66 lines
1.9 KiB
YAML
66 lines
1.9 KiB
YAML
name: Python Quality Gates
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
python-version:
|
|
type: string
|
|
default: '3.11'
|
|
install-extras:
|
|
description: 'Extras pip da installare (es: dev, test). Lasciare vuoto per solo requirements.txt'
|
|
type: string
|
|
default: 'dev'
|
|
working-directory:
|
|
description: 'Directory di lavoro se il progetto non è in root'
|
|
type: string
|
|
default: '.'
|
|
|
|
jobs:
|
|
python-quality-gates:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ inputs.working-directory }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://gitea.com/actions/checkout@v4
|
|
|
|
- name: Setup Python
|
|
uses: https://github.com/actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ inputs.python-version || '3.11' }}
|
|
|
|
- name: Cache pip
|
|
uses: https://gitea.com/actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ inputs.python-version }}-${{ hashFiles('**/pyproject.toml', '**/requirements*.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-${{ inputs.python-version }}-
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
if [ -n "${{ inputs.install-extras }}" ]; then
|
|
pip install -e ".[${{ inputs.install-extras }}]"
|
|
elif [ -f requirements-dev.txt ]; then
|
|
pip install -r requirements-dev.txt
|
|
elif [ -f requirements.txt ]; then
|
|
pip install -r requirements.txt
|
|
else
|
|
pip install -e "."
|
|
fi
|
|
|
|
- name: Lint (ruff)
|
|
run: ruff check .
|
|
|
|
- name: Format check (ruff)
|
|
run: ruff format --check .
|
|
|
|
- name: Type check (mypy)
|
|
run: mypy .
|
|
|
|
- name: Test (pytest)
|
|
run: pytest --tb=short -q
|