Skip to content

feat(sdk): support signup/addnewkey/preaddnewkey via saas #131

feat(sdk): support signup/addnewkey/preaddnewkey via saas

feat(sdk): support signup/addnewkey/preaddnewkey via saas #131

Workflow file for this run

name: Tests
on:
push:
branches:
- '**'
paths-ignore:
- 'docs/**'
- 'artifacts/**'
- '**/*.md'
- '.changeset/**'
- '.prettierrc.json'
- '.prettierignore'
- '.gitignore'
- '.github/workflows/changeset.yml'
- '.github/workflows/publish.yml'
jobs:
contract-tests:
name: Contract Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.79.0"
components: rustfmt, clippy
target: wasm32-unknown-unknown
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-target-
- name: Run contract tests
run: RUSTFLAGS="-A dead_code -A unused_variables" cargo test --lib -- --nocapture
build-wasm:
name: Build WASM Contracts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.79.0"
components: rustfmt, clippy
target: wasm32-unknown-unknown
# Disable the default -D warnings injected by this action so that
# unused imports / variables in dependencies don't fail the build.
rustflags: ""
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Build _test.wasm contracts (release + test-vkeys)
run: bash e2e/scripts/build-wasm-local.sh
- name: Verify and list WASM artifacts
run: |
echo "=== Listing generated WASM files ==="
ls -lh e2e/artifacts/
echo ""
echo "=== WASM file details ==="
for file in e2e/artifacts/*_test.wasm; do
if [ -f "$file" ]; then
echo "Found: $(basename $file)"
fi
done
- name: Upload WASM artifacts
uses: actions/upload-artifact@v4
with:
name: wasm-contracts
path: e2e/artifacts/*_test.wasm
retention-days: 1
e2e-tests:
name: E2E Tests
runs-on: macos-14 # Apple Silicon M1/M2
needs: build-wasm
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.79.0"
components: rustfmt, clippy
- name: Download WASM artifacts
uses: actions/download-artifact@v4
with:
name: wasm-contracts
path: e2e/artifacts/
- name: Verify WASM artifacts
run: |
echo "Checking downloaded artifacts..."
ls -lh e2e/artifacts/
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.3
- name: Cache circom
id: cache-circom
uses: actions/cache@v4
with:
path: ~/.cargo/bin/circom
key: ${{ runner.os }}-circom-v2.2.2
restore-keys: |
${{ runner.os }}-circom-
- name: Install circom
if: steps.cache-circom.outputs.cache-hit != 'true'
run: |
# Clone circom repository and checkout v2.2.2 (matching local version)
git clone https://github.com/iden3/circom.git /tmp/circom
cd /tmp/circom
git checkout v2.2.2
# Install with RUSTFLAGS to suppress warnings (including mismatched-lifetime-syntaxes)
RUSTFLAGS="-A warnings" cargo install --path circom
- name: Verify circom installation
run: circom --version
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install root dependencies
run: pnpm install --frozen-lockfile
- name: Install e2e dependencies
working-directory: ./e2e
run: pnpm install --frozen-lockfile
- name: Build SDK (e2e dependency)
working-directory: ./packages/sdk
run: pnpm build
- name: Build Circuits (e2e dependency)
working-directory: ./packages/circuits
run: pnpm build
- name: Download and setup circuits
working-directory: ./e2e
run: pnpm setup-circuits
- name: Build Rust test vector generator
working-directory: ./crates/maci-utils
run: cargo build --bin generate_test_vectors --release
- name: Generate all test vectors
working-directory: ./e2e
run: pnpm run generate:all-vectors
- name: Run e2e tests
working-directory: ./e2e
run: pnpm test
circuits-tests:
name: Circuits Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.12.3
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: "1.79.0"
- name: Cache circom
id: cache-circom
uses: actions/cache@v4
with:
path: ~/.cargo/bin/circom
key: ${{ runner.os }}-circom-v2.2.2
restore-keys: |
${{ runner.os }}-circom-
- name: Install circom
if: steps.cache-circom.outputs.cache-hit != 'true'
run: |
# Clone circom repository and checkout v2.2.2 (matching local version)
git clone https://github.com/iden3/circom.git /tmp/circom
cd /tmp/circom
git checkout v2.2.2
# Install with RUSTFLAGS to suppress warnings (including mismatched-lifetime-syntaxes)
RUSTFLAGS="-A warnings" cargo install --path circom
- name: Verify circom installation
run: circom --version
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install root dependencies
run: pnpm install --frozen-lockfile
- name: Build SDK (circuits dependency)
working-directory: ./packages/sdk
run: pnpm build
- name: Run circuits tests
working-directory: ./packages/circuits
run: pnpm test