Skip to content

Commit 47f4cc4

Browse files
Merge pull request #1 from rayssarrsilva/ci
Ci
2 parents b9677e4 + 2a8c4a7 commit 47f4cc4

File tree

3 files changed

+61
-10
lines changed

3 files changed

+61
-10
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,62 @@
1-
name: CI
2-
on: [push]
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
39
jobs:
4-
test:
10+
test-backend:
11+
name: Test Backend + Lint + Build
512
runs-on: ubuntu-latest
13+
14+
services:
15+
postgres:
16+
image: postgres:15
17+
env:
18+
POSTGRES_USER: postgres
19+
POSTGRES_PASSWORD: 123
20+
POSTGRES_DB: listacompras_test
21+
ports:
22+
- 5432:5432
23+
options: >-
24+
--health-cmd="pg_isready -U postgres"
25+
--health-interval=5s
26+
--health-timeout=5s
27+
--health-retries=5
28+
629
steps:
7-
- uses: actions/checkout@v4
8-
- uses: actions/setup-python@v5
30+
31+
- name: Checkout código
32+
uses: actions/checkout@v4
33+
34+
- name: Configurar Python
35+
uses: actions/setup-python@v5
936
with:
10-
python-version: '3.11'
11-
- run: pip install -r backend/requirements.txt
12-
- run: pytest backend/tests/
37+
python-version: '3.12'
38+
39+
- name: Instalar dependências do backend
40+
working-directory: backend
41+
run: |
42+
pip install --upgrade pip
43+
pip install -r requirements.txt
44+
pip install flake8
45+
46+
- name: Rodar flake8 (lint)
47+
working-directory: backend
48+
run: |
49+
flake8 . --max-line-length=120
50+
51+
- name: Rodar testes (pytest)
52+
working-directory: backend
53+
env:
54+
DATABASE_URL: postgresql://postgres:123@localhost:5432/listacompras_test
55+
TEST_DATABASE_URL: postgresql://postgres:123@localhost:5432/listacompras_test
56+
SECRET_KEY: "testingkey"
57+
run: |
58+
pytest -q --disable-warnings --maxfail=1
59+
60+
- name: Testar build do Docker (backend e frontend)
61+
run: |
62+
docker compose -f docker-compose.yml build

frontend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
77
build-essential \
88
&& rm -rf /var/lib/apt/lists/*
99

10-
COPY requirements.txt /app/requirements.txt
10+
COPY frontend/requirements.txt /app/requirements.txt
1111

1212
RUN pip install --no-cache-dir --upgrade pip \
1313
&& pip install --no-cache-dir -r /app/requirements.txt

textos/feature.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ ListaCompras/
3737
├──env.exemple
3838
├── .gitignore
3939
├── requirements.txt
40-
└── README.md
40+
└── README.md
41+

0 commit comments

Comments
 (0)