-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from privacy-scaling-explorations:ci/e2e
Add nightly run
- Loading branch information
Showing
5 changed files
with
1,297 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
name: Nightly | ||
|
||
on: | ||
schedule: | ||
- cron: 0 0 * * * | ||
|
||
jobs: | ||
start-runner: | ||
name: Start self-hosted EC2 runner | ||
runs-on: ubuntu-latest | ||
outputs: | ||
label: ${{ steps.start-ec2-runner.outputs.label }} | ||
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | ||
steps: | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Start EC2 runner | ||
id: start-ec2-runner | ||
uses: machulav/ec2-github-runner@v2 | ||
with: | ||
mode: start | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
ec2-image-id: ami-0d65ed0872506990c | ||
ec2-instance-type: t3.2xlarge | ||
subnet-id: subnet-0817be1b2160793b5 | ||
security-group-id: sg-0aea3cbb15e30a921 | ||
aws-resource-tags: > | ||
[ | ||
{ "Key": "Name", "Value": "maci-coordinator-github-runner" }, | ||
{ "Key": "GitHubRepository", "Value": "${{ github.repository }}" } | ||
] | ||
do-the-job: | ||
name: Do the job on the runner | ||
needs: start-runner | ||
runs-on: ${{ needs.start-runner.outputs.label }} | ||
|
||
steps: | ||
|
||
- name: Install Docker | ||
run: | | ||
curl -fsSL https://get.docker.com -o get-docker.sh | ||
sudo sh get-docker.sh | ||
# maci-coordinator will listen on port 8080 locally | ||
- name: Run maci-coordinator | ||
run: | | ||
sudo docker run --detach --platform linux/amd64 -p 8080:8080 ghcr.io/privacy-scaling-explorations/maci-coordinator:main | ||
# Run `maci-coordinator` flavored e2e test suite of MACI | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'gurrpi/maci' | ||
ref: 'maci-coordinator' | ||
path: 'maci' | ||
|
||
- name: Use Node.js 16 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Build MACI | ||
run: | | ||
cd maci | ||
npm install | ||
npm run bootstrap | ||
npm run build | ||
cd contracts | ||
npm run compileSol | ||
- name: Run local hardhat node | ||
run: | | ||
cd maci | ||
bash ./.github/scripts/hnctl.sh start_hardhat_network | ||
- name: Run E2E Test Suite | ||
run: | | ||
cd maci/cli | ||
bash test_coordinator-service.sh | ||
stop-runner: | ||
name: Stop self-hosted EC2 runner | ||
needs: | ||
- start-runner | ||
- do-the-job | ||
runs-on: ubuntu-latest | ||
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs | ||
steps: | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Stop EC2 runner | ||
uses: machulav/ec2-github-runner@v2 | ||
with: | ||
mode: stop | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
label: ${{ needs.start-runner.outputs.label }} | ||
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,6 @@ coverage/** | |
instruments | ||
data/zkeys/** | ||
*.wtns | ||
outputs/** | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
### api/genproof | ||
### /api/generateProof | ||
|
||
Send a POST request to the `/api/generateProof` endpoint with a JSON body containing the cicuit input of the desired circuit: | ||
|
||
ProcessMessages: | ||
``` | ||
curl \ | ||
-X POST \ | ||
-H "Content-Type: application/json" \ | ||
-d @demo/request_generateProof_ProcessMessages.json \ | ||
http://localhost:8080/api/generateProof | ||
``` | ||
|
||
TallyVotes: | ||
``` | ||
curl \ | ||
-X POST \ | ||
-H "Content-Type: application/json" \ | ||
-d '{"maciPollId":"12345","name":"Ethcon Korea 2023","authToken":"PVT_kwDOBheqls4AMmQM"}' \ | ||
http://localhost:8080/api/genproof | ||
-d @demo/request_generateProof_TallyVotes.json \ | ||
http://localhost:8080/api/generateProof | ||
``` | ||
|
||
### /api/checkStatus/{maciPollId} | ||
### /api/getResult | ||
|
||
``` | ||
curl http://localhost:8080/api/checkStatus/12345 | ||
curl http://localhost:8080/api/getResult | ||
``` | ||
|
||
### /api/getResult/{maciPollId} | ||
## Generate Proof using snarkjs | ||
|
||
``` | ||
curl http://localhost:8080/api/getResult/12345 | ||
snarkjs groth16 prove instruments/TallyVotes_10-1-2_test.0.zkey data/TallyVotes/10-1-2/witness_wasm.wtns outputs/proof_TallyVotes_10-1-2.json outputs/public_TallyVotes_10-1-2.json | ||
``` |
Oops, something went wrong.