📦 build(ci): aggiungi workflow CI, release e manutenzione python

- 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
This commit is contained in:
LucaZanni
2026-04-08 17:03:29 +02:00
parent edb33df3b8
commit c16b182607
8 changed files with 543 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
# Copia in: .gitea/workflows/ci.yml
# Usato da: microservizi Python con FastAPI / pyproject.toml
#
# Requisiti pyproject.toml:
# [project.optional-dependencies]
# dev = ["ruff", "mypy", "pytest", ...]
#
# Input opzionali:
# python-version: '3.11' # default già impostato
# install-extras: 'dev' # default già impostato
name: CI
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'
pull_request:
branches:
- main
jobs:
quality-gates:
uses: https://gitea.com/Punga78/shared-actions/.gitea/workflows/python-quality-gates.yml@v1
secrets: inherit
# with:
# python-version: '3.11' # opzionale, default già impostato
# install-extras: 'dev' # opzionale, default già impostato
+42
View File
@@ -0,0 +1,42 @@
# Copia in: .gitea/workflows/maintenance.yml
# Trigger:
# - PR merged → cleanup branch sorgente
# - Ogni lunedì 08:00 → security audit vulnerabilità (settimanale)
# - Ogni 1° del mese → controllo pacchetti obsoleti (mensile)
# - Manuale → workflow_dispatch (esegue tutti i job di manutenzione)
name: Maintenance
on:
pull_request:
types: [closed]
schedule:
- cron: '0 8 * * 1' # ogni lunedì alle 08:00 → security audit
- cron: '0 8 1 * *' # ogni 1° del mese alle 08:00 → outdated check
workflow_dispatch:
jobs:
branch-cleanup:
if: gitea.event_name == 'pull_request' && gitea.event.pull_request.merged == true
uses: https://gitea.com/Punga78/shared-actions/.gitea/workflows/branch-cleanup.yml@v1
secrets: inherit
dependency-audit:
if: >
gitea.event_name == 'workflow_dispatch' ||
(gitea.event_name == 'schedule' && gitea.event.schedule == '0 8 * * 1')
uses: https://gitea.com/Punga78/shared-actions/.gitea/workflows/python-dependency-check.yml@v1
secrets: inherit
# with:
# python-version: '3.11'
# install-extras: 'dev'
dependency-outdated:
if: >
gitea.event_name == 'workflow_dispatch' ||
(gitea.event_name == 'schedule' && gitea.event.schedule == '0 8 1 * *')
uses: https://gitea.com/Punga78/shared-actions/.gitea/workflows/python-dependency-outdated.yml@v1
secrets: inherit
# with:
# python-version: '3.11'
# install-extras: 'dev'
+30
View File
@@ -0,0 +1,30 @@
# Copia in: .gitea/workflows/release.yml
# Trigger: git tag v* → build Docker + crea release Gitea
#
# NOTA: i job girano in parallelo (non sequenziali con needs).
# Gitea bug #31900: needs + workflow_call + checkout causa errori di autenticazione.
#
# Prerequisiti:
# - Dockerfile presente nella root del progetto
# - pyproject.toml con [project] name e version
# - Secrets: G_USER (docker login), NPM_TOKEN (usato come password registry)
name: Release
on:
push:
tags:
- 'v*'
jobs:
docker-release:
uses: https://gitea.com/Punga78/shared-actions/.gitea/workflows/python-docker-release.yml@v1
secrets: inherit
with:
runner: catthehacker-latest # runner con Docker pre-installato
# python-version: '3.11' # opzionale
# install-extras: 'dev' # opzionale
auto-release:
uses: https://gitea.com/Punga78/shared-actions/.gitea/workflows/python-auto-release.yml@v1
secrets: inherit