Workflows¶
This document details the CI/CD workflows and reusable actions to build and release Python applications. They run automated code quality checks to ensure code remains robust, maintainable, and testable.
Actions¶
The following actions can be referenced from other repositories using javidahmed64592/template-python/.github/actions/{category}/{action}@main.
Setup Actions¶
setup-uv-python
Description: Sets up Python with uv.
Location:
setup-uv-python/action.ymlSteps:
Installs uv using
astral-sh/setup-uv@v7with caching enabledSets up Python using
actions/setup-python@v6and the version specified in.python-versionCaches dependencies based on
uv.lockfor faster builds
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/setup/setup-uv-python@main
install-python-core
Description: Installs core Python dependencies from pyproject.toml using uv.
Location:
install-python-core/action.ymlSteps:
Uses the
setup-uv-pythonactionRuns
uv syncto install only core dependencies
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-core@main
install-python-dev
Description: Installs dev Python dependencies from pyproject.toml using uv.
Location:
install-python-dev/action.ymlSteps:
Uses the
setup-uv-pythonactionRuns
uv sync --extra devto install core and dev dependencies
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main
install-python-docs
Description: Installs documentation Python dependencies from pyproject.toml using uv.
Location:
install-python-docs/action.ymlSteps:
Uses the
setup-uv-pythonactionRuns
uv sync --extra docsto install core and docs dependencies
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-docs@main
CI Actions¶
validate-pyproject
Description: Validate pyproject.toml structure.
Location:
validate-pyproject/action.ymlSteps:
Uses the
install-python-devactionRuns
uv run validate-pyproject pyproject.tomlto validate TOML structure
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/ci/validate-pyproject@main
ruff
Description: Run Ruff linting checks on the codebase.
Location:
ruff/action.ymlSteps:
Uses the
install-python-devactionRuns
uv run -m ruff checkto lint the code
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/ci/ruff@main
mypy
Description: Run Mypy type checking on the codebase.
Location:
mypy/action.ymlSteps:
Uses the
install-python-devactionRuns
uv run -m mypy .to perform static type checking
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/ci/mypy@main
pytest
Description: Run Pytest tests with coverage reporting.
Location:
pytest/action.ymlSteps:
Uses the
install-python-devactionRuns
uv run -m pytest --cov-report html --cov-report termto execute tests with coverageUploads HTML coverage report as artifact named
backend-coverage-reportFails if coverage drops below the threshold configured in
pyproject.toml
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/ci/pytest@main
bandit
Description: Run Bandit security checks on the codebase.
Location:
bandit/action.ymlSteps:
Uses the
install-python-devactionRuns
uv run bandit -r $PACKAGE_NAME -f json -o bandit-report.jsonto scan for security vulnerabilitiesUploads JSON report as artifact named
bandit-report
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/ci/bandit@main
pip-audit
Description: Run pip-audit to check for known vulnerabilities in dependencies.
Location:
pip-audit/action.ymlSteps:
Uses the
install-python-devactionRuns
uv run pip-audit --descto check dependencies for known CVEs
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/ci/pip-audit@main
version-check
Description: Check version consistency across pyproject.toml and uv.lock.
Location:
version-check/action.ymlSteps:
Uses the
install-python-devactionExtracts version from
pyproject.tomlusinguv run ci-pyproject-versionVerifies
uv.lockversion matches usinguv run ci-uv-lock-versionOptionally checks additional version files via
additional-versionsinputFails if any version mismatch is detected
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/ci/version-check@main
Advanced usage with additional version files:
steps:
- uses: javidahmed64592/template-python/.github/actions/ci/version-check@main
with:
additional-versions: '[{"name": "package.json", "version": "1.2.3"}]'
Build Actions¶
build-wheel
Description: Build Python wheel package and upload as artifact.
Location:
build-wheel/action.ymlSteps:
Uses the
install-python-coreactionRuns
uv buildto create the wheelInspects wheel contents using
unzip -lUploads wheel as artifact with name
{PACKAGE_NAME}_wheel
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/build/build-wheel@main
verify-structure
Description: Download and verify the structure of the built wheel package.
Location:
verify-structure/action.ymlSteps:
Uses the
install-python-coreactionDownloads the wheel artifact (named
{PACKAGE_NAME}_wheel)Installs the wheel using
uv pip installVerifies that
site-packagesand the package directory existOptionally verifies additional directories specified in inputs
Fails if any required directory is missing
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main
Advanced usage with additional checks:
steps:
- uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main
with:
expected-directories: |
static
Docs Actions¶
build-docs
Description: Build Sphinx documentation and upload as artifact.
Location:
build-docs/action.ymlSteps:
Uses the
install-python-docsactionRuns
uv run sphinx-build -M clean docs/source/ docs/build/to clean previous buildsRuns
uv run sphinx-build -M html docs/source/ docs/build/to build HTML documentationUploads built documentation as artifact named
documentation
Usage:
steps:
- uses: javidahmed64592/template-python/.github/actions/docs/build-docs@main
publish-docs
Description: Deploy Sphinx documentation to GitHub Pages.
Location:
publish-docs/action.ymlOutputs:
page_url: URL of the deployed GitHub Pages site
Steps:
Downloads the
documentationartifactUploads HTML files to GitHub Pages using
actions/upload-pages-artifact@v4Deploys to GitHub Pages using
actions/deploy-pages@v5Returns the deployed page URL as output
Usage:
steps:
- id: publish
uses: javidahmed64592/template-python/.github/actions/docs/publish-docs@main
- run: echo "Deployed to ${{ steps.publish.outputs.page_url }}"
Workflows¶
The following workflows ensure Python codebases are robust and thoroughly tested.
CI Workflow¶
The CI workflow runs on pushes and pull requests to the main branch.
It runs parallel jobs to validate code quality, security, and consistency.
Jobs:
validate-pyproject- Validatespyproject.tomlstructureruff- Runs Ruff linting checksmypy- Runs static type checkingpytest- Runs tests with coverage reportingbandit- Scans for security vulnerabilitiespip-audit- Audits dependencies for known CVEsversion-check- Verifies version consistency
Build Workflow¶
The Build workflow runs on pushes and pull requests to the main branch.
It builds and verifies the Python wheel package.
Jobs:
build-wheel- Builds the wheel package and uploads as artifactverify-structure- Downloads and verifies the wheel contents (depends onbuild-wheel)
Docs Workflow¶
The Docs workflow runs on pushes and pull requests to the main branch.
It builds Sphinx documentation and deploys it to GitHub Pages on pushes to main.
Jobs:
build-docs- Builds the Sphinx HTML documentation and uploads as artifactpublish-docs- Deploys documentation to GitHub Pages (only on pushes tomain, depends onbuild-docs)