Skip to content

Commit 8d6dd97

Browse files
committed
CI: optimize build performance
- Add toolchain-specific and shared cache keys for better cache utilization - Enable incremental compilation and optimize RUSTFLAGS for faster builds - Add manual cache refresh capability via workflow dispatch - Include optional nextest installation for faster test execution - Improve cache efficiency with conditional saving on main branches Mostly inspired from o1-labs/proof-systems
1 parent ed13150 commit 8d6dd97

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

.github/actions/setup-build-deps/action.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ inputs:
55
description: 'Include SQLite3 in the installation'
66
required: false
77
default: 'false'
8+
install-nextest:
9+
description: 'Install cargo-nextest for faster test execution'
10+
required: false
11+
default: 'false'
812
runs:
913
using: 'composite'
1014
steps:
@@ -23,4 +27,10 @@ runs:
2327
if: runner.os == 'macOS'
2428
shell: bash
2529
run: |
26-
brew install protobuf
30+
brew install protobuf
31+
32+
- name: Install cargo-nextest
33+
if: inputs.install-nextest == 'true'
34+
uses: taiki-e/install-action@v2
35+
with:
36+
tool: nextest

.github/actions/setup-rust/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ runs:
3030
if: inputs.enable-cache == 'true'
3131
uses: Swatinem/rust-cache@v2
3232
with:
33-
prefix-key: ${{ inputs.cache-prefix }}
33+
prefix-key: ${{ inputs.cache-prefix }}-${{ inputs.toolchain }}
34+
shared-key: shared-${{ inputs.toolchain }}
35+
save-if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' }}

.github/workflows/ci.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,38 @@ on:
55
pull_request:
66
paths-ignore: [ "frontend" ]
77
workflow_dispatch:
8+
inputs:
9+
refresh_cache:
10+
description: 'Refresh cargo cache'
11+
required: false
12+
type: boolean
13+
default: false
814

915
env:
1016
CARGO_TERM_COLOR: always
1117
RUST_BACKTRACE: full
1218
OPENMINA_PANIC_ON_BUG: true
19+
CARGO_INCREMENTAL: 1
20+
RUSTFLAGS: "-C overflow-checks=off -C debug-assertions=off"
1321

1422
concurrency:
1523
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1624
cancel-in-progress: true
1725

1826
jobs:
27+
refresh-cache:
28+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.refresh_cache == 'true' }}
29+
runs-on: ubuntu-24.04
30+
steps:
31+
- uses: actions/checkout@v5
32+
- name: Setup Rust
33+
uses: ./.github/actions/setup-rust
34+
with:
35+
toolchain: 1.84
36+
enable-cache: false
37+
- name: Clean cargo cache
38+
run: cargo clean
39+
1940
ledger-tests:
2041
timeout-minutes: 20
2142
runs-on: ubuntu-24.04

0 commit comments

Comments
 (0)