Skip to content

GitHub Actions Workflow Optimization with Parallel Job Matrix and Caching #201

Description

@JamesEjembi

Problem Statement

CI workflows run sequentially with no caching between jobs, taking 25+ minutes. Optimize with parallel job execution, dependency caching, and conditional execution to reduce to under 8 minutes.

Technical Bounds

  • Cargo registry cache: shared across all Rust jobs; keyed by ~/.cargo/registry/** hash.
  • Target directory cache: per-branch with LRU eviction; limited to 2GB.
  • Job fan-out: run test suites in parallel across 4 runners (unit, integration, e2e, fuzz).
  • Conditional execution: skip lint and coverage on doc-only changes; skip e2e on non-core changes.

Steps

  1. Add Cargo registry caching: actions/cache@v3 with key cargo-registry-${{ hashFiles('Cargo.lock') }}; restore key cargo-registry-.
  2. Add target directory caching: key cargo-target-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}; max 2GB.
  3. Restructure workflow with parallel job matrix: job: [lint, test, integration, coverage, fuzz].
  4. Add path-based conditional execution: paths-ignore: ['docs/**', '*.md'] for lint job.
  5. Measure and document time improvements; add workflow status badge to README.
  6. Add workflow timeout: 30 minutes max per workflow run to prevent runaway jobs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions