-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (52 loc) · 1.53 KB
/
ci.yml
File metadata and controls
62 lines (52 loc) · 1.53 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
name: CI Pipeline
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
test-backend:
name: Test Backend + Lint + Build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 123
POSTGRES_DB: listacompras_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=5s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout código
uses: actions/checkout@v4
- name: Configurar Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Instalar dependências do backend
working-directory: backend
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install flake8
- name: Rodar flake8 (lint)
working-directory: backend
run: |
flake8 . --max-line-length=120
- name: Rodar testes (pytest)
working-directory: backend
env:
DATABASE_URL: postgresql://postgres:123@localhost:5432/listacompras_test
TEST_DATABASE_URL: postgresql://postgres:123@localhost:5432/listacompras_test
SECRET_KEY: "testingkey"
run: |
pytest -q --disable-warnings --maxfail=1
- name: Testar build do Docker (backend e frontend)
run: |
docker compose -f docker-compose.yml build