Skip to content

Merge pull request #1506 from privacy-scaling-explorations/test/circu… #1

Merge pull request #1506 from privacy-scaling-explorations/test/circu…

Merge pull request #1506 from privacy-scaling-explorations/test/circu… #1

name: Coordinator
on:
push:
branches: [dev]
pull_request:
env:
COORDINATOR_RPC_URL: "http://localhost:8545"
COORDINATOR_PUBLIC_KEY_PATH: "./pub.key"
COORDINATOR_PRIVATE_KEY_PATH: "./priv.key"
COORDINATOR_TALLY_ZKEY_NAME: "TallyVotes_10-1-2_test"
COORDINATOR_MESSAGE_PROCESS_ZKEY_NAME: "ProcessMessages_10-2-1-2_test"
COORDINATOR_ZKEY_PATH: "./zkeys"
COORDINATOR_RAPIDSNARK_EXE: "~/rapidsnark/build/prover"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 8
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
# Check for changes in the 'circuit' folder
- name: Get changed files
id: get-changed-files
uses: jitterbit/get-changed-files@v1
with:
format: "csv"
- name: Check for changes in 'circuit' folder
id: check_changes
run: |
CHANGED_FILES=${{ steps.get-changed-files.outputs.all }}
if echo "$CHANGED_FILES" | grep -q "\.circom"; then
echo "CHANGED=true" >> $GITHUB_ENV
echo "Circuits have changes."
else
echo "CHANGED=false" >> $GITHUB_ENV
echo "No changes on circuits."
fi
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --yes \
build-essential \
libgmp-dev \
libsodium-dev \
nasm \
nlohmann-json3-dev
- name: Install
run: |
pnpm install --frozen-lockfile --prefer-offline
- name: Build
run: |
pnpm run build
- name: Run hardhat
run: |
pnpm run hardhat &
sleep 5
working-directory: coordinator
- name: Download rapidsnark (1c137)
run: |
mkdir -p ~/rapidsnark/build
wget -qO ~/rapidsnark/build/prover https://maci-devops-zkeys.s3.ap-northeast-2.amazonaws.com/rapidsnark-linux-amd64-1c137
chmod +x ~/rapidsnark/build/prover
- name: Download circom Binary v2.1.6
run: |
wget -qO ${{ github.workspace }}/circom https://github.com/iden3/circom/releases/download/v2.1.6/circom-linux-amd64
chmod +x ${{ github.workspace }}/circom
sudo mv ${{ github.workspace }}/circom /bin/circom
- name: Compile Circuits And Generate zkeys
if: ${{ env.CHANGED == 'true' }}
run: |
pnpm build:circuits-c -- --outPath ../coordinator/zkeys
pnpm setup:zkeys -- --outPath ../coordinator/zkeys
- name: Download zkeys
if: ${{ env.CHANGED == 'false' }}
run: |
pnpm download-zkeys:test
working-directory: coordinator
- name: Generate keypair
run: |
pnpm generate-keypair
working-directory: coordinator
- name: Test
run: pnpm run test
working-directory: coordinator