Skip to content

Optimize CI workflow structure for better efficiency #624

@mgajek-cern

Description

@mgajek-cern

Problem

The current Update Documentation workflow has several inefficiencies:

  1. Redundant checkouts: Duplicate actions/checkout@v4 in the build job
  2. Mixed concerns: Quality checks and deployment logic in single workflow
  3. Resource waste: 4 separate runners for simple linting tasks that could run sequentially
  4. Slow feedback: PRs must wait for all parallel jobs instead of getting quick validation

Proposed Solution

Split the workflow into focused, efficient workflows:

Quality Checks Workflow (quality-checks.yml)

  • Runs on every push/PR
  • Single job that runs all linting/validation sequentially
  • Faster feedback for contributors
  • Combines: markdown lint, file name checks, shell checks, Python checks

E.g.

name: Quality Checks
on: [push, pull_request]
jobs:
  lint-and-validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup dependencies
        run: |
          # Install all linting tools in one step
          gem install mdl
          sudo apt-get install -y shellcheck
          pip install -r tools/requirements.txt
      - name: Check markdown
        run: ./tools/check-docs.sh
      - name: Check file names  
        run: ./tools/check-file-names.sh
      - name: Check shell scripts
        run: shellcheck **/*.sh
      - name: Check Python
        run: |
          black --check .
          isort --profile black --filter-files --check .
          flake8 --config tools/.flake8
          mypy --ignore-missing-imports .

Build & Deploy Workflow (build-deploy.yml)

  • Runs only on main branch pushes and scheduled
  • Handles documentation generation and deployment
  • Separated from validation concerns

E.g.

name: Build and Deploy
on:
  schedule:
    - cron: '0 4 * * 1-5'
  push:
    branches: [main]
# ... build and deploy logic

Benefits

  • Faster PR feedback - single job vs 4 parallel jobs with setup overhead
  • Resource efficiency - reduced runner usage and setup duplication
  • Clearer separation - validation vs deployment logic separated
  • Easier maintenance - focused workflows are simpler to debug and modify

Implementation

Would involve restructuring .github/workflows/ to replace current workflow with the two focused workflows described above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions