Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 99 additions & 99 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,107 +1,107 @@
name: Build and Test

on:
push:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
push:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review

env:
CARGO_TERM_COLOR: always
CARGO_TERM_COLOR: always

jobs:
clippy_check:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
env:
RUSTFLAGS: "-Dwarnings" # Make sure CI fails on all warnings, including Clippy lints
steps:
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --all-features
lint:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
clippy_check:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
env:
RUSTFLAGS: "-Dwarnings" # Make sure CI fails on all warnings, including Clippy lints
steps:
- uses: actions/checkout@v5
- name: Run Clippy
run: cargo clippy --all-targets --all-features
lint:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v5

- name: Check formatting
run: cargo fmt --all -- --check
build-ios:
runs-on: macos-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
target:
- aarch64-apple-ios
- aarch64-apple-ios-sim
- x86_64-apple-ios
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.81.0"
targets: ${{ matrix.target }}
- name: Build
run: cargo build --target ${{ matrix.target }}
build-android:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
target:
- x86_64-linux-android
- aarch64-linux-android
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.81.0"
targets: ${{ matrix.target }}
- name: Install Android NDK
run: cargo install cargo-ndk
- name: Build
run: cargo ndk -t ${{ matrix.target }} build
test-linux:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.81.0"
override: true
- name: Run tests
run: cargo test
test-macOS:
runs-on: macos-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.81.0"
override: true
- name: Run tests
run: cargo test
test-macOS-x86_64:
runs-on: macos-13
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.81.0"
override: true
- name: Run tests
run: cargo test
- name: Check formatting
run: cargo fmt --all -- --check
build-ios:
runs-on: macos-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
target:
- aarch64-apple-ios
- aarch64-apple-ios-sim
- x86_64-apple-ios
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.89.0"
targets: ${{ matrix.target }}
- name: Build
run: cargo build --target ${{ matrix.target }}
build-android:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
target:
- x86_64-linux-android
- aarch64-linux-android
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.89.0"
targets: ${{ matrix.target }}
- name: Install Android NDK
run: cargo install cargo-ndk
- name: Build
run: cargo ndk -t ${{ matrix.target }} build
test-linux:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.89.0"
override: true
- name: Run tests
run: cargo test
test-macOS:
runs-on: macos-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.89.0"
override: true
- name: Run tests
run: cargo test
test-macOS-x86_64:
runs-on: macos-13
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.89.0"
override: true
- name: Run tests
run: cargo test
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This project provides a Rust adapter for compiling and linking [Rapidsnark](http
### Rust toolchain

```
cargo 1.81.0 (2dbb1af80 2024-08-20)
cargo 1.89.0 (c24e10642 2025-06-23)
```

## Usage
Expand Down
1 change: 1 addition & 0 deletions crates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ num-traits = "0.2.19"

[build-dependencies]
cc = "1.0"
chkstk_stub = "0.1"
2 changes: 1 addition & 1 deletion crates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This project provides a Rust adapter for compiling and linking [Rapidsnark](http
### Rust toolchain

```
cargo 1.81.0 (2dbb1af80 2024-08-20)
cargo 1.89.0 (c24e10642 2025-06-23)
```

## Usage
Expand Down
14 changes: 8 additions & 6 deletions crates/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ fn main() {
let out_dir = env::var("OUT_DIR").expect("OUT_DIR not set");
let arch = target.split('-').next().unwrap();

// See: https://github.com/zkmopro/chkstk_stub
chkstk_stub::build();

// Try to list contents of the target directory
let rapidsnark_path = Path::new(&out_dir).join(Path::new("rapidsnark"));
// If the rapidsnark repo is not downloaded, download it
Expand All @@ -22,11 +25,11 @@ fn main() {
.arg(rapidsnark_script_path.to_str().unwrap())
.spawn();
if let Err(e) = child_process {
panic!("Failed to spawn rapidsnark download: {}", e);
panic!("Failed to spawn rapidsnark download: {e}");
}
let status = child_process.unwrap().wait();
if let Err(e) = status {
panic!("Failed to wait for rapidsnark download: {}", e);
panic!("Failed to wait for rapidsnark download: {e}");
} else if !status.unwrap().success() {
panic!("Failed to wait for rapidsnark download");
}
Expand All @@ -49,7 +52,7 @@ fn main() {
);

println!("cargo:rustc-link-lib=static=rapidsnark");
println!("cargo:rustc-link-lib={}", cpp_stdlib);
println!("cargo:rustc-link-lib={cpp_stdlib}");
if target.contains("android") {
// pthread is included in libc in android
println!("cargo:rustc-link-lib=c");
Expand Down Expand Up @@ -83,11 +86,10 @@ fn android() {
let lib_path = sysroot_libs_path.join("libc++_shared.so");
assert!(
lib_path.exists(),
"Error: Source file {:?} does not exist",
lib_path
"Error: Source file {lib_path:?} does not exist"
);
let dest_dir = Path::new(&output_path).join(env::var("CARGO_NDK_ANDROID_TARGET").unwrap());
println!("cargo:rerun-if-changed={}", dest_dir.display());
println!("cargo:rerun-if-changed={dest_dir:?}");
if !dest_dir.exists() {
fs::create_dir_all(&dest_dir).unwrap();
}
Expand Down
2 changes: 0 additions & 2 deletions rust-toolchain.toml

This file was deleted.

Loading