Skip to content
Open
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
140 changes: 122 additions & 18 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,143 @@
name: Build And Test
name: CI

on: [push]
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read
actions: read

env:
CARGO_TERM_COLOR: always
CARGOFLAGS: --workspace --all-targets --all-features --release
CARGO_INCREMENTAL: 0

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

jobs:
build:
name: Compile code
fmt:
name: rustfmt
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Save build artifacts
uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt

- name: Run fmt
run: cargo +nightly fmt --all -- --check

clippy:
name: clippy
runs-on: ubuntu-latest
needs: fmt

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.90.0"
components: clippy

- name: Install SP1 system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev curl ca-certificates

- name: Install Go (for SP1 native gnark)
uses: actions/setup-go@v5
with:
shared-key: "build"
go-version: "1.22"
cache-dependency-path: "**/go.sum"

- name: Compile
run: cargo build $CARGOFLAGS --verbose
- name: Restore caches
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.sp1
target
key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-clippy-

- name: Install SP1up CLI
run: |
curl -L https://sp1up.succinct.xyz | bash -s -- -y
echo "$HOME/.sp1/bin" >> "$GITHUB_PATH"

- name: Setup SP1 toolchain
run: |
sp1up
rustc +succinct --version

- name: Build (prime SP1 assets, release)
run: cargo build --locked --release --workspace --all-targets --all-features

test:
name: Test code
- name: Run clippy
run: cargo clippy --locked --workspace --all-targets --all-features -- -D warnings

build-and-test:
name: build-and-test
runs-on: ubuntu-latest
needs: build
needs:
- fmt
- clippy

steps:
- uses: actions/checkout@v4

- name: Restore cached build artifacts
uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
with:
shared-key: "build"
toolchain: "1.90.0"

- name: Install SP1 system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev curl ca-certificates

- name: Install Go (for SP1 native gnark)
uses: actions/setup-go@v5
with:
go-version: "1.22"
cache-dependency-path: "**/go.sum"

- name: Restore caches
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.sp1
target
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-

- name: Install SP1up CLI
run: |
curl -L https://sp1up.succinct.xyz | bash -s -- -y
echo "$HOME/.sp1/bin" >> "$GITHUB_PATH"

- name: Setup SP1 toolchain
run: |
sp1up
rustc +succinct --version

- name: Build
run: cargo build --locked --workspace --all-targets

- name: Run tests
run: cargo test $CARGOFLAGS
- name: Test
run: cargo test --locked --workspace --all-targets -- --nocapture
10 changes: 8 additions & 2 deletions .github/workflows/gate-count-badges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ jobs:
echo "Running gate count..."
set -e # Exit on any error
# Run the example and capture output
cargo run --example groth16_gc_gate_count --release -- --json > raw_output.txt 2>&1
# Run the example without SP1 soldering to avoid installing SP1 toolchain
cargo run \
--release \
--no-default-features \
--features "tracing_max_level tracing_scopes" \
--example groth16_gc_gate_count \
-- \
--json > raw_output.txt 2>&1
echo "Raw output from cargo run:"
cat raw_output.txt
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
.DS_Store
/circuit_component_macro/target
/sp1-soldering-program/target
Loading
Loading