Skip to content

ci: schedule Rust workspace tests on macOS or Linux self-hosted runners - #4287

Open
QuantumExplorer wants to merge 1 commit into
v4.2-devfrom
claude/rust-tests-linux-macos-4ab08f
Open

ci: schedule Rust workspace tests on macOS or Linux self-hosted runners#4287
QuantumExplorer wants to merge 1 commit into
v4.2-devfrom
claude/rust-tests-linux-macos-4ab08f

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Aug 4, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

We added a self-hosted Linux runner, but Rust workspace tests / Tests (macOS) was pinned to runs-on: [self-hosted, macOS, ARM64] and could never schedule onto it. Labels in a runs-on array are AND-ed — there is no OR syntax — so no edit to that list alone can express "macOS or Linux".

Current runners on this repo:

runner labels
mac-runner-1, mac-runner-2 self-hosted, macOS, ARM64
ubuntu-runner-1 self-hosted, Linux, X64, ubuntu, ms-a2

What was done?

Select on a shared custom label instead:

runs-on: [self-hosted, rust-ci]

Whichever of the three runners is idle takes the job. Keeping self-hosted in the list means a GitHub-hosted Linux VM can never match it, so Linux stays self-hosted-only.

Making the job body portable:

  • Build deps — the Homebrew step is gated to macOS. Linux gets an apt equivalent covering only what ./.github/actions/rust doesn't already install (it handles clang, llvm and libsnappy on Linux), plus gh for the immutable-structure check and rustup for dtolnay/rust-toolchain. Each branch is guarded, so it's a no-op once the persistent runner is provisioned by the first run.
  • Disk prune — the absolute 120 GB / 60 GB-free caps are now clamped to a share of the volume (TOTAL/3 and TOTAL/5). On the large macOS volumes this is exactly today's behavior; it stops a smaller volume from tripping the floor on every run and forcing a cold rebuild each time.
  • GPG reset — a macOS keyboxd workaround, gated to macOS.

Linux builds rocksdb from source the same way macOS already does, rather than linking the prebuilt static lib the old Ubuntu jobs used. The persistent target/ makes that a one-time cost and it avoids their sed pass rewriting cdylib crate-types in Cargo.toml, which static rocksdb forced.

Removed the three Ubuntu backup jobs (test-ubuntu, lint-ubuntu, and the whole of tests-rs-doctests.yml) along with their sleep 15 + poll-the-Mac-job-status dance. UBUNTU_BACKUP_ENABLED is false on this repo, so they have been dead code; a second self-hosted runner is the redundancy they were standing in for. Doctests already run inside both Rust jobs under doctests-changed, so dropping the standalone rs-doctests job loses no coverage.

Also added .github/actionlint.yaml declaring rust-ci, so local actionlint runs don't flag it as an unknown label.

Required before merge

The rust-ci label must be added to all three runners (Settings → Actions → Runners → runner → Labels). Until then the job has nothing to schedule onto and will sit queued.

How Has This Been Tested?

  • actionlint (with shellcheck) clean across the three touched workflows; the remaining shellcheck notes are pre-existing and unrelated — the same SC2086 fires on the untouched Homebrew line in tests-rs-wallet.yml.
  • YAML parse + job-list check on all three files.
  • Swept for stale references to the deleted workflow, the old Tests (macOS) job name, and UBUNTU_BACKUP_ENABLED; the three comment mentions left behind were updated.
  • Branch protection on v4.2-dev has no required status checks configured, so the job rename breaks no gate.
  • CI on this PR is the real test of the Linux path — it can't be exercised locally.

Breaking Changes

None.

Notes for reviewers

  • tests-rs-wallet.yml stays pinned to the macOS runners. That fast path is short and mac-only by design; floating it too is a reasonable follow-up but I kept this PR to the workspace job. Its header comment is updated to say so.
  • UBUNTU_BACKUP_ENABLED is now unreferenced and can be deleted from repo variables.
  • Fork PRs get no Rust coverage — unchanged. The if: guard blocked them from the mac runners before and now guards both platforms; the Ubuntu backup that could theoretically have covered them was disabled.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked there is no other PR doing the same thing

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated CI configuration to support self-hosted runners labeled rust-ci.
    • Consolidated Rust workspace testing onto self-hosted runners with automatic environment setup and disk-capacity checks.
    • Removed the standalone Rust doctest workflow and Ubuntu fallback jobs.
    • Updated wallet workflow documentation to reflect the revised macOS runner requirements and testing scope.

`runs-on` label arrays are AND-ed, so `[self-hosted, macOS, ARM64]` could
never also match the new Linux runner. Select on a shared custom label
instead: `[self-hosted, rust-ci]`, applied to both mac runners and the
Linux one. Keeping `self-hosted` in the list means GitHub-hosted runners
still can't pick the job up.

Making the job portable:

- Homebrew setup is gated to macOS; Linux gets an apt equivalent for what
  ./.github/actions/rust doesn't already install (it handles clang, llvm
  and libsnappy), plus gh for the immutable-structure check and rustup for
  dtolnay/rust-toolchain. Every branch is a no-op after the first run.
- The disk prune clamps its absolute caps to a share of the volume, so a
  smaller runner doesn't purge target/ on every run and cold-rebuild.
- The GPG keyboxd reset is a macOS runner workaround, so it's gated too.

Linux builds rocksdb from source like macOS does rather than linking the
prebuilt static lib the old Ubuntu jobs used. The persistent target/ makes
that a one-time cost, and it avoids their sed pass over Cargo.toml crate
types, which static rocksdb forced.

