Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 51 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,48 @@ jobs:
- name: Testes unitários
run: pnpm exec vitest run src/testes/unitarios

# ─── Cobertura (unit only) ─────────────────────────────────────────────────
cobertura:
name: Cobertura de Testes
# ─── Testes E2E (MongoDB + Redis) ─────────────────────────────────────────
testes-e2e:
name: Testes E2E
runs-on: ubuntu-latest
needs: testes-unitarios
permissions:
contents: read

services:
mongodb:
image: mongo:8.0
env:
MONGO_INITDB_ROOT_USERNAME: administrador
MONGO_INITDB_ROOT_PASSWORD: 1qaz2sx12
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.runCommand({ ping: 1 })'"
--health-interval 10s
--health-timeout 5s
--health-retries 5

redis:
image: redis:8
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

env:
MONGO_URI: mongodb://administrador:1qaz2sx12@localhost:27017/bem-vindo-testes?authSource=admin
REDIS_URL: redis://localhost:6379
NODE_ENV: test
JWT_SECRETO: jwt-secreto-de-teste-com-pelo-menos-32-chars
JWT_EXPIRACAO_ACCESS: 1h
JWT_EXPIRACAO_REFRESH: 7d
PORTA: 3000
TZ: America/Sao_Paulo

steps:
- uses: actions/checkout@v4

Expand All @@ -80,20 +114,14 @@ jobs:
- name: Instalar dependências
run: pnpm install --frozen-lockfile

- name: Gerar relatório de cobertura
run: pnpm exec vitest run --coverage src/testes/unitarios

- name: Publicar cobertura
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
fail_ci_if_error: false
- name: Testes E2E
run: pnpm exec vitest run src/testes/e2e

# ─── Testes E2E (MongoDB + Redis) ─────────────────────────────────────────
testes-e2e:
name: Testes E2E
# ─── Cobertura (suite completa: unitários + E2E) ───────────────────────────
cobertura:
name: Cobertura de Testes
runs-on: ubuntu-latest
needs: testes-unitarios
needs: testes-e2e
permissions:
contents: read

Expand Down Expand Up @@ -144,5 +172,11 @@ jobs:
- name: Instalar dependências
run: pnpm install --frozen-lockfile

- name: Testes E2E
run: pnpm exec vitest run src/testes/e2e
- name: Gerar relatório de cobertura
run: pnpm test:coverage

- name: Publicar cobertura
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
fail_ci_if_error: false
Loading