From f59ca92c7a3cdf6311bc0455d66b50935d35b3da Mon Sep 17 00:00:00 2001 From: Rahul Guha <19rahul2003@gmail.com> Date: Sun, 1 Feb 2026 21:18:51 +0530 Subject: [PATCH 1/8] use v4 --- .github/workflows/auto-release.yml | 2 +- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/risc0.yml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index f29e63fc0..a0bf44296 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -168,7 +168,7 @@ jobs: toolchain: nightly - name: Cache Zig packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/zig key: ${{ runner.os }}-zig-packages-${{ hashFiles('build.zig.zon') }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc2076ca1..677cb3981 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: version: 0.14.1 - name: Cache Zig packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/zig key: ${{ runner.os }}-zig-packages-${{ hashFiles('build.zig.zon') }} @@ -94,7 +94,7 @@ jobs: toolchain: nightly - name: Cache Zig packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/zig key: ${{ runner.os }}-zig-packages-${{ hashFiles('build.zig.zon') }} @@ -148,7 +148,7 @@ jobs: components: clippy, rustfmt - name: Cache Zig packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/zig key: ${{ runner.os }}-zig-packages-${{ hashFiles('build.zig.zon') }} @@ -202,7 +202,7 @@ jobs: toolchain: nightly - name: Cache Zig packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/zig key: ${{ runner.os }}-zig-packages-${{ hashFiles('build.zig.zon') }} @@ -273,7 +273,7 @@ jobs: toolchain: nightly - name: Cache Zig packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/zig key: ${{ runner.os }}-zig-packages-${{ hashFiles('build.zig.zon') }} @@ -312,7 +312,7 @@ jobs: toolchain: nightly - name: Cache Zig packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/zig key: ${{ runner.os }}-zig-packages-${{ hashFiles('build.zig.zon') }} diff --git a/.github/workflows/risc0.yml b/.github/workflows/risc0.yml index 58bb6770f..167fcf987 100644 --- a/.github/workflows/risc0.yml +++ b/.github/workflows/risc0.yml @@ -28,7 +28,7 @@ jobs: version: 0.14.1 - name: Cache Zig packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/zig key: ${{ runner.os }}-zig-packages-${{ hashFiles('**/build.zig.zon') }} From 9a9c18b671c015d42bd1134214b16042527c884b Mon Sep 17 00:00:00 2001 From: Rahul Guha <19rahul2003@gmail.com> Date: Mon, 2 Feb 2026 13:49:59 +0530 Subject: [PATCH 2/8] cache fixtures --- .github/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 677cb3981..cf0482320 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -243,7 +243,17 @@ jobs: curl -LsSf https://astral.sh/uv/install.sh | sh echo "$HOME/.local/bin" >> "$GITHUB_PATH" + - name: Cache LeanSpec fixtures + id: cache-leanspec + uses: actions/cache@v4 + with: + path: leanSpec/fixtures + key: ${{ runner.os }}-leanspec-${{ hashFiles('leanSpec/**/*.py', 'leanSpec/**/*.yml', 'leanSpec/**/*.yaml', 'leanSpec/**/*.toml') }} + restore-keys: | + ${{ runner.os }}-leanspec- + - name: Generate LeanSpec fixtures + if: steps.cache-leanspec.outputs.cache-hit != 'true' working-directory: leanSpec run: uv run fill --clean --fork=devnet From 692d5a4afc2098116362f6da2b95dd29b09290b8 Mon Sep 17 00:00:00 2001 From: guha-rahul <52607971+guha-rahul@users.noreply.github.com> Date: Mon, 2 Feb 2026 15:33:51 +0530 Subject: [PATCH 3/8] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf0482320..bc6ef953c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -253,7 +253,7 @@ jobs: ${{ runner.os }}-leanspec- - name: Generate LeanSpec fixtures - if: steps.cache-leanspec.outputs.cache-hit != 'true' + if: steps['cache-leanspec'].outputs.cache-hit != 'true' working-directory: leanSpec run: uv run fill --clean --fork=devnet From e88cd472cc195e1d203c7c52fc6755b4948a3925 Mon Sep 17 00:00:00 2001 From: Rahul Guha <19rahul2003@gmail.com> Date: Fri, 6 Mar 2026 14:44:07 +0530 Subject: [PATCH 4/8] remove restore keys --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e6e2ccf7..a547472f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -249,8 +249,6 @@ jobs: with: path: leanSpec/fixtures key: ${{ runner.os }}-leanspec-${{ hashFiles('leanSpec/**/*.py', 'leanSpec/**/*.yml', 'leanSpec/**/*.yaml', 'leanSpec/**/*.toml') }} - restore-keys: | - ${{ runner.os }}-leanspec- - name: Generate LeanSpec fixtures if: steps['cache-leanspec'].outputs.cache-hit != 'true' From f502f3519e5d3eb5d48e71accadde3f0f3ae46a8 Mon Sep 17 00:00:00 2001 From: Rahul Guha <19rahul2003@gmail.com> Date: Fri, 20 Mar 2026 15:04:45 +0530 Subject: [PATCH 5/8] improve CI caching: fix leanspec, shared rust keys, better zig restore-keys --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e91bb36e0..018d669f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,7 @@ jobs: path: ~/.cache/zig key: ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon', 'build.zig') }} restore-keys: | + ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon') }}- ${{ runner.os }}-zig- - name: Fetch Zig dependencies @@ -62,7 +63,8 @@ jobs: - name: Cache dependencies uses: Swatinem/rust-cache@v2 with: - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + shared-key: lint + workspaces: "rust -> target" - name: Check Rust formatting run: | @@ -108,13 +110,14 @@ jobs: path: ~/.cache/zig key: ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon', 'build.zig') }} restore-keys: | + ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon') }}- ${{ runner.os }}-zig- - name: Cache Rust dependencies uses: Swatinem/rust-cache@v2 with: workspaces: "rust -> target" - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + shared-key: ci - name: Fetch Zig dependencies run: | @@ -180,13 +183,14 @@ jobs: path: ~/.cache/zig key: ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon', 'build.zig') }} restore-keys: | + ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon') }}- ${{ runner.os }}-zig- - name: Cache Rust dependencies uses: Swatinem/rust-cache@v2 with: workspaces: "rust -> target" - key: ${{ runner.os }}-cargo-all-provers-${{ hashFiles('**/Cargo.lock') }} + shared-key: ci-all-provers - name: Fetch Zig dependencies run: | @@ -250,13 +254,14 @@ jobs: path: ~/.cache/zig key: ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon', 'build.zig') }} restore-keys: | + ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon') }}- ${{ runner.os }}-zig- - name: Cache Rust dependencies uses: Swatinem/rust-cache@v2 with: workspaces: "rust -> target" - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} + shared-key: ci - name: Fetch Zig dependencies run: | @@ -300,21 +305,22 @@ jobs: echo "All sim test attempts failed" exit 1 - - name: Install uv - shell: bash - run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - echo "$HOME/.local/bin" >> "$GITHUB_PATH" - - name: Cache LeanSpec fixtures id: cache-leanspec uses: actions/cache@v4 with: path: leanSpec/fixtures - key: ${{ runner.os }}-leanspec-${{ hashFiles('leanSpec/**/*.py', 'leanSpec/**/*.yml', 'leanSpec/**/*.yaml', 'leanSpec/**/*.toml') }} + key: ${{ runner.os }}-leanspec-${{ hashFiles('.gitmodules') }} + + - name: Install uv + if: steps.cache-leanspec.outputs.cache-hit != 'true' + shell: bash + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Generate LeanSpec fixtures - if: steps['cache-leanspec'].outputs.cache-hit != 'true' + if: steps.cache-leanspec.outputs.cache-hit != 'true' working-directory: leanSpec run: uv run fill --clean --fork=devnet -n auto @@ -358,13 +364,14 @@ jobs: path: ~/.cache/zig key: ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon', 'build.zig') }} restore-keys: | + ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon') }}- ${{ runner.os }}-zig- - name: Cache Rust dependencies uses: Swatinem/rust-cache@v2 with: workspaces: "rust -> target" - key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} + shared-key: ci - name: Fetch Zig dependencies run: | @@ -430,13 +437,14 @@ jobs: path: ~/.cache/zig key: ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon', 'build.zig') }} restore-keys: | + ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon') }}- ${{ runner.os }}-zig- - name: Cache Rust dependencies uses: Swatinem/rust-cache@v2 with: workspaces: "rust -> target" - key: ${{ runner.os }}-cargo-docker-${{ hashFiles('**/Cargo.lock') }} + shared-key: ci - name: Fetch Zig dependencies run: | From 583b5fa875e141f300d50f94e25c373749ee9dc1 Mon Sep 17 00:00:00 2001 From: Rahul Guha <19rahul2003@gmail.com> Date: Fri, 20 Mar 2026 15:10:43 +0530 Subject: [PATCH 6/8] add deps job to warm caches before build/test/dummy-prove --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 018d669f8..e24dbf7aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,75 @@ jobs: - name: Lint run: zig fmt --check . + deps: + name: deps + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up Zig + uses: mlugg/setup-zig@v2.0.5 + with: + version: 0.15.2 + + - name: Set up Rust/Cargo + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + + - name: Cache Zig packages + uses: actions/cache@v4 + with: + path: ~/.cache/zig + key: ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon', 'build.zig') }} + restore-keys: | + ${{ runner.os }}-zig-${{ hashFiles('build.zig.zon') }}- + ${{ runner.os }}-zig- + + - name: Cache Rust dependencies + uses: Swatinem/rust-cache@v2 + with: + workspaces: "rust -> target" + shared-key: ci + + - name: Fetch Zig dependencies + run: | + max_attempts=3 + for attempt in $(seq 1 $max_attempts); do + if zig build --fetch; then + echo "Successfully fetched dependencies on attempt $attempt" + exit 0 + fi + echo "Attempt $attempt/$max_attempts failed, retrying in 5 seconds..." + sleep 5 + done + echo "All fetch attempts failed" + exit 1 + + - name: Build Rust FFI libraries + run: cargo +nightly -C rust -Z unstable-options build --release -p libp2p-glue -p hashsig-glue -p multisig-glue + + - name: Build all (warms Zig cache including RocksDB) + run: | + max_attempts=3 + for attempt in $(seq 1 $max_attempts); do + if zig build all; then + echo "Successfully built on attempt $attempt" + exit 0 + fi + echo "Attempt $attempt/$max_attempts failed, retrying in 5 seconds..." + sleep 5 + done + echo "All build attempts failed" + exit 1 + build: + needs: deps runs-on: ${{ matrix.os }} strategy: matrix: @@ -222,6 +290,7 @@ jobs: test: name: test + needs: deps runs-on: ${{ matrix.os }} strategy: matrix: @@ -332,6 +401,7 @@ jobs: dummy-prove: name: Dummy prove + needs: deps runs-on: ${{ matrix.os }} strategy: matrix: From c87a5b3cea5782c0a73a1d17c1f7595743df9568 Mon Sep 17 00:00:00 2001 From: Rahul Guha <19rahul2003@gmail.com> Date: Fri, 20 Mar 2026 21:01:20 +0530 Subject: [PATCH 7/8] trigger CI to test cache hits --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e24dbf7aa..bd9aa1c80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: pull_request: workflow_dispatch: -# only one can run at a time in PRs +# Only one can run at a time in PRs concurrency: # If PR, cancel prev commits. head_ref = source branch name on pull_request, null if push group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} From 6b902dddd335c8385695d263f89a23d6f9453760 Mon Sep 17 00:00:00 2001 From: Rahul Guha <19rahul2003@gmail.com> Date: Fri, 20 Mar 2026 21:10:28 +0530 Subject: [PATCH 8/8] fix leanspec cache key to track submodule content, ungated dummy-prove from deps --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8031b39e7..0a8c04556 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -379,7 +379,7 @@ jobs: uses: actions/cache@v4 with: path: leanSpec/fixtures - key: ${{ runner.os }}-leanspec-${{ hashFiles('.gitmodules') }} + key: ${{ runner.os }}-leanspec-${{ hashFiles('leanSpec/**') }} - name: Install uv if: steps.cache-leanspec.outputs.cache-hit != 'true' @@ -401,7 +401,6 @@ jobs: dummy-prove: name: Dummy prove - needs: deps runs-on: ${{ matrix.os }} strategy: matrix: