From 8cd4668193eb02d1e06c56c20ef1d321204b01a3 Mon Sep 17 00:00:00 2001 From: jfldde <168934971+jfldde@users.noreply.github.com> Date: Fri, 25 Oct 2024 23:13:48 +0100 Subject: [PATCH] Add risc0-install action shared across workflows (#1379) --- .github/actions/install-risc0/action.yml | 21 ++++++++++ .github/workflows/checks.yml | 50 +++++++----------------- .github/workflows/nightly_build_push.yml | 16 ++------ .github/workflows/perf.yml | 10 ++--- .github/workflows/release.yml | 32 ++++----------- 5 files changed, 51 insertions(+), 78 deletions(-) create mode 100644 .github/actions/install-risc0/action.yml diff --git a/.github/actions/install-risc0/action.yml b/.github/actions/install-risc0/action.yml new file mode 100644 index 000000000..d2efa3d50 --- /dev/null +++ b/.github/actions/install-risc0/action.yml @@ -0,0 +1,21 @@ +name: 'Install risc0' +description: 'Installs risc0 toolchain' + +inputs: + github_token: + description: 'GitHub token for authentication' + required: true + +runs: + using: "composite" + steps: + - name: Install cargo-risczero + uses: taiki-e/install-action@v2 + with: + tool: cargo-risczero@1.1.2 + + - name: Install risc0-zkvm toolchain + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.github_token }} + run: cargo risczero install --version r0.1.79.0-2 diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 41a4ce9ad..40e491ea3 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -86,14 +86,10 @@ jobs: uses: dtolnay/rust-toolchain@nightly - name: Rust Cache uses: Swatinem/rust-cache@v2 - - name: Install cargo-risczero - uses: taiki-e/install-action@v2 + - name: Install risc0 + uses: ./.github/actions/install-risc0 with: - tool: cargo-risczero@1.1.2 - - name: Install risc0-zkvm toolchain - run: cargo risczero install --version r0.1.79.0-2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Build citrea run: make build-release env: @@ -127,14 +123,10 @@ jobs: components: rustfmt, clippy - name: Rust Cache uses: Swatinem/rust-cache@v2 - - name: Install cargo-risczero - uses: taiki-e/install-action@v2 + - name: Install risc0 + uses: ./.github/actions/install-risc0 with: - tool: cargo-risczero@1.1.2 - - name: Install risc0-zkvm toolchain - run: cargo risczero install --version r0.1.79.0-2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Check TOML uses: dprint/check@v2.2 - name: Run lint @@ -166,14 +158,10 @@ jobs: override: true - name: Rust Cache uses: Swatinem/rust-cache@v2 - - name: Install cargo-risczero - uses: taiki-e/install-action@v2 + - name: Install risc0 + uses: ./.github/actions/install-risc0 with: - tool: cargo-risczero@1.1.2 - - name: Install risc0-zkvm toolchain - run: cargo risczero install --version r0.1.79.0-2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Run cargo-udeps env: RUSTFLAGS: -A warnings @@ -205,14 +193,10 @@ jobs: uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@nextest - uses: taiki-e/install-action@cargo-llvm-cov - - name: Install cargo-risczero - uses: taiki-e/install-action@v2 + - name: Install risc0 + uses: ./.github/actions/install-risc0 with: - tool: cargo-risczero@1.1.2 - - name: Install risc0-zkvm toolchain - run: cargo risczero install --version r0.1.79.0-2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Cache ethereum-tests uses: actions/cache@v3 with: @@ -373,14 +357,10 @@ jobs: uses: dtolnay/rust-toolchain@1.79.0 - name: Rust Cache uses: Swatinem/rust-cache@v2 - - name: Install cargo-risczero - uses: taiki-e/install-action@v2 + - name: Install risc0 + uses: ./.github/actions/install-risc0 with: - tool: cargo-risczero@1.1.2 - - name: Install risc0-zkvm toolchain - run: cargo risczero install --version r0.1.79.0-2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} # `cargo-nextest` is much faster than standard `cargo test`. - uses: taiki-e/install-action@nextest - name: Cache ethereum-tests diff --git a/.github/workflows/nightly_build_push.yml b/.github/workflows/nightly_build_push.yml index 8266552ed..995f6bb64 100644 --- a/.github/workflows/nightly_build_push.yml +++ b/.github/workflows/nightly_build_push.yml @@ -35,18 +35,10 @@ jobs: rustup install 1.79.0 rustup default 1.79.0 - - name: Install Cargo Binstall - run: | - cargo install --version 1.7.0 cargo-binstall - - - name: Install cargo-risczero - run: | - cargo binstall cargo-risczero@1.1.2 --no-confirm - - - name: Install risc0-zkvm toolchain - run: cargo risczero install --version r0.1.79.0-2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install risc0 + uses: ./.github/actions/install-risc0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Build Project env: diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index df0a61e72..737f9cefc 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -31,14 +31,10 @@ jobs: components: rustfmt, clippy - name: Rust Cache uses: Swatinem/rust-cache@v2 - - name: Install cargo-risczero - uses: taiki-e/install-action@v2 + - name: Install risc0 + uses: ./.github/actions/install-risc0 with: - tool: cargo-risczero@1.1.2 - - name: Install risc0-zkvm toolchain - run: cargo risczero install --version r0.1.79.0-2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Cache ethereum-tests uses: actions/cache@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d939191a0..6ddfe88a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,19 +33,10 @@ jobs: rustup install 1.79.0 rustup default 1.79.0 - - name: Install Cargo Binstall - run: | - source $HOME/.cargo/env - cargo install --version 1.7.0 cargo-binstall - - - name: Install cargo-risczero - run: | - cargo binstall cargo-risczero@1.1.2 --no-confirm - - - name: Install risc0-zkvm toolchain - run: cargo risczero install --version r0.1.79.0-2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install risc0 + uses: ./.github/actions/install-risc0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Build Project env: @@ -79,17 +70,10 @@ jobs: rustup install 1.79.0 rustup default 1.79.0 - - name: Install Cargo Binstall - run: | - source $HOME/.cargo/env - cargo install --version 1.7.0 cargo-binstall - - name: Install cargo-risczero - run: | - cargo binstall cargo-risczero@1.1.2 --no-confirm - - name: Install risc0-zkvm toolchain - run: cargo risczero install --version r0.1.79.0-2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install risc0 + uses: ./.github/actions/install-risc0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Build Project env: REPR_GUEST_BUILD: 1