ci: restore lab parallelism and shared rust cache#30
Open
andybrown668 wants to merge 1 commit into
Open
Conversation
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>
There was a problem hiding this comment.
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_JOBScap and the explicitcargo build --jobs 2override. - Adds a resource-based
CARGO_BUILD_JOBScomputation script and runs it from the setup composite action. - Enables lab
sccachewiring in setup and unifiesrust-cacheshared-keyacross 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
N/A
Summary of Changes
Self-hosted lab CI was effectively limited to two parallel
rustcjobs and did not share a single Rust cache across the main compile-heavy jobs.CARGO_BUILD_JOBS: 2cap and the explicitcargo build --jobs 2override.scripts/ci/compute-cargo-build-jobs.shand run it from the setup composite action so parallelism scales with runner CPU and memory.sccacheinto setup on self-hosted runners and export wrapper/redis env toGITHUB_ENV.rust-cacheshared-keytoci-${{ hashFiles('**/Cargo.lock') }}sotest-and-lintandbuild-rustfs-debug-binaryrestore the same cache.Verification
bash -n scripts/ci/compute-cargo-build-jobs.shbash -n scripts/lab-sccache-env.shGITHUB_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(setsRUSTC_WRAPPER=sccacheand Redis URL)make pre-commitnot 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 unifiedrust-cachekey. No runtime or API behavior change for RustFS itself.Additional Notes
cache-save-ifremainsmainonly; PR runs restore cache frommainbut do not write new entries.