ci(l1): optimize CI times with toolchain caching#60
Conversation
- Cache SP1 toolchain (~/.sp1) with version 5.0.8 in cache key - Cache RISC0 toolchain (~/.risc0) with version 3.0.3 in cache key - Cache ZisK toolchain (~/.zisk) with version 0.14.0 in cache key - Fix ZisK install to use versioned install script (v0.14.0) - Remove unnecessary fetch-depth: 0 from checkout (shallow clone is sufficient) - Change trigger from push to all branches to PR + main only (prevents duplicate runs) - Combine rustfmt and clippy installation into single command - Expand free-disk action to remove more unused tools (CodeQL, Swift, PowerShell, Miniconda)
There was a problem hiding this comment.
Pull request overview
This PR optimizes CI run times through toolchain caching, workflow trigger improvements, and enhanced disk space cleanup. The goal is to reduce redundant downloads and eliminate duplicate CI runs.
Changes:
- Added caching for SP1, RISC0, and ZisK toolchains with versioned cache keys
- Changed workflow triggers from all branch pushes to pull requests and main branch pushes only to prevent duplicate runs
- Consolidated multiple free disk space cleanup commands and added cleanup for CodeQL, Swift, PowerShell, and Miniconda
- Combined rustup component installation commands and removed unnecessary fetch-depth parameter
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/pr-main.yaml |
Updated workflow triggers to reduce duplicate runs, removed fetch-depth, and consolidated rustup commands |
.github/actions/install-sp1/action.yml |
Added caching for SP1 toolchain with version 5.0.8 |
.github/actions/install-risc0/action.yml |
Added caching for RISC0 toolchain with version 3.0.3 |
.github/actions/install-zisk/action.yml |
Added caching for ZisK toolchain with version 0.14.0, fixed install script to use versioned URL, separated PATH update into dedicated step |
.github/actions/free-disk/action.yml |
Consolidated cleanup commands into single step and added additional cleanup targets |
Comments suppressed due to low confidence (2)
.github/actions/install-sp1/action.yml:19
- The SP1 binaries need to be added to PATH regardless of whether the cache was hit. When the cache is restored, the installation step is skipped, but the PATH is not updated. This will cause failures when trying to use SP1 tools. Add a separate step after the installation that always runs to add the SP1 bin directory to GITHUB_PATH, similar to how it's done in the ZisK installation action (line 28-30 in install-zisk/action.yml).
- name: Install SP1
if: steps.sp1-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L https://sp1up.succinct.xyz | bash
~/.sp1/bin/sp1up --version 5.0.8
.github/actions/install-risc0/action.yml:23
- The RISC0 binaries need to be added to PATH regardless of whether the cache was hit. When the cache is restored, the installation step is skipped, but the PATH is not updated. This will cause failures when trying to use RISC0 tools. Add a separate step after the installation that always runs to add the RISC0 bin directory to GITHUB_PATH, similar to how it's done in the ZisK installation action (line 28-30 in install-zisk/action.yml).
- name: Install RISC0
if: steps.risc0-cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -L https://risczero.com/install | bash
~/.risc0/bin/rzup install cargo-risczero 3.0.3
~/.risc0/bin/rzup install risc0-groth16
~/.risc0/bin/rzup install rust
~/.risc0/bin/rzup install cpp
~/.risc0/bin/rzup install r0vm 3.0.3
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Install system dependencies |
There was a problem hiding this comment.
The system dependencies are installed unconditionally every time, even when the ZisK toolchain is restored from cache. While this ensures dependencies are present, it adds unnecessary overhead on cache hits. Consider adding a conditional check or caching the apt packages separately if they are solely for ZisK and not used elsewhere in the workflow.
Motivation
CI runs are taking longer than necessary due to repeated downloads of zkVM toolchains and suboptimal workflow configuration. This PR implements several optimizations to reduce CI time.
Description
Toolchain Caching
~/.sp1directory with keysp1-toolchain-5.0.8~/.risc0directory with keyrisc0-toolchain-3.0.3~/.ziskdirectory with keyzisk-toolchain-0.14.0v0.14.0) instead of latestWhen updating toolchain versions, update both the install command AND the cache key.
Workflow Optimizations
fetch-depth: 0from checkout (shallow clone is sufficient for linting)pushto all branches →pull_request+pushto main onlyrustup component add rustfmtandclippyinto single commandFree Disk Space
Expanded cleanup to include:
Expected Impact
How to Test
Checklist