Usage in CI
Getting started
You may want to use SP1 in your Github Actions CI workflow.
You first need to have Rust installed, and you can use actions-rs/toolchain for this:
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.81.0
profile: default
override: true
default: true
components: llvm-tools, rustc-dev
And then you can install the SP1 toolchain:
- name: Install SP1 toolchain
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up
~/.sp1/bin/cargo-prove prove --version
You might experience rate limiting from sp1up. Using a Github Personal Access Token (PAT) will help.
Try setting a github actions secret to your PAT, and then passing it into the sp1up
command:
- name: Install SP1 toolchain
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up --token "${{ secrets.GH_PAT }}"
~/.sp1/bin/cargo-prove prove --version
Speeding up your CI workflow
Caching
To speed up your CI workflow, you can cache the Rust toolchain and Succinct toolchain. See this example
from SP1's CI workflow, which caches the ~/.cargo
and parts of the ~/.sp1
directories.
- name: rust-cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
~/.rustup/
~/.sp1/circuits/plonk/ # Cache these if you're generating plonk proofs with docker in CI.
~/.sp1/circuits/groth16/ # Cache these if you're generating groth16 proofs with docker in CI.
key: rust-1.81.0-${{ hashFiles('**/Cargo.toml') }}
restore-keys: rust-1.81.0-
runs-on
for bigger instances
Since SP1 is a fairly large repository, it might be useful to use runs-on
to specify a larger instance type.