From 875afb5383769d44868c85f6c44c34bedb6f8b2e Mon Sep 17 00:00:00 2001 From: cedoor Date: Wed, 6 Dec 2023 10:36:40 +0000 Subject: [PATCH] ci: add circuit tests to workflows re #357 --- .github/workflows/production.yml | 15 ++++++++++++--- .github/workflows/pull-requests.yml | 13 ++++++++++--- package.json | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index f1d3a513..e990662d 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -19,7 +19,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v1 with: - node-version: 16.x + node-version: "18" - name: Get yarn cache directory path id: yarn-cache-dir-path @@ -90,6 +90,7 @@ jobs: strategy: matrix: type: + - circuits - libraries - contracts @@ -99,7 +100,14 @@ jobs: - name: Install Node.js uses: actions/setup-node@v1 with: - node-version: 16.x + node-version: "18" + + # https://github.com/iden3/circuits/blob/8fffb6609ecad0b7bcda19bb908bdb544bdb3cf7/.github/workflows/main.yml#L18-L22 + - name: Setup Circom deps + run: sudo apt-get update && sudo apt-get install -y wget nlohmann-json3-dev libgmp-dev nasm g++ build-essential + + - name: Setup Circom + run: wget https://github.com/iden3/circom/releases/latest/download/circom-linux-amd64 && sudo mv ./circom-linux-amd64 /usr/bin/circom && sudo chmod +x /usr/bin/circom - name: Get yarn cache directory path id: yarn-cache-dir-path @@ -120,10 +128,11 @@ jobs: - name: Build libraries run: yarn build:libraries - - name: Test contracts and libraries + - name: Test libraries, contracts and circuits run: yarn test:${{ matrix.type }} - name: Coveralls + if: matrix.type != 'circuits' uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index 9339ef1f..97c7ac11 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -17,7 +17,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v1 with: - node-version: 16.x + node-version: "18" - name: Get yarn cache directory path id: yarn-cache-dir-path @@ -59,7 +59,14 @@ jobs: - name: Install Node.js uses: actions/setup-node@v1 with: - node-version: 16.x + node-version: "18" + + # https://github.com/iden3/circuits/blob/8fffb6609ecad0b7bcda19bb908bdb544bdb3cf7/.github/workflows/main.yml#L18-L22 + - name: Setup Circom deps + run: sudo apt-get update && sudo apt-get install -y wget nlohmann-json3-dev libgmp-dev nasm g++ build-essential + + - name: Setup Circom + run: wget https://github.com/iden3/circom/releases/latest/download/circom-linux-amd64 && sudo mv ./circom-linux-amd64 /usr/bin/circom && sudo chmod +x /usr/bin/circom - name: Get yarn cache directory path id: yarn-cache-dir-path @@ -83,5 +90,5 @@ jobs: - name: Build subgraph run: yarn build:subgraph - - name: Test contracts, libraries and subgraph + - name: Test contracts, libraries, circuits and subgraph run: yarn test diff --git a/package.json b/package.json index adbf9e6f..cd734343 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "compile:contracts": "yarn workspace semaphore-contracts compile", "download:snark-artifacts": "rimraf snark-artifacts && ts-node scripts/download-snark-artifacts.ts", "remove:template-files": "ts-node scripts/remove-template-files.ts", - "test": "yarn test:libraries && yarn test:contracts && yarn test:subgraph", + "test": "yarn test:libraries && yarn test:contracts && yarn test:circuits && yarn test:subgraph", "test:libraries": "jest --coverage", "test:subgraph": "yarn workspace semaphore-subgraph test", "test:contracts": "yarn workspace semaphore-contracts test:coverage",