# Le Gitea Actions del gioco: girano sul runner del PC di Andrea (make runner; label ubuntu-latest = node:22-bookworm). # A ogni push su main e a ogni tag i test unitari; su un tag vX.Y.Z (o a mano, «Run workflow») anche le venti prove nel # browser, una per job nell'immagine di Playwright, sulla scheda video del PC; se passa tutto, la release. # Il controllo dei file pubblicabili non sta qui (a pipeline partita il push è già pubblico): è l'hook pre-push. name: test on: push: branches: [main] tags: ['v*'] workflow_dispatch: jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Test unitari run: node --version && node --test tests/*.test.mjs # Le prove nel browser, una per job: l'elenco è SUITES di scripts/verify.mjs (verify.test.mjs pretende che coincidano), # l'immagine ha la stessa versione di Playwright di package-lock.json (idem). browser: needs: test if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest container: image: mcr.microsoft.com/playwright:v1.64.1-noble # La scheda video del PC (runtime NVIDIA di Docker): Chromium disegna lì, tests/chromium.mjs la trova da solo. options: --gpus all -e NVIDIA_DRIVER_CAPABILITIES=all strategy: fail-fast: false matrix: prova: [principale, minigiochi, telefoni, ambient, veicoli, ingorgo, smarronata, briscola, tressette, scopa, biliardo, flipper, micro, cerbottana, condor, campana, bruciate, gara, telefono, risveglio] steps: - uses: actions/checkout@v4 - name: Playwright run: npm ci --no-audit --no-fund - name: Prova ${{ matrix.prova }} run: node scripts/verify.mjs ${{ matrix.prova }} release: needs: [test, browser] if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Release del tag env: TOKEN: ${{ secrets.GITEA_TOKEN }} TAG: ${{ github.ref_name }} API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }} run: | prev=$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || true) { echo "Si gioca su https://50037.manzolo.it; qui sotto lo zip di questa versione." echo echo "Cosa cambia${prev:+ da $prev}:" echo git log --no-merges --format='- %s' ${prev:+$prev..}"$TAG" | grep -v -e '^- Versione [0-9]' | cut -c1-400 } > note.md node -e 'const fs=require("fs");process.stdout.write(JSON.stringify({tag_name:process.env.TAG,name:"Versione "+process.env.TAG.slice(1),body:fs.readFileSync("note.md","utf8")}))' > release.json code=$(curl -s -o risposta.json -w '%{http_code}' -X POST -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' --data @release.json "$API/releases") cat risposta.json | head -c 400; echo [ "$code" = 201 ] || [ "$code" = 409 ]