Skip to content

Commit

Permalink
docs: ci optimizations (#1754)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwen01 authored Nov 8, 2024
1 parent 42274cf commit 40f90de
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions book/developers/usage-in-ci.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Usage in CI

## Getting started

You may want to use SP1 in your [Github Actions](https://docs.github.com/en/actions) CI workflow.

You first need to have Rust installed, and you can use
Expand All @@ -25,3 +27,45 @@ And then you can install the SP1 toolchain:
~/.sp1/bin/sp1up
~/.sp1/bin/cargo-prove prove --version
```
You might experience rate limiting from sp1up. Using a Github
[Personal Access Token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) will help.
Try setting a github actions secret to your PAT, and then passing it into the `sp1up` command:

```yaml
- 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.

```yaml
- 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`](https://github.com/runs-on/runs-on)
to specify a larger instance type.

0 comments on commit 40f90de

Please sign in to comment.