Skip to content

Commit

Permalink
install cargo-risczero from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
nategraf committed Dec 17, 2024
1 parent 1bdea35 commit 6deddbf
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
41 changes: 37 additions & 4 deletions .github/actions/cargo-risczero-install/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@ name: cargo risczero install
description: Install cargo risczero, build toolchains, and r0vm.

inputs:
version:
description: |
crates.io version specifier to use when installing cargo-risczero
Mutually exclusive with ref.
required: false
type: string
ref:
description: 'Git reference to pull from risc0/risc0 and build'
required: true
description: |
Git reference to pull from risc0/risc0 and build'
Mutually exclusive with version.
required: false
type: string
toolchain-version:
description: 'Version of the RISC Zero toolchains to install'
Expand All @@ -20,21 +30,44 @@ inputs:
runs:
using: composite
steps:
- name: validate inputs
shell: bash
run: |
if [ ! -z "${{ inputs.version }}" ] && [ ! -z "${{ inputs.ref }}" ]; then
echo "Error: Cannot specify both 'version' and 'ref' parameters"
exit 1
fi
if [ -z "${{ inputs.version }}" ] && [ -z "${{ inputs.ref }}" ]; then
echo "Error: Must specify either 'version' or 'ref' parameter"
exit 1
fi
# Only run these steps if using ref (building from source)
- name: checkout risc0
if: inputs.ref != ''
uses: actions/checkout@v4
with:
repository: 'risc0/risc0'
path: 'tmp/risc0'
ref: ${{ inputs.ref }}
lfs: true
- name: install cargo-risczero
- name: install cargo-risczero from git
if: inputs.ref != ''
run: cargo install --locked --path risc0/cargo-risczero --no-default-features --features "${{ inputs.features }}"
working-directory: tmp/risc0
shell: bash
- name: install r0vm
- name: install r0vm from git
if: inputs.ref != ''
run: cargo install --locked --bin r0vm --path risc0/cargo-risczero --features "${{ inputs.features }}"
shell: bash
working-directory: tmp/risc0

# Only run this step if using version (installing from crates.io)
- name: install cargo-risczero from crates.io
if: inputs.ref != ''
run: cargo install --locked cargo-risczero --version "${{ inputs.version }}" --no-default-features --features "${{ inputs.features }}"
shell: bash

- name: install toolchains
run: cargo risczero install ${{ inputs.toolchain-version != '' && format('--version {0}', inputs.toolchain-version) || '' }}
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permissions:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RISC0_TOOLCHAIN_VERSION: r0.1.81.0
RISC0_MONOREPO_REF: "release-1.2"
RISC0_VERSION: "^1.2"

jobs:
e2e-tests:
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
- uses: foundry-rs/foundry-toolchain@v1
- uses: ./.github/actions/cargo-risczero-install
with:
ref: ${{ env.RISC0_MONOREPO_REF }}
version: ${{ env.RISC0_VERSION }}
toolchain-version: ${{ env.RISC0_TOOLCHAIN_VERSION }}
features: ${{ matrix.feature }}
- name: Setup Kurtosis
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RISC0_TOOLCHAIN_VERSION: r0.1.81.0
RISC0_MONOREPO_REF: "release-1.2"
RISC0_VERSION: "^1.2"
# CARGO_LOCKED is defined as the string '--locked' in PRs targeting release branches and '' elsewhere.
CARGO_LOCKED: ${{ (startsWith(github.base_ref, 'release-') || startsWith(github.base_ref, 'refs/heads/release-')) && '--locked' || '' }}

Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
key: ${{ matrix.os }}-${{ matrix.feature }}
- uses: ./.github/actions/cargo-risczero-install
with:
ref: ${{ env.RISC0_MONOREPO_REF }}
version: ${{ env.RISC0_VERSION }}
toolchain-version: ${{ env.RISC0_TOOLCHAIN_VERSION }}
features: ${{ matrix.feature }}
- name: cargo clippy risc0-ethereum
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
key: ${{ matrix.os }}-${{ matrix.feature }}
- uses: ./.github/actions/cargo-risczero-install
with:
ref: ${{ env.RISC0_MONOREPO_REF }}
version: ${{ env.RISC0_VERSION }}
toolchain-version: ${{ env.RISC0_TOOLCHAIN_VERSION }}
features: ${{ matrix.feature }}
- uses: foundry-rs/foundry-toolchain@v1
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
key: ${{ matrix.os }}-${{ matrix.feature }}
- uses: ./.github/actions/cargo-risczero-install
with:
ref: ${{ env.RISC0_MONOREPO_REF }}
version: ${{ env.RISC0_VERSION }}
toolchain-version: ${{ env.RISC0_TOOLCHAIN_VERSION }}
features: ${{ matrix.feature }}
- uses: foundry-rs/foundry-toolchain@v1
Expand Down

0 comments on commit 6deddbf

Please sign in to comment.