Skip to main content
Version: Next

Reusable Workflows Overview

This section provides comprehensive documentation for all available reusable workflows in the GitHub Action Reusable Workflows for Python project.

View Source Code

All workflow source code is available in the GitHub repository.

Workflow Categoriesโ€‹

Testing Workflowsโ€‹

Coverage Workflowsโ€‹

Build & Deployment Workflowsโ€‹

Release Management Workflowsโ€‹

Docker Workflowsโ€‹

Documentation Workflowsโ€‹

Code Quality Workflowsโ€‹

Quick Referenceโ€‹

Common Workflow Patternsโ€‹

Basic CI Pipelineโ€‹

jobs:
test:
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_run_test.yaml@master
with:
python_version: '3.11'
test_type: unit-test
all_test_items_paths: test/unit_test/

Multi-Version Testingโ€‹

jobs:
test:
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_run_test_with_multi_py_versions.yaml@master
with:
test_type: unit-test
all_test_items_paths: test/unit_test/

Complete CI/CD with Coverageโ€‹

jobs:
prepare-tests:
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_get_tests.yaml@master
with:
shell_arg: test/unit_test/

run-tests:
needs: prepare-tests
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_run_test.yaml@master
with:
python_version: '3.11'
test_type: unit-test
all_test_items_paths: ${{ needs.prepare-tests.outputs.all_test_items }}

coverage:
needs: run-tests
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_organize_test_cov_reports.yaml@master
with:
test_type: unit-test

upload-coverage:
needs: coverage
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_upload_test_cov_report.yaml@master
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
test_type: unit-test
upload-to-codecov: true
codecov_flags: unittests
codecov_name: my-project

Workflow Naming Conventionโ€‹

All reusable workflows follow the naming pattern: rw_<functionality>.yaml

  • rw_ prefix indicates a reusable workflow
  • Descriptive name indicates the workflow's purpose
  • .yaml extension for YAML files

Input Typesโ€‹

Workflows accept three types of inputs:

  1. Required Inputs: Must be provided for the workflow to run
  2. Optional Inputs: Have default values, can be overridden
  3. Secrets: Sensitive data like API tokens and credentials

Output Usageโ€‹

Many workflows provide outputs that can be used by subsequent jobs:

jobs:
job1:
uses: ./.github/workflows/some_workflow.yaml
# ... workflow configuration

job2:
needs: job1
runs-on: ubuntu-latest
steps:
- name: Use output from job1
run: echo "${{ needs.job1.outputs.some_output }}"

Best Practicesโ€‹

  1. Version Pinning: Use specific versions (tags or commit SHAs) in production
  2. Secrets Management: Store sensitive data in GitHub Secrets
  3. Job Dependencies: Use needs to create proper job dependencies
  4. Error Handling: Review workflow logs regularly
  5. Documentation: Document your workflow configurations with comments

Complete Workflow Referenceโ€‹

Below is a complete list of all available reusable workflows with direct links to their source code:

Workflow NameCategoryDescriptionSource Code
rw_get_tests.yamlTestingDiscover test itemsView
rw_run_test.yamlTestingRun tests (single Python version)View
rw_uv_run_test.yamlTestingRun tests with UV (ultra-fast)View
rw_poetry_run_test.yamlTestingRun tests with PoetryView
rw_run_test_with_multi_py_versions.yamlTestingRun tests (multiple Python versions)View
rw_poetry_run_test_with_multi_py_versions.yamlTestingRun tests with Poetry (multi-version)View
rw_organize_test_cov_reports.yamlCoverageOrganize coverage reportsView
rw_upload_test_cov_report.yamlCoverageUpload coverage to platformsView
rw_pre-building_test.yamlBuildTest package installationView
rw_checking_deployment_state.yamlDeploymentCheck deployment stateView
rw_push_pypi.yamlDeploymentPublish to PyPIView
rw_python_package.yamlBuildBuild Python packageView
rw_parse_project_config.yamlReleaseParse project configurationView
rw_parse_release_intent.yamlReleaseParse release intentView
rw_build_git-tag_and_create_github-release.yamlReleaseCreate Git tags and releasesView
rw_build_git-tag_and_create_github-release_v2.yamlReleaseCreate Git tags and releases (v2)View
rw_release_complete.yamlReleaseComplete release processView
rw_release_staging_complete.yamlReleaseStaging release workflowView
rw_release_validation_complete.yamlReleaseValidation release workflowView
rw_docker_operations.yamlDockerBuild and publish Docker imagesView
rw_docusaurus_operations.yamlDocumentationBuild and deploy Docusaurus docsView
rw_documentation_deployment.yamlDocumentationDeploy docs to GitHub PagesView
rw_sonarqube_scan.yamlCode QualitySonarQube/SonarCloud analysisView