The three Ubuntu backup jobs and their poll-the-Mac-job dance are removed.
UBUNTU_BACKUP_ENABLED has been false, so they were dead code, and a second
self-hosted runner is the redundancy they were standing in for. That
empties tests-rs-doctests.yml; doctests already run inside both Rust jobs
under `doctests-changed`.

The job is renamed Tests (macOS) -> Tests. No branch protection rule
references it. Requires the `rust-ci` label on all three runners.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Rust CI now runs through self-hosted rust-ci runners. The workflow provisions Linux tools, adjusts disk and GPG cleanup, removes the standalone doctest path, and updates fork-execution documentation.

Changes

Rust CI workflow migration

Layer / File(s) Summary
Self-hosted runner selection and execution scope
.github/actionlint.yaml, .github/workflows/tests-rs-workspace.yml, .github/workflows/tests.yml, .github/workflows/tests-rs-wallet.yml
The workspace test job uses the [self-hosted, rust-ci] labels. Comments document fork handling and macOS runner requirements.
Runner provisioning and disk management
.github/workflows/tests-rs-workspace.yml
The workflow provisions Linux dependencies, GitHub CLI, and Rustup when needed. Disk thresholds use volume capacity. GPG cleanup runs only on macOS.
Doctest workflow removal
.github/workflows/tests.yml, .github/workflows/tests-rs-doctests.yml, .github/workflows/tests-rs-wallet.yml
The standalone Rust doctest workflow and its dispatch path are removed. Wallet comments no longer reference the Ubuntu fallback job.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: running Rust workspace tests on macOS or Linux self-hosted runners.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/rust-tests-linux-macos-4ab08f

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added this to the v4.2.0 milestone Aug 4, 2026
@thepastaclaw

thepastaclaw commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

🕓 Ready for review — 4 ahead in queue (commit 0444662)
Queue position: 5/10 · 2 reviews active
ETA: start ~23:46 UTC · complete ~00:10 UTC (median 23m across 30 recent reviews; 2 slots)
Queued 1h 45m ago · Last checked: 2026-08-04 22:40 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/tests.yml:
- Around line 157-162: Update the workflow scope comment near the fork pull
request handling to say that untrusted fork PRs must use the full workspace
path, while acknowledging the trusted thepastaclaw fork exception that may use
the wallet scope and reach tests-rs-wallet.yml. Preserve the existing
distinctions for same-repository pull requests, push runs, and scheduled runs.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 44d48aaf-5c35-4c0a-8958-6b21dcabd387

📥 Commits

Reviewing files that changed from the base of the PR and between 746b34d and 0444662.

📒 Files selected for processing (5)
  • .github/actionlint.yaml
  • .github/workflows/tests-rs-doctests.yml
  • .github/workflows/tests-rs-wallet.yml
  • .github/workflows/tests-rs-workspace.yml
  • .github/workflows/tests.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/tests-rs-doctests.yml

Comment on lines 157 to +162
# The fast path applies only to same-repo pull requests. Fork PRs
# must take the full workspace path (whose Ubuntu backup jobs cover
# them when UBUNTU_BACKUP_ENABLED is set, while the wallet
# workflow's only job skips fork PRs). Push and schedule runs have
# no reliable base SHA — scope computed from the last commit alone
# could silently downgrade the nightly / post-merge full runs.
# must take the full workspace path (both Rust workflows skip fork
# PRs outright, since neither may run untrusted code on a persistent
# runner). Push and schedule runs have no reliable base SHA — scope
# computed from the last commit alone could silently downgrade the
# nightly / post-merge full runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Describe the trusted fork exception in the scope comment.

The comment says that fork pull requests use the full workspace path. Lines [168]-[170] treat a fork owned by thepastaclaw as trusted, so that fork may use scope=wallet and reach tests-rs-wallet.yml. Change the comment to say Untrusted fork PRs.

Proposed wording
-          # The fast path applies only to same-repo pull requests. Fork PRs
-          # must take the full workspace path (both Rust workflows skip fork
-          # PRs outright, since neither may run untrusted code on a persistent
-          # runner). Push and schedule runs have no reliable base SHA — scope
+          # The fast path applies only to same-repo pull requests. Untrusted
+          # fork PRs are classified as full-scope changes. Both Rust workflows
+          # skip those PRs, since neither may run untrusted code on a
+          # persistent runner. Push and schedule runs have no reliable base SHA
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# The fast path applies only to same-repo pull requests. Fork PRs
# must take the full workspace path (whose Ubuntu backup jobs cover
# them when UBUNTU_BACKUP_ENABLED is set, while the wallet
# workflow's only job skips fork PRs). Push and schedule runs have
# no reliable base SHA — scope computed from the last commit alone
# could silently downgrade the nightly / post-merge full runs.
# must take the full workspace path (both Rust workflows skip fork
# PRs outright, since neither may run untrusted code on a persistent
# runner). Push and schedule runs have no reliable base SHA — scope
# computed from the last commit alone could silently downgrade the
# nightly / post-merge full runs.
# The fast path applies only to same-repo pull requests. Untrusted
# fork PRs are classified as full-scope changes. Both Rust workflows
# skip those PRs, since neither may run untrusted code on a
# persistent runner. Push and schedule runs have no reliable base SHA
# computed from the last commit alone could silently downgrade the
# nightly / post-merge full runs.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/tests.yml around lines 157 - 162, Update the workflow
scope comment near the fork pull request handling to say that untrusted fork PRs
must use the full workspace path, while acknowledging the trusted thepastaclaw
fork exception that may use the wallet scope and reach tests-rs-wallet.yml.
Preserve the existing distinctions for same-repository pull requests, push runs,
and scheduled runs.

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