3 Commits
Author SHA1 Message Date
LucaZanni 7e13a831e7 🐛 fix(ci): vsix-release pubblica la release solo a pacchetto pronto
- Flusso unico: gate e build, release in bozza, allegato, pubblicazione e registro pacchetti generic
- Job rieseguibile, con errori espliciti su ogni chiamata e secrets controllati all'inizio
- Esempio estensione-vscode/release.yml senza auto-release

Fixes #30 @1h30m
2026-11-27 10:15:00 +01:00
LucaZanni b4ec52a4fe ✨ feat(ci): workflow riusabile vsix-release per le estensioni VS Code
- vsix-release.yml: controllo tag/versione, quality gate, build del .vsix e allegato alla release del tag
- examples/estensione-vscode: ci, release e maintenance da copiare nelle estensioni

Fixes #29 @1h30m
2026-11-27 09:59:32 +01:00
LucaZanni 3d28471b2c 🐛 fix(ci): ogni workflow condiviso ha un timeout, sul job e sui passi di rete
- timeout-minutes sul job di tutti e 16 i workflow riusabili: 10 per branch-cleanup,
  15-20 per release e manutenzione, 30 per i quality gates e le pubblicazioni,
  45 per le immagini Docker, 60 per la build Android
- timeout-minutes su 95 passi che dipendono dalla rete (checkout, setup-*, cache,
  install, audit, login, push, upload): con il solo timeout sul job il log non dice
  quale passo si è impiantato, con questi sì
- valori letterali e non input: su un job che chiama un workflow riusabile
  timeout-minutes non è una chiave ammessa, quindi il limite può stare solo qui,
  e i valori scelti sono già ampi rispetto alla durata reale dei job

Fixes #23 @1h30m
2026-10-20 22:33:53 +02:00
20 changed files with 429 additions and 0 deletions

No files matched your search

