Skip to content

Setup initial CI Pipeline (Linting, Type-Checking, and Testing) #17

@aniebietafia

Description

@aniebietafia

Problem

Currently, the project lacks an automated way to ensure code quality and prevent regressions. Every contribution must be manually checked for formatting (Black, isort) and verified through tests. This slows down the development cycle and increases the risk of introducing bugs.

Proposed Solution

Implement a GitHub Actions workflow that automatically runs on every Push and Pull Request to the main and develop branches. This workflow will perform formatting checks, linting, type-checking, and execute the test suite.

User Stories

  • As a developer, I want my code to be automatically formatted and validated so that I can focus on features rather than style.
  • As a maintainer, I want to ensure that all incoming PRs pass quality checks and tests before being merged.

Acceptance Criteria

  • GitHub Actions workflow file .github/workflows/ci.yml is created.
  • Workflow triggers on push and PR to main and develop.
  • Linting Step: Runs black --check . and isort --check-only ..
  • Type Checking Step: Runs mypy app.
  • Test Step: Runs pytest with code coverage.
  • Workflow fails if any step fails.
  • A status badge is added to the README.

Proposed Technical Details

  • Use actions/checkout@v4 for repository access.
  • Use actions/setup-python@v5 with caching for dependencies.
  • Install dependencies from requirements.txt.
  • Configure pytest to fail if coverage falls below a certain threshold (e.g., 80%).
  • Environment variables for tests (DB connection, etc.) should be handled via a mock or a test database container if needed.

Tasks

  • Initialize .github/workflows/ci.yml.
  • Add linting jobs (Black, isort).
  • Add type-checking job (mypy).
  • Add testing job (pytest).
  • Verify workflow locally using act or by pushing to a branch.
  • Add CI badge to README.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions