Skip to content

Commit 58f5630

Browse files
committed
feat(ci): implement github actions pipeline with linting, type checking and testing
1 parent 7653244 commit 58f5630

6 files changed

Lines changed: 61 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v4
17+
with:
18+
enable-cache: true
19+
20+
- name: Set up Python 3.12
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
25+
- name: Install dependencies
26+
run: uv sync
27+
28+
- name: Lint with Ruff
29+
run: uv run ruff check .
30+
31+
- name: Check formatting with Ruff
32+
run: uv run ruff format --check .
33+
34+
- name: Type check with Mypy
35+
run: uv run mypy .
36+
37+
- name: Run tests with Pytest
38+
run: uv run pytest tests/

AGENTS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ O projeto segue um padrão MVC/Service orientado a serviços:
7171

7272
---
7373

74+
## ⚙️ CI/CD Pipeline
75+
76+
O projeto utiliza **GitHub Actions** para garantir a qualidade contínua do código. A cada `push` ou `pull request` na branch `main`, a pipeline executa automaticamente:
77+
- **Linting & Formatting:** Via `Ruff`.
78+
- **Type Checking:** Via `Mypy`.
79+
- **Automated Tests:** Via `Pytest`.
80+
81+
Certifique-se de que todos os passos passem localmente antes de enviar seu código!
82+
83+
---
84+
7485
## 🗄️ Banco de Dados e Migrações
7586

7687
```bash

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ convention = "google"
5959
quote-style = "double"
6060
indent-style = "space"
6161
skip-magic-trailing-comma = false
62+
63+
[tool.mypy]
64+
python_version = "3.12"
65+
exclude = ["migrations/", "tests/"]
66+
ignore_missing_imports = true
67+
check_untyped_defs = true
68+
warn_unused_ignores = true
69+
show_error_codes = true

src/services/individual_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async def read(self, client_id: int) -> IndividualClientOut:
103103

104104
return IndividualClientOut(
105105
**individual.model_dump(),
106-
address=client.address if client else "",
106+
address=client.address or "" if client else "",
107107
)
108108

109109
async def read_all(
@@ -132,7 +132,7 @@ async def read_all(
132132
output.append(
133133
IndividualClientOut(
134134
**individual.model_dump(),
135-
address=client.address if client else "",
135+
address=client.address or "" if client else "",
136136
)
137137
)
138138
return output

tests/integration/controllers/test_checking_account/test_delete.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ async def test_delete_checking_account_cascade(
7777

7878
async with AsyncSession(async_engine) as session:
7979
db_checking = await session.get(CheckingAccount, account_id)
80+
assert db_checking is not None
8081
parent_id = db_checking.account_id
8182

8283
await client.delete(

tests/integration/controllers/test_individual_client/test_delete.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ async def test_delete_individual_client_cascade(
7676
)
7777
result = await session.exec(statement)
7878
individual = result.first()
79+
assert individual is not None
7980
client_id = individual.client_id
8081

8182
await client.delete(

0 commit comments

Comments
 (0)