@@ -2,12 +2,15 @@ name: build-and-test-rust-projects
22
33on :
44 push :
5- branches : [main]
5+ branches :
6+ - testnet
7+ - staging
68 pull_request :
79 branches : ["*"]
810 paths :
9- - " batcher/**"
10- - " .github/workflows/build-rust.yml"
11+ - " crates/**"
12+ - " aggregation_mode/**"
13+ - " .github/workflows/build-and-test-rust.yml"
1114
1215jobs :
1316 build :
@@ -19,51 +22,105 @@ jobs:
1922 - name : Set up Rust
2023 uses : actions-rs/toolchain@v1
2124 with :
22- toolchain : stable
25+ toolchain : 1.86.0
2326 components : rustfmt, clippy
2427 override : true
28+
29+ # Reference: https://github.com/succinctlabs/sp1/actions/runs/8886659400/workflow#L61-L65
30+ - name : Install sp1 toolchain
31+ run : |
32+ curl -L https://sp1.succinct.xyz | bash
33+ source /home/runner/.bashrc
34+ ~/.sp1/bin/sp1up
35+
36+ - name : Install risc0 toolchain
37+ run : |
38+ curl -L https://risczero.com/install | bash
39+ source ~/.bashrc
40+ ~/.risc0/bin/rzup install
41+
2542 - name : Cache Rust dependencies
2643 uses : actions/cache@v3
2744 with :
2845 path : |
2946 ~/.cargo/registry
3047 ~/.cargo/git
31- batcher /target
48+ crates /target
3249 key : ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
3350 restore-keys : |
3451 ${{ runner.os }}-rust-
35- - name : Check formatting of Rust projects
52+
53+ - name : Check formatting
3654 run : |
37- cd batcher
55+ cd crates
3856 cargo fmt --all -- --check
57+
3958 - name : Run Clippy
4059 run : |
41- cd batcher
60+ cd crates
4261 cargo clippy --all -- -D warnings
43- - name : Build Rust projects
62+
63+ - name : Build Batcher
64+ run : |
65+ cd crates
66+ cargo build --all
67+
68+ - name : Check formatting of AggregationMode
69+ run : |
70+ cd aggregation_mode
71+ cargo fmt --all -- --check
72+
73+ - name : Build AggregationMode # We build before clippy to generate the ELF
4474 run : |
45- cd batcher
75+ cd aggregation_mode
4676 cargo build --all
4777
78+ - name : Run Clippy on AggregationMode
79+ run : |
80+ cd aggregation_mode
81+ # We need to skip the build as clippy does not support the riscv32im-risc0-zkvm-elf target
82+ RISC0_SKIP_BUILD=1 cargo clippy --all -- -D warnings
83+
4884 test :
4985 runs-on : aligned-runner
5086 needs : build
5187 steps :
5288 - name : Checkout code
5389 uses : actions/checkout@v4
90+
5491 - name : foundry-toolchain
5592 uses :
foundry-rs/[email protected] 93+
94+ # Reference: https://github.com/succinctlabs/sp1/actions/runs/8886659400/workflow#L61-L65
95+ - name : Install sp1 toolchain
96+ run : |
97+ curl -L https://sp1.succinct.xyz | bash
98+ source /home/runner/.bashrc
99+ ~/.sp1/bin/sp1up
100+
101+ - name : Install risc0 toolchain
102+ run : |
103+ curl -L https://risczero.com/install | bash
104+ source ~/.bashrc
105+ ~/.risc0/bin/rzup install
106+
56107 - name : Cache Rust dependencies
57108 uses : actions/cache@v3
58109 with :
59110 path : |
60111 ~/.cargo/registry
61112 ~/.cargo/git
62- batcher /target
113+ crates /target
63114 key : ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
64115 restore-keys : |
65116 ${{ runner.os }}-rust-
66- - name : Run tests
117+
118+ - name : Run Batcher tests
119+ run : |
120+ cd crates
121+ cargo test --all
122+
123+ - name : Run AggregationMode tests
67124 run : |
68- cd batcher
125+ cd aggregation_mode
69126 cargo test --all
0 commit comments