Files
shared-actions/.gitea/workflows/python-quality-gates-github.yml
T
LucaZanni 2d5eb0da4b ⬆️ chore(ci): actions/checkout passa alla v7 sui 25 step
- v6 -> v7 su tutti gli step, varianti gitea.com e -github
- il breaking change della v7 (rifiuto del codice di una PR da fork su
  pull_request_target e workflow_run) era gia' backportato in v6.1.0, dove il
  tag flottante v6 puntava: il delta reale e' ESM piu' dipendenze
- la guardia non si attiva comunque: serve un ref o un repository esplicito, e
  qui i checkout sono self-checkout nudi su workflow_call
- action.yml identico fra v6.1.0 e v7.0.1, stesso using node24: nessun
  requisito nuovo sui runner

Fixes #24 @1h30m
2026-10-19 16:19:52 +02:00

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://github.com/actions/checkout@v7
- name: Setup Python
uses: https://github.com/actions/setup-python@v7
with:
python-version: ${{ inputs.python-version || '3.11' }}
- name: Cache pip
uses: https://github.com/actions/cache@v6
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