Sul runner il server di cache non è raggiungibile dal container del job (getCacheEntry failed: connect ETIMEDOUT): setup-node con cache: npm aspettava circa cinque minuti prima di proseguire con un avviso, sia all'inizio sia nel passo finale di salvataggio. Le dipendenze si scaricano con npm ci a ogni esecuzione. La prima esecuzione su Gitea è passata per intero (lint, formato, tipi, build, HTML, link, e2e, accessibilità 51, conformità 1455, Lighthouse, pacchetto zip). Corretti i commenti sui timeout, che attribuivano ai limiti anche lo scarico dell'immagine (non provato), e aggiunta la motivazione in D-056. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
147 lines
5.5 KiB
YAML
147 lines
5.5 KiB
YAML
# =============================================================================
|
|
# CI — verifica completa a ogni push su main e a ogni pull request (Gitea Actions).
|
|
#
|
|
# Il job «verify» ripete passo per passo `npm run verify` (stesso ordine): nella pagina
|
|
# dell'esecuzione si vede subito quale controllo è fallito. Alla fine costruisce anche lo zip
|
|
# di rilascio e ne verifica il contenuto (`scripts/package.mjs` + `scripts/check-package.mjs`),
|
|
# così un errore di pacchetto emerge qui e non al momento del tag. Modificando gli script
|
|
# `verify`/`test` di package.json, aggiornare anche questi passi.
|
|
#
|
|
# RUNNER: i job usano il label `ubuntu-latest`, quello predefinito di act_runner. Se il runner
|
|
# è stato registrato con un altro label, sostituirlo in tutti i job: Impostazioni del
|
|
# repository → Actions → Runner (o Amministrazione → Actions → Runner) mostra i label.
|
|
#
|
|
# CONTAINER: l'immagine Playwright DEVE avere la stessa versione di @playwright/test
|
|
# in package.json (oggi 1.56.1). Aggiornando Playwright, aggiornare anche qui e in release.yml.
|
|
#
|
|
# AZIONI: referenziate con URL completo su github.com, così il workflow non dipende
|
|
# dall'impostazione DEFAULT_ACTIONS_URL dell'istanza. Il runner deve poter raggiungere
|
|
# github.com; in alternativa usare le copie ospitate su https://gitea.com/actions/.
|
|
#
|
|
# ARTIFACT: upload-artifact@v3, l'unica versione che funziona su Gitea: actions/upload-artifact@v4
|
|
# fallisce sempre con GHESNotSupportedError. Gli upload sono sullo step con `continue-on-error`,
|
|
# così un problema dello storage non rende rossa una verifica andata a buon fine.
|
|
#
|
|
# TIMEOUT: i limiti sono larghi perché la rete del runner di casa è lenta: il primo avvio scarica
|
|
# l'immagine Playwright (oltre 1 GB, più di venti minuti) e ogni esecuzione clona le action da
|
|
# github.com, scarica Node e le dipendenze npm. A immagine presente e con la rete libera la
|
|
# verifica dura pochi minuti.
|
|
#
|
|
# CACHE: niente `cache: npm` in setup-node. Il server di cache del runner non è raggiungibile
|
|
# dal container del job (connect ETIMEDOUT verso l'indirizzo del runner): ogni esecuzione
|
|
# aspettava cinque minuti prima di proseguire con un avviso. Le dipendenze si scaricano con
|
|
# `npm ci` a ogni esecuzione.
|
|
#
|
|
# NON BLOCCANTE: il controllo dei link esterni ha `continue-on-error` sullo step (non sul job).
|
|
#
|
|
# DOMINIO: la variabile del repository SITE_URL (Impostazioni → Actions → Variabili), se
|
|
# impostata, sostituisce il dominio predefinito di site.config.mjs in build e test.
|
|
#
|
|
# SEGRETI: questo workflow non ne usa. Il segreto facoltativo RELEASE_TOKEN serve solo a
|
|
# release.yml (vedi il commento in quel file e il README).
|
|
# =============================================================================
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
ASTRO_TELEMETRY_DISABLED: '1'
|
|
CI: 'true'
|
|
SITE_URL: ${{ vars.SITE_URL }}
|
|
|
|
jobs:
|
|
verify:
|
|
name: Verifica (lint, build, test, Lighthouse, pacchetto)
|
|
runs-on: ubuntu-latest # label del runner: adattare se diverso
|
|
container:
|
|
image: mcr.microsoft.com/playwright:v1.56.1-noble # = versione di @playwright/test
|
|
timeout-minutes: 90 # la rete del runner è lenta (vedi TIMEOUT)
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@v4
|
|
|
|
- uses: https://github.com/actions/setup-node@v4
|
|
with:
|
|
node-version-file: .nvmrc # niente `cache: npm`: vedi CACHE in testa al file
|
|
|
|
- name: Dipendenze
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Formattazione
|
|
run: npm run format:check
|
|
|
|
- name: Controllo dei tipi (astro check)
|
|
run: npm run check
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: HTML valido
|
|
run: npm run test:html
|
|
|
|
- name: Link interni
|
|
run: npm run test:links
|
|
|
|
- name: Test end-to-end
|
|
run: npm run test:e2e
|
|
|
|
- name: Test di accessibilità
|
|
run: npm run test:a11y
|
|
|
|
- name: Conformità legale
|
|
run: npm run test:compliance
|
|
|
|
- name: Lighthouse
|
|
run: npm run test:lighthouse
|
|
|
|
- name: Pacchetto zip (creazione e verifica del contenuto)
|
|
run: node scripts/package.mjs && npm run test:package
|
|
|
|
- name: Report Playwright (solo in caso di errore)
|
|
if: failure()
|
|
continue-on-error: true
|
|
uses: https://github.com/actions/upload-artifact@v3
|
|
with:
|
|
name: playwright-report
|
|
path: playwright-report
|
|
retention-days: 14
|
|
|
|
- name: Report Lighthouse
|
|
if: always()
|
|
continue-on-error: true
|
|
uses: https://github.com/actions/upload-artifact@v3
|
|
with:
|
|
name: lighthouse
|
|
path: .lighthouseci
|
|
include-hidden-files: true # necessario: dalla v3.2.0 le cartelle nascoste (.lighthouseci) sono escluse
|
|
retention-days: 14
|
|
|
|
external-links:
|
|
name: Link esterni (non bloccante)
|
|
runs-on: ubuntu-latest # label del runner: adattare se diverso
|
|
container:
|
|
image: node:24
|
|
timeout-minutes: 45 # la rete del runner è lenta (vedi TIMEOUT)
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Dipendenze
|
|
run: npm ci
|
|
env:
|
|
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Controllo dei link esterni
|
|
# non bloccante: dipende dalla rete del runner e dai siti esterni, quindi un link
|
|
# irraggiungibile non deve rendere rossa la CI
|
|
continue-on-error: true
|
|
run: npm run test:links -- --external
|