Skip to content

Commit 199cfd7

Browse files
committed
feat: add GitHub Actions workflow for updating caches across multiple platforms (aarch64, x86_64, and Linux)
1 parent 4213822 commit 199cfd7

File tree

1 file changed

+244
-0
lines changed

1 file changed

+244
-0
lines changed

.github/workflows/update-cache.yml

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
name: Update Caches
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
update-aarch64-cache:
7+
runs-on: macos-latest
8+
env:
9+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install Rust iOS toolchain
14+
uses: dtolnay/[email protected]
15+
with:
16+
targets: |
17+
aarch64-apple-ios
18+
aarch64-apple-ios-sim
19+
aarch64-apple-darwin
20+
aarch64-linux-android
21+
22+
- name: Install Nargo
23+
uses: noir-lang/[email protected]
24+
with:
25+
toolchain: 1.0.0-beta.8
26+
27+
- name: Build circuits
28+
run: |
29+
cd circuits
30+
sh ./scripts/generate-bytecode-and-witness.sh keccak
31+
sh ./scripts/generate-bytecode-and-witness.sh keccak_large
32+
33+
- name: Build for iOS
34+
run: |
35+
cargo build --target aarch64-apple-ios --features ios-build
36+
- name: Build for iOS Simulator
37+
run: |
38+
cargo build --target aarch64-apple-ios-sim --features ios-build
39+
- name: Build for macOS Darwin
40+
run: |
41+
cargo build --target aarch64-apple-darwin --features ios-build
42+
43+
# Cache Cargo registry and dependencies
44+
- name: Cache Cargo registry
45+
uses: actions/cache/save@v4
46+
with:
47+
path: |
48+
~/.cargo/registry
49+
~/.cargo/git
50+
key: ${{ runner.os }}-aarch64-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
51+
52+
# Cache Cargo build artifacts
53+
- name: Cache Cargo build
54+
uses: actions/cache/save@v4
55+
with:
56+
path: |
57+
target/
58+
bb/target/
59+
noir/target/
60+
key: ${{ runner.os }}-aarch64-cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/*.rs') }}
61+
62+
# Cache circuit artifacts
63+
- name: Cache circuit artifacts
64+
uses: actions/cache/save@v4
65+
with:
66+
path: |
67+
circuits/target/
68+
key: ${{ runner.os }}-aarch64-circuit-artifacts-${{ hashFiles('circuits/**/*.nr', 'circuits/**/*.toml') }}
69+
70+
# Cache Nargo installation
71+
- name: Cache Nargo
72+
uses: actions/cache/save@v4
73+
with:
74+
path: |
75+
~/.nargo
76+
key: ${{ runner.os }}-aarch64-nargo-1.0.0-beta.8
77+
78+
# Cache cargo-ndk installation
79+
- name: Cache cargo-ndk
80+
uses: actions/cache/save@v4
81+
with:
82+
path: |
83+
~/.cargo/bin/cargo-ndk
84+
key: ${{ runner.os }}-aarch64-cargo-ndk-${{ hashFiles('~/.cargo/bin/cargo-ndk') }}
85+
86+
- name: Install cargo-ndk
87+
run: |
88+
if ! command -v cargo-ndk &> /dev/null; then
89+
cargo install cargo-ndk
90+
fi
91+
92+
- name: Build for Android
93+
run: |
94+
cargo ndk -t arm64-v8a build --features android-build
95+
96+
update-x86_64-cache:
97+
runs-on: macos-13
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- name: Install Rust x86_64 toolchain
104+
uses: dtolnay/[email protected]
105+
with:
106+
targets: |
107+
x86_64-apple-ios
108+
x86_64-apple-darwin
109+
x86_64-linux-android
110+
111+
- name: Install Nargo
112+
uses: noir-lang/[email protected]
113+
with:
114+
toolchain: 1.0.0-beta.8
115+
116+
- name: Build circuits
117+
run: |
118+
cd circuits
119+
sh ./scripts/generate-bytecode-and-witness.sh keccak
120+
sh ./scripts/generate-bytecode-and-witness.sh keccak_large
121+
122+
- name: Build for iOS x86_64
123+
run: |
124+
cargo build --target x86_64-apple-ios --features ios-build
125+
- name: Build for macOS Darwin x86_64
126+
run: |
127+
cargo build --target x86_64-apple-darwin --features ios-build
128+
# Cache Cargo registry and dependencies
129+
- name: Cache Cargo registry
130+
uses: actions/cache/save@v4
131+
with:
132+
path: |
133+
~/.cargo/registry
134+
~/.cargo/git
135+
key: ${{ runner.os }}-x86_64-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
136+
137+
# Cache Cargo build artifacts
138+
- name: Cache Cargo build
139+
uses: actions/cache/save@v4
140+
with:
141+
path: |
142+
target/
143+
bb/target/
144+
noir/target/
145+
key: ${{ runner.os }}-x86_64-cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/*.rs') }}
146+
147+
# Cache Nargo installation
148+
- name: Cache Nargo
149+
uses: actions/cache/save@v4
150+
with:
151+
path: |
152+
~/.nargo
153+
key: ${{ runner.os }}-x86_64-nargo-1.0.0-beta.8
154+
155+
# Cache circuit artifacts
156+
- name: Cache circuit artifacts
157+
uses: actions/cache/save@v4
158+
with:
159+
path: |
160+
circuits/target/
161+
key: ${{ runner.os }}-x86_64-circuit-artifacts-${{ hashFiles('circuits/**/*.nr', 'circuits/**/*.toml') }}
162+
163+
# Cache cargo-ndk installation
164+
- name: Cache cargo-ndk
165+
uses: actions/cache/save@v4
166+
with:
167+
path: |
168+
~/.cargo/bin/cargo-ndk
169+
key: ${{ runner.os }}-x86_64-cargo-ndk-${{ hashFiles('~/.cargo/bin/cargo-ndk') }}
170+
171+
- name: Install cargo-ndk
172+
run: |
173+
if ! command -v cargo-ndk &> /dev/null; then
174+
cargo install cargo-ndk
175+
fi
176+
177+
- name: Build for Android x86_64
178+
run: |
179+
cargo ndk -t x86_64 build --features android-build
180+
181+
update-linux-cache:
182+
runs-on: ubuntu-latest
183+
env:
184+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
steps:
186+
- uses: actions/checkout@v4
187+
188+
- name: Install Rust Linux toolchain
189+
uses: dtolnay/[email protected]
190+
with:
191+
targets: |
192+
x86_64-unknown-linux-gnu
193+
194+
- name: Install Nargo
195+
uses: noir-lang/[email protected]
196+
with:
197+
toolchain: 1.0.0-beta.8
198+
199+
- name: Build circuits
200+
run: |
201+
cd circuits
202+
sh ./scripts/generate-bytecode-and-witness.sh keccak
203+
sh ./scripts/generate-bytecode-and-witness.sh keccak_large
204+
205+
- name: Build for Linux x86_64
206+
run: |
207+
cargo build --target x86_64-unknown-linux-gnu
208+
# Cache Cargo registry and dependencies
209+
- name: Cache Cargo registry
210+
uses: actions/cache/save@v4
211+
with:
212+
path: |
213+
~/.cargo/registry
214+
~/.cargo/git
215+
key: ${{ runner.os }}-linux-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
216+
217+
218+
# Cache Cargo build artifacts
219+
- name: Cache Cargo build
220+
uses: actions/cache/save@v4
221+
with:
222+
path: |
223+
target/
224+
bb/target/
225+
noir/target/
226+
key: ${{ runner.os }}-linux-cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/*.rs') }}
227+
228+
# Cache Nargo installation
229+
- name: Cache Nargo
230+
uses: actions/cache/save@v4
231+
with:
232+
path: |
233+
~/.nargo
234+
key: ${{ runner.os }}-linux-nargo-1.0.0-beta.8
235+
236+
237+
# Cache circuit artifacts
238+
- name: Cache circuit artifacts
239+
uses: actions/cache/save@v4
240+
with:
241+
path: |
242+
circuits/target/
243+
key: ${{ runner.os }}-linux-circuit-artifacts-${{ hashFiles('circuits/**/*.nr', 'circuits/**/*.toml') }}
244+

0 commit comments

Comments
 (0)