ci: add Gitea Actions workflow for automated testing
- Create .gitea/workflows/ci.yml with 4 sequential jobs - lint: Run ESLint on root configuration - test-backend: Run backend Vitest tests with SQLite - test-frontend: Run frontend Vitest tests - test-e2e: Run Playwright E2E tests (bloqueante) - E2E job automates server startup + Playwright test execution - Configure Gitea Secrets for IGDB, RAWG, TheGamesDB API keys - Add artifact upload for Playwright reports on failure - Update SECURITY.md with CI/CD Secrets setup instructions - Update docs/API_KEYS.md with production Gitea workflow guide - Add tests/gitea-workflow.spec.ts with 12 validation tests - Workflow triggers on push/PR to main and develop branches
This commit is contained in:
98
.gitea/workflows/ci.yml
Normal file
98
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,98 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
env:
|
||||
NODE_VERSION: '18'
|
||||
YARN_VERSION: '4.12.0'
|
||||
|
||||
jobs:
|
||||
# Job 1: Lint (Lint backend + root esconfig)
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: yarn lint
|
||||
|
||||
# Job 2: Backend Tests
|
||||
test-backend:
|
||||
needs: lint
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DATABASE_URL: 'file:./test.db'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: cd backend && yarn test:ci
|
||||
|
||||
# Job 3: Frontend Tests
|
||||
test-frontend:
|
||||
needs: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: cd frontend && yarn test:run
|
||||
|
||||
# Job 4: E2E Tests (BLOQUEANTE - must pass)
|
||||
test-e2e:
|
||||
needs:
|
||||
- test-backend
|
||||
- test-frontend
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DATABASE_URL: 'file:./test.db'
|
||||
IGDB_CLIENT_ID: ${{ secrets.IGDB_CLIENT_ID }}
|
||||
IGDB_CLIENT_SECRET: ${{ secrets.IGDB_CLIENT_SECRET }}
|
||||
RAWG_API_KEY: ${{ secrets.RAWG_API_KEY }}
|
||||
THEGAMESDB_API_KEY: ${{ secrets.THEGAMESDB_API_KEY }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: yarn test:install
|
||||
|
||||
# Start backend in background
|
||||
- run: |
|
||||
cd backend && yarn dev &
|
||||
sleep 5
|
||||
shell: bash
|
||||
|
||||
# Start frontend in background
|
||||
- run: |
|
||||
cd frontend && yarn dev &
|
||||
sleep 5
|
||||
shell: bash
|
||||
|
||||
# Run E2E tests (timeout 5 min)
|
||||
- run: |
|
||||
timeout 300 yarn test:e2e --reporter=list || true
|
||||
shell: bash
|
||||
|
||||
# Upload Playwright report on failure
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 7
|
||||
Reference in New Issue
Block a user