Skip to content

ci: restore lab parallelism and shared rust cache#30

Open
andybrown668 wants to merge 1 commit into
mainfrom
ci/lab-runner-parallelism-cache
Open

ci: restore lab parallelism and shared rust cache#30
andybrown668 wants to merge 1 commit into
mainfrom
ci/lab-runner-parallelism-cache

Conversation

@andybrown668

Copy link
Copy Markdown

Related Issues

N/A

Summary of Changes

Self-hosted lab CI was effectively limited to two parallel rustc jobs and did not share a single Rust cache across the main compile-heavy jobs.

  • Remove the workflow-wide CARGO_BUILD_JOBS: 2 cap and the explicit cargo build --jobs 2 override.
  • Add scripts/ci/compute-cargo-build-jobs.sh and run it from the setup composite action so parallelism scales with runner CPU and memory.
  • Wire lab sccache into setup on self-hosted runners and export wrapper/redis env to GITHUB_ENV.
  • Unify CI rust-cache shared-key to ci-${{ hashFiles('**/Cargo.lock') }} so test-and-lint and build-rustfs-debug-binary restore the same cache.

Verification

  • bash -n scripts/ci/compute-cargo-build-jobs.sh
  • bash -n scripts/lab-sccache-env.sh
  • GITHUB_ENV=/tmp/verify-gha-env bash scripts/ci/compute-cargo-build-jobs.sh (lab-large runner: CARGO_BUILD_JOBS=16)
  • source scripts/lab-sccache-env.sh (sets RUSTC_WRAPPER=sccache and Redis URL)
  • CI workflow run on this PR (pending)

make pre-commit not run: change is CI workflow and shell scripts only; no Rust source changes.

Impact

Faster CI on self-hosted lab runners via higher cargo parallelism, shared sccache, and a unified rust-cache key. No runtime or API behavior change for RustFS itself.

Additional Notes

cache-save-if remains main only; PR runs restore cache from main but do not write new entries.

Self-hosted lab runners were capped at CARGO_BUILD_JOBS=2 and split
rust-cache keys prevented CI jobs from sharing compiled artifacts.
Reintroduce resource-based job sizing, wire lab sccache into setup,
and unify the CI cache key across test and debug-binary jobs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 1, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts RustFS CI behavior on self-hosted lab runners to improve build throughput by restoring higher Cargo parallelism, enabling shared sccache, and unifying the Rust cache key so multiple compile-heavy jobs restore the same cache.

Changes:

  • Removes the workflow-wide CARGO_BUILD_JOBS cap and the explicit cargo build --jobs 2 override.
  • Adds a resource-based CARGO_BUILD_JOBS computation script and runs it from the setup composite action.
  • Enables lab sccache wiring in setup and unifies rust-cache shared-key across main jobs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/lab-sccache-env.sh Adds lab sccache + Redis env setup and GHA environment propagation logic.
scripts/ci/compute-cargo-build-jobs.sh Computes Cargo parallelism from CPU + memory and exports CARGO_BUILD_JOBS.
.github/workflows/ci.yml Removes hard-coded job caps and unifies the cache shared key across jobs.
.github/AGENTS.md Updates documented CI gate command list to reflect removal of --jobs 2.
.github/actions/setup/action.yml Runs the new jobs calculator and sources lab sccache env on self-hosted runners.

Comment on lines +14 to +16
[[ -n "$host" && -n "$port" ]] || return 1
BASH_ENV= timeout 1 bash -c "echo > /dev/tcp/${host}/${port}" 2>/dev/null
}
Comment on lines +73 to +78
if [[ -n "${GITHUB_ENV:-}" ]]; then
{
echo "RUSTC_WRAPPER="
echo "CARGO_BUILD_RUSTC_WRAPPER="
} >>"$GITHUB_ENV"
fi
Comment on lines +94 to +98
if [[ -n "${GITHUB_ENV:-}" ]]; then
[[ -n "${RUSTC_WRAPPER:-}" ]] && echo "RUSTC_WRAPPER=${RUSTC_WRAPPER}" >>"$GITHUB_ENV"
[[ -n "${CARGO_BUILD_RUSTC_WRAPPER:-}" ]] && echo "CARGO_BUILD_RUSTC_WRAPPER=${CARGO_BUILD_RUSTC_WRAPPER}" >>"$GITHUB_ENV"
[[ -n "${SCCACHE_REDIS:-}" ]] && echo "SCCACHE_REDIS=${SCCACHE_REDIS}" >>"$GITHUB_ENV"
fi
@andybrown668 andybrown668 enabled auto-merge July 1, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants