Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Automatic Nova parameter generation & testing #55

Merged
merged 4 commits into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/end2end.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Run integration tests when a maintainer comments `!test` on a PR to feature branch
#
# Default env vars specified in `rust-reference-info.env`
# Overrides default env vars when input to `!test` comment, e.g.
# `!test NOVA_URL=https://github.com/lurk-lab/Nova NOVA_COMMIT=ea4f75c225cb29f523780858ec84f1ff51c229bc NOVA_TEST_NAME=solidity_compatibility_e2e_pasta`
#
# Fails when base branch is `main`, as it doesn't support e2e tests
name: End to end integration tests

Expand Down Expand Up @@ -50,6 +55,31 @@ jobs:
with:
python-version: 3.8

- name: Load env defaults
uses: cardinalby/export-env-action@v2
with:
envFile: 'rust-reference-info.env'

- name: Set env from comment body
run: |
printf '${{ github.event.comment.body }}' > comment.txt
NOVA_URL=$(echo $BODY | awk -F'[ =]' '{for (i=1; i<=NF; i++) {if ($i ~ /^NOVA_URL/) {print $(i+1) }}}')
if [[ ! -z $NOVA_URL ]]; then
echo "NOVA_URL=$NOVA_URL" | tee -a $GITHUB_ENV
fi
NOVA_COMMIT=$(echo $BODY | awk -F'[ =]' '{for (i=1; i<=NF; i++) {if ($i ~ /^NOVA_COMMIT/) {print $(i+1) }}}')
if [[ ! -z $NOVA_COMMIT ]]; then
echo "NOVA_COMMIT=$NOVA_COMMIT" | tee -a $GITHUB_ENV
fi
NOVA_TEST_NAME=$(echo $BODY | awk -F'[ =]' '{for (i=1; i<=NF; i++) {if ($i ~ /^NOVA_TEST_NAME/) {print $(i+1) }}}')
if [[ ! -z $NOVA_TEST_NAME ]]; then
echo "NOVA_TEST_NAME=$NOVA_TEST_NAME" | tee -a $GITHUB_ENV
fi

- name: Generate proof and public parameters from commit hash
run: |
python generate_contract_input.py ${{ env.NOVA_URL }} ${{ env.$NOVA_COMMIT }} ${{ env.NOVA_TEST_NAME }}

- name: Deploy main contract
run: |
echo "CONTRACT_ADDRESS=$(forge script script/Deployment.s.sol:NovaVerifierDeployer --fork-url $ANVIL_URL --private-key $ANVIL_PRIVATE_KEY --broadcast --non-interactive | sed -n 's/.*Contract Address: //p' | tail -1)" >> $GITHUB_OUTPUT
Expand All @@ -63,11 +93,26 @@ jobs:
run: |
[[ $(cast call ${{steps.deployment.outputs.CONTRACT_ADDRESS}} "verify(uint32,uint256[],uint256[],bool)(bool)" "3" "[1]" "[0]" "true" --private-key $ANVIL_PRIVATE_KEY --rpc-url $ANVIL_URL) == true ]] && exit 0 || exit 1

- name: Gather status in a single variable
if: steps.tests.outcome == 'success' && steps.gadget-tests.outcome == 'success'
run: echo "status=true" | tee -a $GITHUB_ENV

- name: Comment on successful run
if: success()
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
End-to-end `!test` action succeeded! :rocket:

https://github.com/lurk-lab/solidity-verifier/actions/runs/${{ github.run_id }}

- name: Comment on failing run
if: failure()
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
End-to-end `!test` action failed :x:

https://github.com/lurk-lab/solidity-verifier/actions/runs/${{ github.run_id }}
Loading