ci: add Rust compilation and dependency caching#1603
Conversation
Enable sccache for compilation caching using GitHub Actions cache backend, and Swatinem/rust-cache for dependency caching. This significantly reduces CI build times by avoiding redundant compilation and dependency downloads. - Add ci/install-sccache.ps1 for cross-platform sccache installation - Configure sccache with GHA cache backend for all Rust jobs - Add Swatinem/rust-cache@v2.7.3 with cache-targets disabled - Make sccache opt-out via workflow inputs (enabled by default)
There was a problem hiding this comment.
Pull request overview
This PR adds compilation and dependency caching to GitHub Actions CI workflows to reduce build times. Sccache is configured with GitHub Actions cache backend for compilation caching, while Swatinem/rust-cache handles dependency caching.
Key changes:
- Added cross-platform PowerShell script for sccache installation
- Configured sccache with GitHub Actions cache backend across all Rust build jobs
- Added Swatinem/rust-cache@v2.7.3 for cargo registry and dependency caching
- Made sccache opt-out via workflow inputs (enabled by default)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| ci/install-sccache.ps1 | New PowerShell script for cross-platform sccache binary installation with version 0.12.0 |
| .github/workflows/create-new-release.yml | Disables sccache for release builds by passing sccache: false input |
| .github/workflows/ci.yml | Adds workflow inputs for sccache control, configures caching in preflight job, and adds Rust cache + sccache setup steps to all Rust build jobs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
.github/workflows/ci.yml:1174
- The
pedm-simulatorjob compiles Rust code (viacargo +nightly buildin prepare.ps1) but is missing the Rust cache setup that was added to other Rust compilation jobs. For consistency and to benefit from caching improvements, consider adding:
- name: Setup Rust cache
uses: ./.github/actions/setup-rust-cache
with:
sccache-enabled: ${{ needs.preflight.outputs.sccache }}after the checkout step and before the "Prepare runner" step. Also add a "Show sccache stats" step at the end of the job.
pedm-simulator:
name: PEDM simulator
runs-on: windows-2022
needs: [preflight]
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Prepare runner
run: |
rustup toolchain install nightly
choco install pstools --yes
- name: Prepare PEDM simulator build
run: ./crates/pedm-simulator/prepare.ps1
- name: Build PEDM simulator container
run: ./crates/pedm-simulator/build-container.ps1
- name: Run PEDM simulator (container with limited user)
run: ./crates/pedm-simulator/run-container.ps1
# It’s difficult to get realtime stdout/stderr when using psexec -s.
# Instead, the run-expect-elevation.ps1 script will redirect the output into a file that we can read afterwards.
- name: Run PEDM simulator (as LocalSystem)
run: |
$scriptPath = Resolve-Path -Path "./crates/pedm-simulator/run-expect-elevation.ps1"
psexec -accepteula -s pwsh.exe $scriptPath
Get-Content -Path ./crates/pedm-simulator/pedm-simulator_run-expect-elevation.out
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
.github/workflows/ci.yml:1152
- The
pedm-simulatorjob runscargo build(via the prepare.ps1 script) but doesn't have the Rust cache setup. This is inconsistent with other Rust build jobs and will result in slower build times. Consider adding:
- name: Setup Rust cache
uses: ./.github/actions/setup-rust-cache
with:
sccache-enabled: ${{ needs.preflight.outputs.sccache }}after the checkout step and before the "Prepare runner" step.
pedm-simulator:
name: PEDM simulator
runs-on: windows-2022
needs: [preflight]
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
with:
ref: ${{ needs.preflight.outputs.ref }}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Enable sccache for compilation caching using GitHub Actions cache backend, and Swatinem/rust-cache for dependency caching. This significantly reduces CI build times by avoiding redundant compilation and dependency downloads.