Skip to content

Commit

Permalink
ci: Automatic Nova parameter generation & testing (#55)
Browse files Browse the repository at this point in the history
* Automatic generating of proof / public parameters JSONs (#53)

* added CI scrypt for generating pk and compression-snark from Nova repo commit

* Changed CI e2e configuration to work with NOVA_URL and NOVA_COMMIT params. Python script changed to work with any version of nova commit.
PS: Previous test on nova/src/lib.rs can be removed.

* Changed Script name. Return back from generating test in runtime

* Changed Script name. Return back from generating test in runtime

* Changed Script and CI config.

---------

Co-authored-by: Artem <asamblers@gmail.com>

* Remove hardcoded JSONs (#54)

* Remove hardcoded JSONs

* Update CI configuration

* Drop end2end.yml as it is not relevant for custom branches

* ci: Configure `!test` comment

* Address feedback

---------

Co-authored-by: artem-bakuta <47213324+artem-bakuta@users.noreply.github.com>
Co-authored-by: Artem <asamblers@gmail.com>
Co-authored-by: Artem Storozhuk <storojs72@gmail.com>
  • Loading branch information
4 people committed Feb 20, 2024
1 parent 34505f6 commit 5027c33
Showing 1 changed file with 45 additions and 0 deletions.
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 }}

0 comments on commit 5027c33

Please sign in to comment.