Skip to content

CI: gate PyPI releases on automated tests and code quality checks #34

Description

@FernandoCelmer

Context

This repo currently publishes to PyPI (python-publish-pypi.yml / python-publish-pypi-test.yml) with no automated verification step: no test suite runs, no linting/type-checking gate, and no check that LAST_VERSION, pyproject.toml, and mkdocs_dracula_theme/__init__.py actually agree on the version being released. A release can currently ship even if those three drift out of sync.

Goal

Add a CI safety net so releases only go out once tests and code-quality checks pass, and once the version is verified consistent across all three sources of truth.

Concepts / building blocks

  • verify-version action — new composite action that compares LAST_VERSION against pyproject.toml's version and mkdocs_dracula_theme/__init__.py's __version__, failing the run on any mismatch.
  • test.yml workflow — runs pytest (with coverage) across a Python version matrix (3.9–3.13), reusable via workflow_call.
  • code-quality.yml workflow — runs ruff check, ruff format --check, and mypy across the same matrix, reusable via workflow_call.
  • .code_quality/ — new ruff.toml and mypy.ini config, since none exist yet.
  • tests/ — new directory with a minimal smoke-test suite for the theme package, since none exists yet.
  • Poetry dependency groups — add dev (pytest, pytest-cov) and code-quality (ruff, mypy) groups to pyproject.toml.
  • Publish workflow gatingpython-publish-pypi.yml and python-publish-pypi-test.yml call test.yml + code-quality.yml as required jobs before the deploy job runs, and call verify-version before building the package.
  • setup-poetry action fix — cache key currently ignores the Python version, so cross-version runs can collide on the same cache entry; key needs ${{ inputs.python-version }} added.

Scope

  • Add verify-version composite action
  • Fix setup-poetry cache key (include Python version) + add poetry lock fallback
  • Add test.yml workflow + minimal tests/ suite
  • Add code-quality.yml workflow + .code_quality/ruff.toml + .code_quality/mypy.ini
  • Add dev and code-quality poetry dependency groups to pyproject.toml
  • Gate python-publish-pypi.yml on tests + code quality + version verification
  • Gate python-publish-pypi-test.yml on tests + code quality + version verification

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions