-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (79 loc) · 2.5 KB
/
Copy pathe2e.yml
File metadata and controls
81 lines (79 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: E2E (navegador)
# O serviço de IA não é necessário: os cenários cobrem seu estado indisponível.
# Executa a regressão de navegador em mudanças de aplicação, dados e testes.
on:
pull_request:
branches: [main]
paths:
- "backend/**"
- "frontend/**"
- "database/**"
- "e2e/**"
- "docker-compose.yml"
- ".github/workflows/e2e.yml"
push:
branches: [main]
paths:
- "backend/**"
- "frontend/**"
- "database/**"
- "e2e/**"
- "docker-compose.yml"
- ".github/workflows/e2e.yml"
workflow_dispatch:
jobs:
e2e:
name: E2E com API real, PostgreSQL e Chrome
runs-on: ubuntu-latest
services:
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: e2e
POSTGRES_PASSWORD: e2e_only
POSTGRES_DB: sinapse_e2e_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U e2e -d sinapse_e2e_test"
--health-interval 5s --health-timeout 5s --health-retries 10
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USER: e2e
POSTGRES_PASSWORD: e2e_only
POSTGRES_DB: sinapse_e2e_test
E2E_API_URL: http://localhost:3001/api/v1
E2E_APP_URL: http://localhost:5173
E2E_CHROME_PATH: /usr/bin/google-chrome
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Instalar dependências
run: |
npm ci --prefix backend
npm ci --prefix frontend
npm ci --prefix e2e
- name: Migrar o banco
run: npm run migrate
working-directory: backend
- name: Subir backend e frontend
run: |
export DOCUMENT_STORAGE_DIR="$RUNNER_TEMP/documents"
mkdir -p "$DOCUMENT_STORAGE_DIR"
(cd backend && nohup npx tsx src/index.ts > "$RUNNER_TEMP/backend.log" 2>&1 &)
(cd frontend && nohup npx vite --port 5173 --strictPort > "$RUNNER_TEMP/frontend.log" 2>&1 &)
for i in $(seq 1 30); do
curl -fs http://localhost:3001/health > /dev/null && curl -fs http://localhost:5173 > /dev/null && exit 0
sleep 2
done
cat "$RUNNER_TEMP/backend.log" "$RUNNER_TEMP/frontend.log"
exit 1
- name: Executar E2E
run: npm test
working-directory: e2e
- name: Logs dos serviços
if: failure()
run: cat "$RUNNER_TEMP/backend.log" "$RUNNER_TEMP/frontend.log"