+5
View File
@@ -11,11 +11,15 @@ on:
jobs:
auto-release:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 15
defaults:
run:
working-directory: ${{ inputs.working-directory || '.' }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
with:
fetch-depth: 0
@@ -37,6 +41,7 @@ jobs:
echo "current_tag=$CURRENT_TAG" >> $GITHUB_OUTPUT
- name: Create release
timeout-minutes: 5
env:
GITEA_TOKEN: ${{ gitea.token }}
SERVER_URL: ${{ gitea.server_url }}
+4
View File
@@ -6,9 +6,13 @@ on:
jobs:
branch-cleanup:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 10
if: gitea.event.pull_request.merged == true
steps:
- name: Delete merged branch
timeout-minutes: 5
env:
GITEA_TOKEN: ${{ gitea.token }}
SERVER_URL: ${{ gitea.server_url }}
+18
View File
@@ -41,11 +41,16 @@ on:
jobs:
android-build:
runs-on: ${{ inputs.runner }}
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 60
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Node.js
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-node@v7
with:
node-version: ${{ inputs.node-version || '24.16.0' }}
@@ -54,15 +59,18 @@ jobs:
package-manager-cache: false
- name: Setup Java
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ inputs.java-version || '17' }}
- name: Setup Android SDK
timeout-minutes: 20
uses: https://gitea.pzetatouch.it/actions/setup-android@v4
- name: Cache npm
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.npm
@@ -71,6 +79,7 @@ jobs:
${{ runner.os }}-node-
- name: Cache Gradle
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: |
@@ -92,15 +101,19 @@ jobs:
echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
- name: Install dependencies
timeout-minutes: 15
run: npm ci
- name: Build web app
timeout-minutes: 15
run: npm run build
- name: Add Android platform
timeout-minutes: 10
run: npx cap add android || true
- name: Sync Capacitor
timeout-minutes: 10
run: npx cap sync android
# La piattaforma Android puo essere generata da 'cap add' (default Capacitor:
@@ -201,6 +214,7 @@ jobs:
- name: Build Android (APK)
if: inputs.output-format == 'apk'
timeout-minutes: 30
working-directory: android
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
@@ -224,6 +238,7 @@ jobs:
- name: Build Android (AAB)
if: inputs.output-format == 'aab'
timeout-minutes: 30
working-directory: android
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
@@ -240,6 +255,7 @@ jobs:
- name: Upload APK artifact
if: inputs.output-format == 'apk'
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/upload-artifact@v3
with:
name: ${{ steps.app-info.outputs.name }}-${{ steps.app-info.outputs.version }}-${{ inputs.build-type }}-apk
@@ -248,6 +264,7 @@ jobs:
- name: Upload AAB artifact
if: inputs.output-format == 'aab'
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/upload-artifact@v3
with:
name: ${{ steps.app-info.outputs.name }}-${{ steps.app-info.outputs.version }}-release-aab
@@ -256,6 +273,7 @@ jobs:
- name: Upload Gradle build reports
if: always()
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/upload-artifact@v3
with:
name: gradle-build-reports
+9
View File
@@ -15,14 +15,19 @@ on:
jobs:
dependency-audit:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 20
defaults:
run:
working-directory: ${{ inputs.working-directory || '.' }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Node.js
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-node@v7
with:
node-version: ${{ inputs.node-version || '24.16.0' }}
@@ -31,6 +36,7 @@ jobs:
package-manager-cache: false
- name: Cache npm
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.npm
@@ -44,9 +50,11 @@ jobs:
echo "//gitea.pzetatouch.it/api/packages/PZeta_Touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Install dependencies
timeout-minutes: 15
run: npm ci
- name: Security audit
timeout-minutes: 10
id: audit
run: |
npm audit --audit-level=high --json > audit.json 2>/dev/null || true
@@ -55,6 +63,7 @@ jobs:
- name: Open issue if vulnerabilities found
if: steps.audit.outputs.vulnerabilities != '0'
timeout-minutes: 5
env:
GITEA_TOKEN: ${{ gitea.token }}
SERVER_URL: ${{ gitea.server_url }}
+9
View File
@@ -15,14 +15,19 @@ on:
jobs:
dependency-outdated:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 20
defaults:
run:
working-directory: ${{ inputs.working-directory || '.' }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Node.js
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-node@v7
with:
node-version: ${{ inputs.node-version || '24.16.0' }}
@@ -31,6 +36,7 @@ jobs:
package-manager-cache: false
- name: Cache npm
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.npm
@@ -44,9 +50,11 @@ jobs:
echo "//gitea.pzetatouch.it/api/packages/PZeta_Touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Install dependencies
timeout-minutes: 15
run: npm ci
- name: Check outdated packages
timeout-minutes: 10
id: outdated
run: |
npm outdated --json > outdated.json 2>/dev/null || true
@@ -55,6 +63,7 @@ jobs:
- name: Open issue if packages outdated
if: steps.outdated.outputs.count != '0'
timeout-minutes: 5
env:
GITEA_TOKEN: ${{ gitea.token }}
SERVER_URL: ${{ gitea.server_url }}
+12
View File
@@ -16,11 +16,16 @@ on:
jobs:
docker-release:
runs-on: ${{ inputs.runner }}
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 45
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Node.js
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-node@v7
with:
node-version: ${{ inputs.node-version || '24.16.0' }}
@@ -30,9 +35,11 @@ jobs:
- name: Upgrade npm
if: inputs.npm-version != ''
timeout-minutes: 10
run: npm install -g npm@${{ inputs.npm-version }}
- name: Cache npm
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.npm
@@ -46,6 +53,7 @@ jobs:
echo "//gitea.pzetatouch.it/api/packages/PZeta_Touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Install dependencies
timeout-minutes: 15
run: npm ci
- name: Type check
@@ -58,12 +66,15 @@ jobs:
run: npm run format:check
- name: Build
timeout-minutes: 15
run: npm run build
- name: Test
timeout-minutes: 20
run: npm run test
- name: Login to container registry
timeout-minutes: 5
uses: https://gitea.pzetatouch.it/actions/login-action@v4
with:
registry: gitea.pzetatouch.it
@@ -82,6 +93,7 @@ jobs:
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
timeout-minutes: 30
uses: https://gitea.pzetatouch.it/actions/build-push-action@v7
with:
push: true
+6
View File
@@ -32,14 +32,19 @@ on:
jobs:
link-check:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 15
defaults:
run:
working-directory: ${{ inputs.working-directory || '.' }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Node.js
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-node@v7
with:
node-version: ${{ inputs.node-version || '24.16.0' }}
@@ -48,6 +53,7 @@ jobs:
package-manager-cache: false
- name: Collegamenti interni
timeout-minutes: 10
env:
SCRIPT: ${{ inputs.script || 'scripts/verifica-link-docs.mjs' }}
run: |
+6
View File
@@ -92,11 +92,16 @@ on:
jobs:
generate-yaml:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 15
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Generate K8s YAML
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/k8s-yaml-generator@${{ inputs.generator-version || 'v0.13' }}
with:
instance: ${{ inputs.instance }}
@@ -122,6 +127,7 @@ jobs:
pvcSize: ${{ inputs.pvc-size || '10Mi' }}
- name: Upload Artifact
timeout-minutes: 10
# v3 e non v5: la v5 che avevano i chiamanti non e' mai stata provata su
# questo runner, e questo workflow parte solo su un tag a*, cioe' al
# rilascio. Le v4+ usano l'API artifact nuova; su Gitea 1.27.3 c'e', ma
+10
View File
@@ -14,14 +14,19 @@ on:
jobs:
npm-publish:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 30
defaults:
run:
working-directory: ${{ inputs.working-directory || '.' }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Node.js
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-node@v7
with:
node-version: ${{ inputs.node-version || '24.16.0' }}
@@ -30,6 +35,7 @@ jobs:
package-manager-cache: false
- name: Cache npm
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.npm
@@ -43,6 +49,7 @@ jobs:
echo "//gitea.pzetatouch.it/api/packages/PZeta_Touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Install dependencies
timeout-minutes: 15
run: npm ci
- name: Lint
@@ -55,10 +62,13 @@ jobs:
run: npm run format:check
- name: Build
timeout-minutes: 15
run: npm run build
- name: Test
timeout-minutes: 20
run: npm run test
- name: Publish
timeout-minutes: 10
run: npm publish
+5
View File
@@ -11,11 +11,15 @@ on:
jobs:
python-auto-release:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 15
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
with:
fetch-depth: 0
@@ -48,6 +52,7 @@ jobs:
echo "name=$APP_NAME" >> $GITHUB_OUTPUT
- name: Create release
timeout-minutes: 5
env:
GITEA_TOKEN: ${{ gitea.token }}
SERVER_URL: ${{ gitea.server_url }}
@@ -26,14 +26,19 @@ on:
jobs:
python-dependency-audit:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 20
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Python
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-python@v7
with:
python-version: ${{ inputs.python-version || '3.11' }}
@@ -67,6 +72,7 @@ jobs:
echo "Registry PyPI di Gitea aggiunto come indice extra (credenziali da netrc)."
- name: Cache pip
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.cache/pip
@@ -76,6 +82,7 @@ jobs:
${{ runner.os }}-pip-
- name: Install dependencies (isolated venv)
timeout-minutes: 15
run: |
# venv pulita: audita SOLO le dipendenze dichiarate dal repo,
# non l'ambiente globale del runner (che su runner ML/GPU è contaminato)
@@ -90,6 +97,7 @@ jobs:
fi
- name: Security audit (pip-audit)
timeout-minutes: 10
id: audit
run: |
.audit-venv/bin/pip-audit --format=json --output=audit.json 2>/dev/null || true
@@ -107,6 +115,7 @@ jobs:
- name: Open or update issue if vulnerabilities found
if: steps.audit.outputs.vulnerabilities != '0'
timeout-minutes: 5
env:
GITEA_TOKEN: ${{ gitea.token }}
SERVER_URL: ${{ gitea.server_url }}
@@ -26,14 +26,19 @@ on:
jobs:
python-dependency-outdated:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 20
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Python
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-python@v7
with:
python-version: ${{ inputs.python-version || '3.11' }}
@@ -67,6 +72,7 @@ jobs:
echo "Registry PyPI di Gitea aggiunto come indice extra (credenziali da netrc)."
- name: Cache pip
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.cache/pip
@@ -76,6 +82,7 @@ jobs:
${{ runner.os }}-pip-
- name: Install dependencies (isolated venv)
timeout-minutes: 15
run: |
# venv pulita: elenca come obsolete SOLO le dipendenze dichiarate dal repo,
# non i pacchetti globali del runner (torch/cuda/nvidia su runner ML/GPU)
@@ -90,6 +97,7 @@ jobs:
fi
- name: Check outdated packages
timeout-minutes: 10
id: outdated
run: |
.audit-venv/bin/pip list --outdated --format=json > outdated.json 2>/dev/null || echo '[]' > outdated.json
@@ -98,6 +106,7 @@ jobs:
- name: Open or update issue if packages outdated
if: steps.outdated.outputs.count != '0'
timeout-minutes: 5
env:
GITEA_TOKEN: ${{ gitea.token }}
SERVER_URL: ${{ gitea.server_url }}
@@ -34,14 +34,19 @@ on:
jobs:
python-docker-release:
runs-on: ${{ inputs.runner }}
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 45
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Python
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-python@v7
with:
python-version: ${{ inputs.python-version || '3.11' }}
@@ -86,6 +91,7 @@ jobs:
echo "Registry PyPI di Gitea aggiunto come indice extra (credenziali da netrc)."
- name: Cache pip
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.cache/pip
@@ -95,6 +101,7 @@ jobs:
${{ runner.os }}-pip-
- name: Install dependencies
timeout-minutes: 15
run: |
python -m pip install --upgrade pip
if [ -n "${{ inputs.install-extras }}" ]; then
@@ -117,9 +124,11 @@ jobs:
run: mypy .
- name: Test (pytest)
timeout-minutes: 20
run: pytest --tb=short -q
- name: Login to container registry
timeout-minutes: 5
uses: https://gitea.pzetatouch.it/actions/login-action@v4
with:
registry: gitea.pzetatouch.it
@@ -155,6 +164,7 @@ jobs:
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
timeout-minutes: 30
uses: https://gitea.pzetatouch.it/actions/build-push-action@v7
with:
push: true
@@ -43,6 +43,9 @@ on:
jobs:
python-package-release:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 30
defaults:
run:
working-directory: ${{ inputs.working-directory }}
@@ -52,9 +55,11 @@ jobs:
PACKAGES_API_URL: https://gitea.pzetatouch.it/api/v1/packages/PZeta_Touch/pypi
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Python
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-python@v7
with:
python-version: ${{ inputs.python-version || '3.11' }}
@@ -102,6 +107,7 @@ jobs:
# messaggio esplicito che con il 409 di twine a fine job. Qualsiasi risposta diversa
# da 200/404 (token scaduto, registry giù) blocca: non si pubblica alla cieca.
- name: Verifica che la versione non sia già pubblicata
timeout-minutes: 5
env:
NAME: ${{ steps.meta.outputs.name }}
VERSION: ${{ steps.meta.outputs.version }}
@@ -125,6 +131,7 @@ jobs:
esac
- name: Cache pip
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.cache/pip
@@ -137,6 +144,7 @@ jobs:
# il controllo dell'installazione tramite requirements-dev.txt (es. per forzare le
# wheel CPU di torch con --extra-index-url, non esprimibile in pyproject.toml).
- name: Install dependencies
timeout-minutes: 15
run: |
python -m pip install --upgrade pip
if [ -n "${{ inputs.install-extras }}" ]; then
@@ -160,11 +168,13 @@ jobs:
run: mypy .
- name: Test (pytest)
timeout-minutes: 20
run: pytest --tb=short -q
# Build isolata (PEP 517): il backend dichiarato in [build-system] viene installato in
# un ambiente temporaneo, quindi l'artefatto non dipende da cosa c'è nel venv del job.
- name: Build (wheel + sdist)
timeout-minutes: 10
run: |
rm -rf dist
python -m build
@@ -174,6 +184,7 @@ jobs:
run: twine check --strict dist/*
- name: Publish sul registry PyPI di Gitea
timeout-minutes: 10
env:
TWINE_REPOSITORY_URL: ${{ env.PYPI_UPLOAD_URL }}
TWINE_USERNAME: ${{ secrets.G_USER }}
@@ -27,14 +27,19 @@ on:
jobs:
python-quality-gates:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 30
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Python
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-python@v7
with:
python-version: ${{ inputs.python-version || '3.11' }}
@@ -79,6 +84,7 @@ jobs:
echo "Registry PyPI di Gitea aggiunto come indice extra (credenziali da netrc)."
- name: Cache pip
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.cache/pip
@@ -88,6 +94,7 @@ jobs:
${{ runner.os }}-pip-
- name: Install dependencies
timeout-minutes: 15
run: |
python -m pip install --upgrade pip
if [ -n "${{ inputs.install-extras }}" ]; then
@@ -110,6 +117,7 @@ jobs:
run: mypy .
- name: Test (pytest)
timeout-minutes: 20
run: pytest --tb=short -q
- name: Rimozione credenziali registry PyPI
+12
View File
@@ -34,14 +34,19 @@ on:
jobs:
quality-gates:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 30
defaults:
run:
working-directory: ${{ inputs.working-directory || '.' }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
- name: Setup Node.js
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-node@v7
with:
node-version: ${{ inputs.node-version || '24.16.0' }}
@@ -51,9 +56,11 @@ jobs:
- name: Upgrade npm
if: inputs.npm-version != ''
timeout-minutes: 10
run: npm install -g npm@${{ inputs.npm-version }}
- name: Cache npm
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.npm
@@ -510,12 +517,15 @@ jobs:
exit 1
- name: Check outdated packages
timeout-minutes: 10
run: npm outdated || true
- name: Install dependencies
timeout-minutes: 15
run: npm ci
- name: Security audit
timeout-minutes: 10
run: npm audit --audit-level=high || true
- name: Lint
@@ -528,7 +538,9 @@ jobs:
run: npm run format:check
- name: Build
timeout-minutes: 15
run: npm run build
- name: Test
timeout-minutes: 20
run: npm run test
+205
View File
@@ -0,0 +1,205 @@
name: VSIX Release
# Rilascio di un'estensione VS Code, in un unico flusso:
# quality gate e build → .vsix → release in bozza → allegato → pubblicazione → registro pacchetti
#
# La release diventa pubblica solo quando il .vsix è già allegato. Il pacchetto (tipo generic)
# viene pubblicato per ultimo: è il segnale che le estensioni installate usano per avvisare
# di un aggiornamento. Non va combinato con auto-release.yml, che creerebbe la release prima.
#
# Il job è rieseguibile: ciò che esiste già non viene sovrascritto.
#
# Prerequisiti nel repository chiamante:
# - package.json con script: lint:check, typecheck, format:check, build, test, package
# - lo script package produce <name>-<version>.vsix nella working-directory
# - il tag deve essere 'v' + version
# - Secrets: G_USER (utente proprietario del token) e NPM_TOKEN (token con scope package)
on:
workflow_call:
inputs:
working-directory:
description: 'Cartella che contiene package.json, relativa alla root del repo. Default: la root.'
type: string
default: '.'
node-version:
type: string
default: '24.16.0'
jobs:
vsix-release:
runs-on: ubuntu-latest
# Il chiamante non puo' dichiararlo: su un job che usa un workflow
# riusabile timeout-minutes non e' una chiave ammessa (devops/shared-actions#23).
timeout-minutes: 30
defaults:
run:
working-directory: ${{ inputs.working-directory || '.' }}
steps:
- name: Checkout
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/checkout@v7
with:
# Storia e tag servono al changelog.
fetch-depth: 0
token: ${{ gitea.token }}
# Controlli immediati: un tag disallineato produrrebbe un .vsix con un'altra versione,
# e senza secrets il flusso si fermerebbe a rilascio già pubblicato.
- name: Check tag version and secrets
shell: bash
env:
G_USER: ${{ secrets.G_USER }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
set -euo pipefail
TAG=${GITHUB_REF#refs/tags/}
VERSION=$(jq -r '.version' package.json)
if [ "$TAG" != "v$VERSION" ]; then
echo "::error::Il tag $TAG non corrisponde alla versione $VERSION di package.json (atteso v$VERSION)."
exit 1
fi
if [ -z "$G_USER" ] || [ -z "$NPM_TOKEN" ]; then
echo "::error::Secrets G_USER e/o NPM_TOKEN non disponibili: serve 'secrets: inherit' nel workflow chiamante."
exit 1
fi
- name: Setup Node.js
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/setup-node@v7
with:
node-version: ${{ inputs.node-version || '24.16.0' }}
# La cache npm resta allo step actions/cache: dalla v5 setup-node la accende
# da solo se package.json ha packageManager, e la duplicherebbe.
package-manager-cache: false
- name: Cache npm
timeout-minutes: 10
uses: https://gitea.pzetatouch.it/actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Configure npm private registry
run: |
echo "@pzeta:registry=https://gitea.pzetatouch.it/api/packages/PZeta_Touch/npm/" >> ~/.npmrc
echo "//gitea.pzetatouch.it/api/packages/PZeta_Touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- name: Install dependencies
timeout-minutes: 15
run: npm ci
- name: Lint
run: npm run lint:check
- name: Type check
run: npm run typecheck
- name: Format check
run: npm run format:check
- name: Build
timeout-minutes: 15
run: npm run build
- name: Test
timeout-minutes: 20
run: npm run test
- name: Package VSIX
timeout-minutes: 10
shell: bash
run: |
set -euo pipefail
npm run package
VSIX="$(jq -r '.name' package.json)-$(jq -r '.version' package.json).vsix"
if [ ! -f "$VSIX" ]; then
echo "::error::Lo script package non ha prodotto $VSIX."
exit 1
fi
- name: Publish release with VSIX
timeout-minutes: 10
shell: bash
env:
GITEA_TOKEN: ${{ gitea.token }}
SERVER_URL: ${{ gitea.server_url }}
REPOSITORY: ${{ gitea.repository }}
run: |
set -euo pipefail
TAG=${GITHUB_REF#refs/tags/}
NAME=$(jq -r '.name' package.json)
VSIX="$NAME-$(jq -r '.version' package.json).vsix"
API="$SERVER_URL/api/v1/repos/$REPOSITORY"
api() {
curl -sS --fail-with-body --max-time 300 -H "Authorization: token $GITEA_TOKEN" "$@"
}
# 200: la release esiste (anche in bozza, il token ha permesso di scrittura). 404: va creata.
STATUS=$(curl -sS --max-time 60 -o /tmp/release.json -w '%{http_code}' \
-H "Authorization: token $GITEA_TOKEN" "$API/releases/tags/$TAG")
case "$STATUS" in
200) echo "Release $TAG già presente: note e titolo restano invariati." ;;
404)
PREVIOUS=$(git describe --tags --abbrev=0 --match 'v*' "$TAG^" 2>/dev/null || true)
RANGE=${PREVIOUS:+$PREVIOUS..}$TAG
CHANGELOG=$(git log --no-merges --pretty=format:'- %s (%h)' "$RANGE")
PRERELEASE=false
case "$TAG" in *-*) PRERELEASE=true ;; esac
jq -n --arg tag "$TAG" --arg name "$NAME $TAG" --arg body "$CHANGELOG" --argjson pre "$PRERELEASE" \
'{tag_name: $tag, name: $name, body: $body, draft: true, prerelease: $pre}' \
| api -X POST -H 'Content-Type: application/json' --data-binary @- "$API/releases" > /tmp/release.json
;;
*)
echo "::error::Lettura della release $TAG fallita con stato $STATUS: $(cat /tmp/release.json)"
exit 1
;;
esac
ID=$(jq -r '.id' /tmp/release.json)
if jq -e --arg name "$VSIX" 'any(.assets[]?; .name == $name)' /tmp/release.json > /dev/null; then
echo "::notice::$VSIX è già allegato alla release $TAG: nessun caricamento."
else
api -X POST -F "attachment=@$VSIX" "$API/releases/$ID/assets?name=$VSIX" > /dev/null
echo "$VSIX allegato alla release $TAG."
fi
if [ "$(jq -r '.draft' /tmp/release.json)" = "true" ]; then
api -X PATCH -H 'Content-Type: application/json' -d '{"draft": false}' "$API/releases/$ID" > /dev/null
echo "Release $TAG pubblicata."
fi
- name: Publish to package registry
timeout-minutes: 10
shell: bash
env:
G_USER: ${{ secrets.G_USER }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SERVER_URL: ${{ gitea.server_url }}
OWNER: ${{ gitea.repository_owner }}
REPOSITORY: ${{ gitea.repository }}
run: |
set -euo pipefail
NAME=$(jq -r '.name' package.json)
VERSION=$(jq -r '.version' package.json)
VSIX="$NAME-$VERSION.vsix"
STATUS=$(curl -sS --max-time 300 -o /tmp/package.txt -w '%{http_code}' -u "$G_USER:$NPM_TOKEN" \
--upload-file "$VSIX" "$SERVER_URL/api/packages/$OWNER/generic/$NAME/$VERSION/$VSIX")
case "$STATUS" in
201) echo "$VSIX pubblicato nel registro pacchetti di $OWNER." ;;
409) echo "::notice::$VSIX è già nel registro pacchetti: nessun caricamento." ;;
*)
echo "::error::Pubblicazione del pacchetto fallita con stato $STATUS: $(cat /tmp/package.txt)"
exit 1
;;
esac
# Il collegamento mostra il pacchetto nella pagina del repository: se è già presente fallisce.
if ! curl -sS --fail-with-body --max-time 60 -X POST -H "Authorization: token $NPM_TOKEN" \
"$SERVER_URL/api/v1/packages/$OWNER/generic/$NAME/-/link/${REPOSITORY#*/}"; then
echo "::warning::Pacchetto $NAME non collegato al repository (forse lo è già)."
fi
+23
View File
@@ -0,0 +1,23 @@
# Copia in: .gitea/workflows/ci.yml
# Usato da: estensioni VS Code
#
# Prerequisiti:
# - package.json con script: lint:check, typecheck, format:check, build, test
name: CI
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'
pull_request:
branches:
- main
jobs:
quality-gates:
uses: https://gitea.pzetatouch.it/devops/shared-actions/.gitea/workflows/quality-gates.yml@v1
secrets: inherit
@@ -0,0 +1,36 @@
# 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 2 * * 3' # ogni mercoledì alle 02:00 → security audit
- cron: '0 2 1 * *' # ogni 1° del mese alle 02:00 → outdated check
workflow_dispatch:
jobs:
branch-cleanup:
if: gitea.event_name == 'pull_request' && gitea.event.pull_request.merged == true
uses: https://gitea.pzetatouch.it/devops/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 2 * * 3')
uses: https://gitea.pzetatouch.it/devops/shared-actions/.gitea/workflows/dependency-check.yml@v1
secrets: inherit
dependency-outdated:
if: >
gitea.event_name == 'workflow_dispatch' ||
(gitea.event_name == 'schedule' && gitea.event.schedule == '0 2 1 * *')
uses: https://gitea.pzetatouch.it/devops/shared-actions/.gitea/workflows/dependency-outdated.yml@v1
secrets: inherit
+22
View File
@@ -0,0 +1,22 @@
# Copia in: .gitea/workflows/release.yml
# Trigger: git tag v* → build del .vsix, release Gitea con allegato, registro pacchetti
#
# NOTA: un solo job. Non aggiungere auto-release: creerebbe la release prima del .vsix.
# Workaround Gitea bug #31900: token esplicito nel checkout del workflow condiviso.
#
# Prerequisiti:
# - package.json con script: lint:check, typecheck, format:check, build, test, package
# - il tag deve essere 'v' + version di package.json
# - Secrets di organizzazione: G_USER + NPM_TOKEN (token Gitea con scope package)
name: Release
on:
push:
tags:
- 'v*'
jobs:
vsix-release:
uses: https://gitea.pzetatouch.it/devops/shared-actions/.gitea/workflows/vsix-release.yml@v1
secrets: inherit