TEST-INFRA: [ci-pipeline-design] Refactor CI workflow to use reusable workflows #5503

Open
opened 2026-04-09 07:06:47 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Branch: test-infra/ci-pipeline-design/reusable-workflows
  • Commit Message: refactor(ci): extract common setup steps into reusable workflow
  • Milestone: v3.7.0
  • Parent Epic: #5407

Overview

The .forgejo/workflows/ci.yml file contains a significant amount of duplication. Many jobs share the same setup steps, such as installing Node.js, checking out the code, and installing uv and nox. This duplication makes the workflow file long and difficult to maintain.

By using reusable workflows, we can define these common setup steps in one place and reuse them across multiple jobs. This will make our CI pipeline more modular, maintainable, and easier to read.

Proposed Changes

I propose creating a new reusable workflow file (e.g., .forgejo/workflows/setup.yml) that contains the common setup steps. The main ci.yml file can then be refactored to call this reusable workflow.

Example

.forgejo/workflows/setup.yml

on:
  workflow_call:

jobs:
  setup:
    runs-on: docker
    container:
      image: python:3.13-slim
    steps:
      - name: Install Node.js (required by actions/checkout)
        run: |
          apt-get update && apt-get install -y -qq nodejs && rm -rf /var/lib/apt/lists/*
      - uses: actions/checkout@v4
      - name: Install uv and nox
        run: |
          pip install -q uv==${{ env.UV_VERSION }} nox
      - name: Cache uv packages
        uses: actions/cache@v3
        with:
          path: ~/.cache/uv
          key: uv-${{ hashFiles('pyproject.toml') }}
          restore-keys: |
            uv-

ci.yml

jobs:
  lint:
    uses: ./.forgejo/workflows/setup.yml
    with:
      # pass any specific inputs here
    steps:
      - name: Run lint via nox
        run: |
          mkdir -p build
          nox -s lint 2>&1 | tee build/nox-lint-output.log

Duplicate Check

  • Search Queries: reusable, workflow, duplicate, duplication, refactor
  • Results: 0 issues found.
  • Conclusion: This is not a duplicate issue.

Subtasks

  • Audit .forgejo/workflows/ci.yml and identify all duplicated setup steps
  • Create .forgejo/workflows/setup.yml reusable workflow with common setup steps
  • Refactor ci.yml to call the reusable workflow for each job
  • Verify all CI jobs still pass after refactoring
  • Update any documentation referencing the CI workflow structure

Definition of Done

  • All duplicated setup steps are extracted into a reusable workflow
  • ci.yml is refactored to use the reusable workflow
  • All nox stages pass
  • Coverage >= 97%
  • PR reviewed and merged

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: new-issue-creator

## Metadata - **Branch**: `test-infra/ci-pipeline-design/reusable-workflows` - **Commit Message**: `refactor(ci): extract common setup steps into reusable workflow` - **Milestone**: v3.7.0 - **Parent Epic**: #5407 ## Overview The `.forgejo/workflows/ci.yml` file contains a significant amount of duplication. Many jobs share the same setup steps, such as installing Node.js, checking out the code, and installing `uv` and `nox`. This duplication makes the workflow file long and difficult to maintain. By using reusable workflows, we can define these common setup steps in one place and reuse them across multiple jobs. This will make our CI pipeline more modular, maintainable, and easier to read. ## Proposed Changes I propose creating a new reusable workflow file (e.g., `.forgejo/workflows/setup.yml`) that contains the common setup steps. The main `ci.yml` file can then be refactored to call this reusable workflow. ## Example **`.forgejo/workflows/setup.yml`** ```yaml on: workflow_call: jobs: setup: runs-on: docker container: image: python:3.13-slim steps: - name: Install Node.js (required by actions/checkout) run: | apt-get update && apt-get install -y -qq nodejs && rm -rf /var/lib/apt/lists/* - uses: actions/checkout@v4 - name: Install uv and nox run: | pip install -q uv==${{ env.UV_VERSION }} nox - name: Cache uv packages uses: actions/cache@v3 with: path: ~/.cache/uv key: uv-${{ hashFiles('pyproject.toml') }} restore-keys: | uv- ``` **`ci.yml`** ```yaml jobs: lint: uses: ./.forgejo/workflows/setup.yml with: # pass any specific inputs here steps: - name: Run lint via nox run: | mkdir -p build nox -s lint 2>&1 | tee build/nox-lint-output.log ``` ## Duplicate Check - **Search Queries**: `reusable`, `workflow`, `duplicate`, `duplication`, `refactor` - **Results**: 0 issues found. - **Conclusion**: This is not a duplicate issue. ## Subtasks - [ ] Audit `.forgejo/workflows/ci.yml` and identify all duplicated setup steps - [ ] Create `.forgejo/workflows/setup.yml` reusable workflow with common setup steps - [ ] Refactor `ci.yml` to call the reusable workflow for each job - [ ] Verify all CI jobs still pass after refactoring - [ ] Update any documentation referencing the CI workflow structure ## Definition of Done - [ ] All duplicated setup steps are extracted into a reusable workflow - [ ] `ci.yml` is refactored to use the reusable workflow - [ ] All nox stages pass - [ ] Coverage >= 97% - [ ] PR reviewed and merged > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: new-issue-creator
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#5503
No description provided.