Fix typos #4937
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
merge_group: | |
pull_request: | |
branches: [main, "release-*"] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# this is needed to gain access via OIDC to the S3 bucket for caching | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RISC0_TOOLCHAIN_VERSION: test-release-2 | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
check-benchmarks: ${{ steps.filter.outputs.check-benchmarks }} | |
check-template: ${{ steps.filter.outputs.check-template }} | |
crates-validator: ${{ steps.filter.outputs.crates-validator }} | |
doc: ${{ steps.filter.outputs.doc }} | |
examples: ${{ steps.filter.outputs.examples }} | |
stark2snark: ${{ steps.filter.outputs.stark2snark }} | |
test: ${{ steps.filter.outputs.test }} | |
web: ${{ steps.filter.outputs.web }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: risc0/paths-filter@4067d885736b84de7c414f582ac45897079b0a78 | |
id: filter | |
with: | |
filters: | | |
base: &base | |
- .github/actions/** | |
- .github/workflows/main.yml | |
- Cargo.toml | |
check-benchmarks: | |
- *base | |
- benchmarks/** | |
- risc0/** | |
check-template: | |
- *base | |
- risc0/** | |
- templates/** | |
crates-validator: | |
- *base | |
- tools/crates-validator/** | |
doc: | |
- *base | |
- bonsai/sdk/** | |
- risc0/** | |
examples: | |
- *base | |
- examples/** | |
- risc0/** | |
stark2snark: | |
- *base | |
- compact_proof/** | |
- risc0/** | |
test: | |
- *base | |
- bonsai/sdk/** | |
- external/** | |
- risc0/** | |
web: | |
- *base | |
- examples/browser-verify/** | |
- risc0/** | |
- xtask/** | |
# see: https://github.com/orgs/community/discussions/26822 | |
main-status-check: | |
if: always() | |
needs: | |
- check | |
- check-benchmarks | |
- check-template | |
- crates-validator | |
- doc | |
- examples | |
- reproducible-build | |
- stark2snark | |
- test | |
- web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check all job status | |
# see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context | |
# see https://stackoverflow.com/a/67532120/4907315 | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | |
run: exit 1 | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Full history is required by license-check.py | |
fetch-depth: 0 | |
- uses: ./.github/actions/rustup | |
- name: Install cargo-sort | |
uses: risc0/cargo-install@2cfb0024938d23011106cbf127b393bc83fddba1 | |
with: | |
crate: cargo-sort | |
version: "1.0" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: cargo fmt --all --check | |
- run: cargo fmt --all --check --manifest-path benchmarks/Cargo.toml | |
- run: cargo fmt --all --check --manifest-path bonsai/Cargo.toml | |
- run: cargo fmt --all --check --manifest-path bonsai/examples/governance/Cargo.toml | |
- run: cargo fmt --all --check --manifest-path examples/Cargo.toml | |
- run: cargo fmt --all --check --manifest-path tools/crates-validator/Cargo.toml | |
- run: cargo sort --workspace --check | |
- run: cargo sort --workspace --check benchmarks | |
- run: cargo sort --workspace --check bonsai | |
- run: cargo sort --workspace --check bonsai/examples/governance | |
- run: cargo sort --workspace --check examples | |
- run: cargo sort --workspace --check tools/crates-validator | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- run: python license-check.py | |
test: | |
if: needs.changes.outputs.test == 'true' | |
needs: changes | |
runs-on: [self-hosted, prod, "${{ matrix.os }}", "${{ matrix.device }}"] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [Linux, macOS] | |
feature: [default] | |
device: [cpu] | |
include: | |
- os: Linux | |
feature: cuda | |
device: nvidia_rtx_a5000 | |
env: | |
FEATURE: ${{ matrix.feature }} | |
RISC0_BUILD_LOCKED: 1 | |
RUST_BACKTRACE: full | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- if: matrix.feature == 'cuda' | |
uses: ./.github/actions/cuda | |
- uses: ./.github/actions/rustup | |
- uses: ./.github/actions/sccache | |
with: | |
key: ${{ matrix.os }}-${{ matrix.feature }} | |
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- name: build workspace | |
run: | | |
cargo test -F $FEATURE -F fault-proof -F prove --workspace --timings --no-run \ | |
--exclude doc-test \ | |
--exclude bonsai-ethereum-contracts \ | |
--exclude bonsai-ethereum-relay \ | |
--exclude bonsai-rest-api-mock | |
- name: test workspace | |
run: | | |
cargo test -F $FEATURE -F fault-proof -F prove --workspace --timings \ | |
--exclude doc-test \ | |
--exclude bonsai-ethereum-contracts \ | |
--exclude bonsai-ethereum-relay \ | |
--exclude bonsai-rest-api-mock | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: cargo-timings-${{ matrix.os }}-${{ matrix.device }} | |
path: target/cargo-timings/ | |
retention-days: 5 | |
- name: build risc0-r0vm | |
run: cargo test -p risc0-r0vm -F $FEATURE -F disable-dev-mode --no-run | |
- name: test risc0-r0vm | |
run: cargo test -p risc0-r0vm -F $FEATURE -F disable-dev-mode | |
- run: cargo test -p cargo-risczero -F experimental | |
if: matrix.device == 'cpu' | |
- run: | | |
cargo check -F $FEATURE --benches --workspace \ | |
--exclude doc-test \ | |
--exclude bonsai-ethereum-contracts \ | |
--exclude bonsai-ethereum-relay \ | |
--exclude bonsai-rest-api-mock | |
- run: cargo check -p risc0-build | |
if: matrix.device == 'cpu' | |
- run: cargo check -p risc0-circuit-rv32im -F $FEATURE | |
- run: cargo check -p risc0-core | |
if: matrix.device == 'cpu' | |
- run: cargo check -p risc0-sys -F $FEATURE | |
- run: cargo check -p risc0-zkp -F $FEATURE | |
- run: cargo check -p risc0-zkvm -F $FEATURE | |
- run: cargo check | |
working-directory: external/substrate | |
- uses: risc0/clippy-action@main | |
with: | |
reporter: "github-pr-check" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
clippy_flags: --features $FEATURE --all-targets | |
- run: sccache --show-stats | |
examples: | |
if: needs.changes.outputs.examples == 'true' | |
needs: changes | |
runs-on: [self-hosted, prod, "${{ matrix.os }}", "${{ matrix.device }}"] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [Linux, macOS] | |
feature: [default] | |
device: [cpu] | |
include: | |
- os: Linux | |
feature: cuda | |
device: nvidia_rtx_a5000 | |
env: | |
FEATURE: ${{ matrix.feature }} | |
RISC0_BUILD_LOCKED: 1 | |
RISC0_EXECUTOR: ipc | |
RISC0_PROVER: ipc | |
RISC0_SERVER_PATH: ${{ github.workspace }}/target/release/r0vm | |
RUST_BACKTRACE: full | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- if: matrix.feature == 'cuda' | |
uses: ./.github/actions/cuda | |
- uses: ./.github/actions/rustup | |
- uses: ./.github/actions/sccache | |
with: | |
key: ${{ matrix.os }}-${{ matrix.feature }} | |
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- run: cargo build --release -p risc0-r0vm -F $FEATURE | |
- name: build | |
run: cargo test --locked -F $FEATURE --no-run | |
working-directory: examples | |
- name: test | |
run: cargo test --locked -F $FEATURE | |
working-directory: examples | |
- run: cargo run --locked -F $FEATURE | |
env: | |
RISC0_PPROF_OUT: ${{ github.workspace }}/fibonacci.pb | |
working-directory: examples/profiling | |
- run: sccache --show-stats | |
doc: | |
if: needs.changes.outputs.doc == 'true' | |
needs: changes | |
runs-on: [self-hosted, prod, macOS, cpu] | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/rustup | |
- uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f | |
with: | |
version: nightly-09fe3e041369a816365a020f715ad6f94dbce9f2 | |
- uses: ./.github/actions/sccache | |
with: | |
key: macOS-default | |
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- run: cargo doc --no-deps --exclude=risc0-zkvm-methods --workspace | |
- run: sccache --show-stats | |
check-benchmarks: | |
if: needs.changes.outputs.check-benchmarks == 'true' | |
needs: changes | |
runs-on: [self-hosted, prod, macOS, cpu] | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/rustup | |
- uses: ./.github/actions/sccache | |
with: | |
key: macOS-default | |
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- run: cargo check | |
working-directory: benchmarks | |
- run: sccache --show-stats | |
check-template: | |
if: needs.changes.outputs.check-template == 'true' | |
needs: changes | |
runs-on: [self-hosted, prod, cpu, "${{ matrix.os }}"] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [Linux, macOS] | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: ./.github/actions/rustup | |
- uses: ./.github/actions/sccache | |
with: | |
key: ${{ matrix.os }}-default | |
- run: cargo install --force --path risc0/cargo-risczero | |
- run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- run: | | |
cargo risczero new \ | |
--template templates/rust-starter \ | |
--templ-subdir="" \ | |
--path $(pwd) \ | |
--dest ${{ runner.temp }} \ | |
--guest-name test_method \ | |
template-test | |
shell: bash | |
- run: cargo run --release --manifest-path ${{ runner.temp }}/template-test/Cargo.toml | |
- run: ${{ runner.temp }}/template-test/target/release/host | |
- run: sccache --show-stats | |
crates-validator: | |
if: needs.changes.outputs.crates-validator == 'true' | |
needs: changes | |
runs-on: [self-hosted, prod, macOS, cpu] | |
env: | |
RISC0_BUILD_LOCKED: 1 | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/rustup | |
- uses: ./.github/actions/sccache | |
with: | |
key: macOS-default | |
- uses: risc0/clippy-action@main | |
with: | |
reporter: 'github-pr-check' | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
clippy_flags: --manifest-path tools/crates-validator/Cargo.toml | |
- run: cargo test | |
working-directory: tools/crates-validator | |
- run: sccache --show-stats | |
web: | |
if: needs.changes.outputs.web == 'true' | |
needs: changes | |
runs-on: [self-hosted, prod, Linux, cpu] | |
env: | |
RISC0_BUILD_LOCKED: 1 | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: browser-actions/setup-firefox@v1 | |
- run: firefox --version | |
- uses: ./.github/actions/rustup | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: ./.github/actions/sccache | |
with: | |
key: Linux-default | |
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- run: cargo xtask install | |
- run: cargo xtask gen-receipt | |
- run: | | |
npm install | |
npm test -- --firefox | |
working-directory: examples/browser-verify | |
- run: sccache --show-stats | |
reproducible-build: | |
if: needs.changes.outputs.test == 'true' | |
needs: changes | |
runs-on: [self-hosted, prod, Linux, cpu, docker] | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: ./.github/actions/rustup | |
- uses: ./.github/actions/sccache | |
with: | |
key: Linux-default | |
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- run: cargo test -p risc0-build -F docker | |
- run: cargo test -p risc0-zkvm -F docker -F prove -- "docker::" | |
env: | |
RISC0_USE_DOCKER: "1" | |
- run: sccache --show-stats | |
stark2snark: | |
if: needs.changes.outputs.stark2snark == 'true' | |
needs: changes | |
runs-on: [self-hosted, prod, Linux, cpu, docker] | |
steps: | |
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842 | |
- run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :" | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: ./.github/actions/rustup | |
- uses: ./.github/actions/sccache | |
with: | |
key: Linux-default | |
- run: cargo run --bin cargo-risczero --no-default-features -- risczero install --version $RISC0_TOOLCHAIN_VERSION | |
- run: scripts/install_prover.sh | |
working-directory: compact_proof | |
- run: cargo test --release | |
working-directory: compact_proof/seal_to_json | |
- run: sccache --show-stats |