Skip to content

Commit

Permalink
Add continuous integration workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dmb225 committed Oct 4, 2024
1 parent 994ea21 commit a412d73
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 7 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: pip install .[develop]
- name: Run ruff
run: ruff check src
- name: Run mypy
run: mypy src

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: pip install .[develop]
- name: Run tests with coverage
run: |
coverage run -m pytest src/tests/unit
coverage report
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ build-backend = "setuptools.build_meta"

[project.optional-dependencies]
develop = [
"pytest==8.3.3",
"mypy==1.11.2",
"pre-commit==3.8.0",
"ruff==0.6.8",
"pre-commit==3.8.0",
"pytest==8.3.3",
"coverage==7.6.1",
]

[tool.mypy]
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from uuid import UUID

from core.entities.user import User
from application.entities.user import User


def test_user_creation():
def test_user_creation() -> None:
user = User(
name="Alice Smith", email="[email protected]", password="securepassword", confirmed=False
)
Expand All @@ -15,7 +15,7 @@ def test_user_creation():
assert isinstance(user.id, UUID)


def test_user_default_id():
def test_user_default_id() -> None:
user1 = User(
name="Alice Smith", email="[email protected]", password="securepassword", confirmed=False
)
Expand All @@ -26,7 +26,7 @@ def test_user_default_id():
assert user1.id != user2.id


def test_user_email_format():
def test_user_email_format() -> None:
user = User(
name="Alice Smith", email="[email protected]", password="securepassword", confirmed=False
)
Expand All @@ -35,7 +35,7 @@ def test_user_email_format():
assert "." in user.email.split("@")[-1]


def test_user_confirmation():
def test_user_confirmation() -> None:
user = User(
name="Alice Smith", email="[email protected]", password="securepassword", confirmed=True
)
Expand Down

0 comments on commit a412d73

Please sign in to comment.