Skip to content

CI/CD: Refactor GitHub Actions to use reusable workflows #91

@m-marinucci

Description

@m-marinucci

Context

As identified in PR #89 review, the GitHub Actions workflows contain significant duplication and are very verbose.

Problem

Current workflows have:

  • Duplicated setup steps across multiple jobs
  • Repeated dependency installation
  • Similar caching configurations copy-pasted
  • Common build steps reimplemented in each workflow

Proposed Solution

1. Create Reusable Workflows

# .github/workflows/reusable-setup.yml
name: Reusable Setup
on:
  workflow_call:
    inputs:
      compiler:
        required: true
        type: string
      
jobs:
  setup:
    steps:
      - name: Install Dependencies
        # Common dependency installation
      - name: Setup Cache
        # Common cache configuration

2. Create Composite Actions

# .github/actions/setup-build-env/action.yml
name: Setup Build Environment
inputs:
  compiler:
    required: true
runs:
  using: composite
  steps:
    - name: Install compiler
    - name: Setup ccache
    - name: Configure environment

3. Consolidate Common Logic

  • Extract common build steps
  • Create shared scripts for complex operations
  • Use matrix strategies more effectively

Benefits

  • Reduced maintenance burden
  • Consistent behavior across workflows
  • Easier updates and improvements
  • Better readability
  • Faster workflow development

Implementation Plan

  1. Identify common patterns across workflows
  2. Create reusable workflow templates
  3. Implement composite actions for setup
  4. Refactor existing workflows to use shared components
  5. Document new workflow architecture

Related: PR #89

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions