|
| 1 | +name: zk Spartan2 JWT and ECDSA Circuits |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout Repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + submodules: recursive |
| 20 | + |
| 21 | + - name: Set up Rust |
| 22 | + uses: actions-rs/toolchain@v1 |
| 23 | + with: |
| 24 | + toolchain: stable |
| 25 | + profile: minimal |
| 26 | + override: true |
| 27 | + |
| 28 | + - name: Cache Rust Dependencies |
| 29 | + uses: actions/cache@v4 |
| 30 | + with: |
| 31 | + path: | |
| 32 | + ~/.cargo/bin/ |
| 33 | + ~/.cargo/registry/index/ |
| 34 | + ~/.cargo/registry/cache/ |
| 35 | + ~/.cargo/git/db/ |
| 36 | + wallet-unit-poc/ecdsa-spartan2/target/ |
| 37 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 38 | + restore-keys: | |
| 39 | + ${{ runner.os }}-cargo- |
| 40 | +
|
| 41 | + - name: Install Circom Dependencies |
| 42 | + run: | |
| 43 | + sudo apt-get update |
| 44 | + sudo apt-get install -y build-essential libgmp-dev libsodium-dev nasm nlohmann-json3-dev |
| 45 | +
|
| 46 | + - name: Cache Circom |
| 47 | + id: cache-circom |
| 48 | + uses: actions/cache@v4 |
| 49 | + with: |
| 50 | + path: ~/.cargo/bin/circom |
| 51 | + key: ${{ runner.os }}-circom-2.2.0 |
| 52 | + |
| 53 | + - name: Install Circom |
| 54 | + if: steps.cache-circom.outputs.cache-hit != 'true' |
| 55 | + run: | |
| 56 | + git clone https://github.com/iden3/circom.git /tmp/circom |
| 57 | + cd /tmp/circom |
| 58 | + git checkout v2.2.0 |
| 59 | + cargo build --release |
| 60 | + cargo install --path circom |
| 61 | + circom --version |
| 62 | +
|
| 63 | + - name: Verify Circom Installation |
| 64 | + run: circom --version |
| 65 | + |
| 66 | + - name: Set up Node.js |
| 67 | + uses: actions/setup-node@v4 |
| 68 | + with: |
| 69 | + node-version: "20" |
| 70 | + |
| 71 | + - name: Enable Corepack |
| 72 | + run: corepack enable |
| 73 | + |
| 74 | + - name: Cache Yarn Dependencies |
| 75 | + uses: actions/cache@v4 |
| 76 | + with: |
| 77 | + path: | |
| 78 | + wallet-unit-poc/circom/node_modules |
| 79 | + ~/.yarn/berry/cache |
| 80 | + key: ${{ runner.os }}-yarn-${{ hashFiles('wallet-unit-poc/circom/yarn.lock') }} |
| 81 | + restore-keys: | |
| 82 | + ${{ runner.os }}-yarn- |
| 83 | +
|
| 84 | + - name: Install Yarn Dependencies |
| 85 | + working-directory: wallet-unit-poc/circom |
| 86 | + run: yarn install --immutable |
| 87 | + |
| 88 | + - name: Compile JWT Circuit |
| 89 | + working-directory: wallet-unit-poc/circom |
| 90 | + run: yarn compile:jwt |
| 91 | + |
| 92 | + - name: Compile ECDSA Circuit |
| 93 | + working-directory: wallet-unit-poc/circom |
| 94 | + run: yarn compile:ecdsa |
| 95 | + |
| 96 | + - name: Build Rust Project |
| 97 | + working-directory: wallet-unit-poc/ecdsa-spartan2 |
| 98 | + run: cargo build --release |
| 99 | + |
| 100 | + - name: Run ECDSA Circuit Test |
| 101 | + working-directory: wallet-unit-poc/ecdsa-spartan2 |
| 102 | + env: |
| 103 | + RUST_LOG: info |
| 104 | + run: cargo run --release -- ecdsa |
| 105 | + |
| 106 | + - name: Run JWT Circuit Test |
| 107 | + working-directory: wallet-unit-poc/ecdsa-spartan2 |
| 108 | + env: |
| 109 | + RUST_LOG: info |
| 110 | + run: cargo run --release -- jwt |
0 commit comments