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.
The following actions can be referenced from other repositories using javidahmed64592/|repo_name|/actions/{category}/{action}@main.
Setup Actions¶
setup-uv-python
Description: Sets up Python with uv.
Location:
setup-uv-python/action.ymlSteps:
Installs uv with caching enabled
Sets up Python using the version specified in
.python-versionCaches dependencies based on
uv.lockfor faster builds
Usage:
steps:
- uses: javidahmed64592/actions-template-python/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/actions-template-python/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/actions-template-python/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/actions-template-python/actions/setup/install-python-docs@main
check-tests-exists
Description: Check if the tests directory exists in the repository to conditionally execute test CI jobs.
Location:
check-tests-exists/action.ymlOutputs:
exists: Indicates whether the tests directory exists
Steps:
Checks for directory named
testsSets output to
trueorfalsebased on directory existenceLogs message if directory doesn’t exist
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/setup/check-tests-exists@main
id: check-tests
check-frontend-exists
Description: Check if the frontend directory exists in the repository to conditionally execute frontend CI and build jobs.
Location:
check-frontend-exists/action.ymlOutputs:
exists: Indicates whether the frontend directory exists
Steps:
Checks for directory named
<repository name>-frontendSets output to
trueorfalsebased on directory existenceLogs message if directory doesn’t exist
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/setup/check-frontend-exists@main
id: check-frontend-exists
setup-node
Description: Set up Node.js with npm cache and install dependencies.
Location:
setup-node/action.ymlSteps:
Uses the
setup-nodeactionInstall
npmpackages
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/setup/setup-node@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/actions-template-python/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/actions-template-python/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/actions-template-python/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/actions-template-python/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/actions-template-python/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/actions-template-python/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-versionVerifies frontend version in
package.jsonmatches if frontend directory existsFails if any version mismatch is detected
Usage:
steps:
- uses: javidahmed64592/actions-template-python/actions/setup/check-frontend-exists@main
id: check-frontend-exists
- uses: javidahmed64592/actions-template-python/actions/ci/version-check@main
with:
frontend-dir-exists: ${{ steps.check-frontend-exists.outputs.exists }}
frontend
Description: Runs frontend validation checks (type-checking, linting, formatting, testing) and uploads coverage reports.
Location:
frontend/action.ymlSteps:
Uses the
setup-nodeactionRuns
npm run type-checkfor type checkingRuns
npm run lintfor static code analysisRuns
npm run formatto tidy up scriptsRuns
npm run test:coveragefor frontend unit testsUploads unit test coverage report
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/ci/frontend@main
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/actions-template-python/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 existVerifies the
staticdirectory exists if frontend is presentOptionally verifies additional directories specified in inputs
Fails if any required directory is missing
Usage:
steps:
- uses: javidahmed64592/actions-template-python/actions/setup/check-frontend-exists@main
id: check-frontend-exists
- uses: javidahmed64592/actions-template-python/actions/build/verify-structure@main
with:
frontend-dir-exists: ${{ steps.check-frontend-exists.outputs.exists }}
Advanced usage with additional checks:
steps:
- uses: javidahmed64592/actions-template-python/actions/setup/check-frontend-exists@main
id: check-frontend-exists
- uses: javidahmed64592/actions-template-python/actions/build/verify-structure@main
with:
frontend-dir-exists: ${{ steps.check-frontend-exists.outputs.exists }}
expected-directories: |
custom_directory_1
custom_directory_2
build-frontend
Description: Build the frontend and upload the build artifacts for use in other jobs.
Location:
build-frontend/action.ymlSteps:
Uses the
setup-nodeactionRuns
npm run buildto build frontend static filesUploads static files as build artifact
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/build/build-frontend@main
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/actions-template-python/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
Deploys to GitHub Pages
Returns the deployed page URL as output
Usage:
steps:
- id: publish
uses: javidahmed64592/actions-template-python/actions/docs/publish-docs@main
- run: echo "Deployed to ${{ steps.publish.outputs.page_url }}"
Docker Actions¶
build-start-services
Description: Creates
.envfile from.env.exampleand starts Docker Compose services.Location:
build-start-services/action.ymlSteps:
Moves
.env.exampleto.envRuns
docker compose [build-args] up --build -dSleeps for
wait-secondsto allow services to start
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/docker/build-start-services@main
with:
wait-seconds: "5"
build-args: ""
show-logs
Description: Shows logs from a Docker Compose container.
Location:
show-logs/action.ymlSteps:
Displays logs using
docker compose logsfor the repository name
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/docker/show-logs@main
check-containers
Description: Checks the server health by polling the /api/health endpoint.
Location:
check-containers/action.ymlSteps:
Polls the server’s health endpoint at regular intervals until it returns a successful response or times out
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/docker/check-containers@main
with:
port: 443
num-retries: "5"
timeout-seconds: "5"
stop-services
Description: Stops Docker Compose services and removes volumes and orphans.
Location:
stop-services/action.ymlSteps:
Stops Docker Compose services and removes volumes and orphans
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/docker/stop-services@main
prepare-release
Description: Gets the package version, creates a release directory with essential files, builds a tarball, and uploads it as a workflow artifact.
Location:
prepare-release/action.ymlSteps:
Extracts version via
uv run ci-pyproject-versionCreates release directory and copies
docker-compose.yml,README.md,LICENSE,.env.exampleCreates compressed tarball
Uploads tarball as artifact named
{PACKAGE_NAME}_release
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/docker/prepare-release@main
check-repo-name
Description: Compares the repository name against the package name in
pyproject.tomlto prevent template-derived repositories from accidentally publishing releases.Location:
check-repo-name/action.ymlOutputs:
should_release-"true"if names match,"false"otherwisepackage_name- Package name extracted frompyproject.toml
Steps:
Extracts package name via
uv run ci-pyproject-nameCompares repository name with package name
Sets outputs based on match result and package name
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/docker/check-repo-name@main
id: check_repo_name
get-version
Description: Extracts the version and tag from
pyproject.toml.Location:
get-version/action.ymlOutputs:
version- Version string (e.g.1.2.3)tag- Version tag (e.g.v1.2.3)
Steps:
Extracts version via
uv run ci-pyproject-version
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/docker/get-version@main
id: get_version
check-tag
Description: Checks if a Git tag already exists for the given version to avoid duplicate releases.
Location:
check-tag/action.ymlOutputs:
tag_exists-"true"if the tag exists,"false"otherwise
Steps:
Checks if tag exists using GitHub API
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/docker/check-tag@main
id: check_tag
with:
tag: ${{ steps.get_version.outputs.tag }}
generate-release-notes
Description: Substitutes placeholders in
RELEASE-NOTES.mdwith actual values.Location:
generate-release-notes/action.ymlInputs:
version- Release version (without the v prefix)package_name- Package name frompyproject.toml
Steps:
Substitutes
{{VERSION}},{{PACKAGE_NAME}}, and{{REPOSITORY}}placeholdersRepository is derived from GitHub context
Usage:
steps:
- uses: javidahmed64592/python-template-server/.github/actions/docker/generate-release-notes@main
with:
version: ${{ steps.get_version.outputs.version }}
package_name: ${{ steps.check_repo_name.outputs.package_name }}