Skip to content

test(e2e): aggiunge audit a11y + 2FA TOTP + lockout + sessioni; fissa… #22

test(e2e): aggiunge audit a11y + 2FA TOTP + lockout + sessioni; fissa…

test(e2e): aggiunge audit a11y + 2FA TOTP + lockout + sessioni; fissa… #22

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
backend:
name: Backend (build + test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore
working-directory: backend
run: dotnet restore Accanto.slnx
- name: Build
working-directory: backend
run: dotnet build Accanto.slnx -c Release --no-restore
- name: Test
working-directory: backend
run: dotnet test Accanto.slnx -c Release --no-build --logger "trx;LogFileName=test-results.trx"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: backend-test-results
path: backend/**/TestResults/*.trx
if-no-files-found: ignore
frontend:
name: Frontend (build)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node 22
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install
working-directory: frontend
run: npm ci
- name: Build
working-directory: frontend
env:
VITE_API_BASE_URL: /api
run: npm run build
e2e:
name: E2E (Playwright)
runs-on: ubuntu-latest
needs: [backend, frontend]
steps:
- uses: actions/checkout@v4
- name: Setup Node 22
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Avvia lo stack (docker compose)
env:
# MasterKey è obbligatoria in compose; ne generiamo una al volo per la CI.
Encryption__MasterKey: ${{ secrets.E2E_ENCRYPTION_KEY || 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=' }}
run: docker compose up -d --build
- name: Attendi che backend e frontend rispondano
run: |
for i in $(seq 1 60); do
if curl -sf http://localhost:8080/health > /dev/null && curl -sf http://localhost:5173/ > /dev/null; then
echo "Stack pronto."
exit 0
fi
sleep 2
done
echo "Stack non pronto in tempo." >&2
docker compose logs --tail=80 backend
docker compose logs --tail=40 frontend
exit 1
- name: Install frontend deps
working-directory: frontend
run: npm ci
- name: Install Playwright browser
working-directory: frontend
run: npx playwright install --with-deps chromium
- name: Run E2E
working-directory: frontend
env:
E2E_BASE_URL: http://localhost:5173
run: npm run e2e
- name: Upload Playwright report on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: frontend/playwright-report
if-no-files-found: ignore
- name: Upload Playwright traces on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-test-results
path: frontend/test-results
if-no-files-found: ignore
- name: Dump container logs on failure
if: failure()
run: |
docker compose ps
docker compose logs --tail=200 backend
docker compose logs --tail=80 frontend
docker compose logs --tail=40 db