File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI - Build & Test
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ pull_request :
7+ branches : [ "main" ]
8+
9+ jobs :
10+ build :
11+ name : Build & Validate
12+ runs-on : ubuntu-latest
13+
14+ services :
15+ postgres :
16+ image : postgres:16-alpine
17+ env :
18+ POSTGRES_DB : carteirinhas_db
19+ POSTGRES_USER : postgres
20+ POSTGRES_PASSWORD : postgres
21+ ports :
22+ - 5432:5432
23+ options : >-
24+ --health-cmd "pg_isready -U postgres"
25+ --health-interval 10s
26+ --health-timeout 5s
27+ --health-retries 5
28+
29+ steps :
30+ - name : Checkout code
31+ uses : actions/checkout@v4
32+
33+ - name : Setup Python
34+ uses : actions/setup-python@v5
35+ with :
36+ python-version : ' 3.12'
37+
38+ - name : Setup Node.js
39+ uses : actions/setup-node@v4
40+ with :
41+ node-version : ' 18'
42+
43+ - name : Install backend dependencies
44+ run : |
45+ cd backend
46+ pip install -r requirements.txt
47+
48+ - name : Setup database
49+ run : |
50+ PGPASSWORD=postgres psql -h localhost -U postgres -d carteirinhas_db -f database/schema.sql
51+ PGPASSWORD=postgres psql -h localhost -U postgres -d carteirinhas_db -f database/seeds.sql
52+
53+ - name : Test backend starts
54+ run : |
55+ cd backend
56+ echo "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/carteirinhas_db" > .env
57+ timeout 10 uvicorn app.main:app --host 0.0.0.0 --port 8000 &
58+ sleep 5
59+ curl -f http://localhost:8000/health || exit 1
60+ echo "Backend OK"
61+
62+ - name : Test API processing
63+ run : |
64+ curl -f -X POST http://localhost:8000/api/processar || exit 1
65+ echo "Processing OK"
66+ curl -f http://localhost:8000/api/resumo || exit 1
67+ echo "Resumo OK"
68+ curl -f http://localhost:8000/api/alertas || exit 1
69+ echo "Alertas OK"
70+
71+ - name : Install frontend dependencies
72+ run : |
73+ cd frontend
74+ npm install
75+
76+ - name : Build frontend
77+ run : |
78+ cd frontend
79+ NEXT_PUBLIC_API_URL=http://localhost:8000 npm run build
You can’t perform that action at this time.
0 commit comments