Skip to content

ci(pipeline): add CI quality, typing, coverage, security scanning, and PR title workflows - #44

Merged
abhirajadhikary06 merged 3 commits into
OBLIQ-in:mainfrom
abhirajadhikary06:ci/quality-and-security-pipeline
Nov 16, 2026
Merged

abhirajadhikary06 merged 3 commits into
OBLIQ-in:mainfrom
abhirajadhikary06:ci/quality-and-security-pipeline

Conversation

@abhirajadhikary06

Copy link
Copy Markdown
Member

Summary

Establishes a comprehensive Continuous Integration (CI) and security scanning pipeline to ensure nothing merges without strict automated verification.

FastAPI Cloud and production environments install dependencies directly from Python packaging files, where packages requiring C/C++ compilation from source can fail unpredictably. This PR pins the runtime environment to Python 3.11 (where PyMuPDF, ONNX Runtime, and PyTorch provide prebuilt binary wheels), locks all 142 dependencies with uv.lock, and enforces code quality, type safety, test coverage, and multi-layered security audits on every Pull Request.


Changes Included

1. Python Environment & Dependency Locking

  • Pinned Python Version: Configured requires-python = ">=3.11,<3.12" in pyproject.toml to guarantee pre-built binary wheel compatibility for PyMuPDF (fitz), ONNX Runtime, and Torch.
  • Pinned Engine: Pinned "obliq-ocr==0.1.3".
  • Lockfile Generation: Created and committed uv.lock with deterministic package resolutions and cryptographic hashes.

2. Code Quality & Static Analysis Gates

  • Linting & Formatting (Ruff):
    • Formatted the codebase with ruff format.
    • Configured [tool.ruff.lint] ignore rules for FastAPI route dependencies (B008), line lengths (E501), and async filesystem operations (ASYNC109, ASYNC240).
  • Static Type Checking (mypy):
    • Enforced type checking across src/ with mypy.
    • Fixed model typing inconsistencies across User, ApiKey, UsageRecord, and CreditLedger (standardizing on uuid.UUID).
    • Passes with 0 errors across all 46 source modules.

3. Testing & Coverage Minimums (>= 60%)

  • Configured [tool.coverage.report] fail_under = 60 with branch coverage enabled.
  • Added unit tests for:
    • JWT token creation and validation (create_access_token, create_refresh_token, decode_token).
    • BLAKE2b API key generation, hashing, and verification.
    • /health and /ready dependency health checks.
  • Test coverage verified at 60.67% (13 passed in CI).

4. Clean-Environment Wheel & Dependency Install Check

  • Added clean-install CI job that boots on a pristine runner, installs packaging tools, runs pip install ., and verifies imports for obliq_api, fitz, onnxruntime, and obliq_ocr without source-build fallback.

5. Multi-Layer Security Scanning

  • CodeQL: Automated AST semantic security scanning for Python (github/codeql-action).
  • pip-audit: Scans installed environments and lockfiles for known CVEs.
  • Secret Scanning: Scans entire git history with gitleaks/gitleaks-action@v2 (fetch-depth: 0).
  • Dependency Review: Checks licenses and newly introduced vulnerabilities on PRs via actions/dependency-review-action@v4.

6. Pull Request Governance

  • Added Validate Conventional Commit Title workflow using amannn/action-semantic-pull-request@v5 enforcing Conventional Commit PR titles (feat:, fix:, ci:, docs:, etc.).
  • Configured branch protection rules on main requiring all 9 checks to be green before merge.

Verification & Status Checks

All 9 checks executed and passed 100% green in GitHub Actions:

  • Lint & Format (Ruff) (29s) — Passed
  • Type Check (mypy) (1m 1s) — Passed
  • Unit & Contract Tests & Coverage (31s) — Passed (60.67% coverage)
  • Clean Environment Install Check (46s) — Passed
  • Security Audit (pip-audit) (31s) — Passed
  • Secret Scanning (Gitleaks) (6s) — Passed
  • CodeQL Security Scan (44s) — Passed
  • Dependency Review Scan (19s) — Passed
  • Validate Conventional Commit Title (14s) — Passed

Checklist

  • PR title follows Conventional Commits format
  • uv.lock generated and committed
  • All automated tests pass with coverage above threshold
  • Branch protection requires every CI check
  • No credentials or secrets committed to repository

Closes #2

@github-actions github-actions Bot added ci CI/CD and workflow changes documentation Improvements or additions to documentation or runbooks test Adding or updating test suites and test fixtures api Endpoints, request and response contract, versioning ocr obliq-ocr engine boundary and extraction results security Authentication, secrets and security concerns deployment FastAPI Cloud apps, environments and releases labels Nov 16, 2026
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@abhirajadhikary06
abhirajadhikary06 merged commit cd9d918 into OBLIQ-in:main Nov 16, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Endpoints, request and response contract, versioning ci CI/CD and workflow changes deployment FastAPI Cloud apps, environments and releases documentation Improvements or additions to documentation or runbooks ocr obliq-ocr engine boundary and extraction results security Authentication, secrets and security concerns test Adding or updating test suites and test fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: add CI pipeline (lint, types, tests, coverage, security scans, PR title lint, pinned Python version)

2 participants