Skip to content

Commit

Permalink
Adding some drift testing
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Dec 19, 2023
1 parent 65de5d7 commit b018ca7
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 15 deletions.
34 changes: 34 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Install Yarn dependencies
description: Installs the workspace's yarn dependencies and caches them
inputs:
project:
description: The project to install dependencies for
required: true
version:
description: The version of the project to install dependencies for
required: true

runs:
using: composite
steps:
- name: Enable Corepack before setting up Node
run: corepack enable
shell: bash

- uses: actions/setup-node@v4
with:
node-version-file: '${{ inputs.project }}/package.json'
cache: 'yarn'

- name: Install
run: yarn --immutable
shell: bash

- name: Install Nargo
uses: noir-lang/[email protected]
with:
toolchain: ${{ inputs.version }}

- name: Use Nargo
run: nargo --version
shell: bash
26 changes: 26 additions & 0 deletions .github/scripts/latest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const { writeFileSync } = require('fs');

async function main() {
const fetchOpts = {
headers: {},
};

if (process.env.GITHUB_TOKEN)
fetchOpts.headers = { Authorization: `token ${process.env.GITHUB_TOKEN}` };

const res = await fetch('https://api.github.com/repos/noir-lang/noir/releases', fetchOpts);

const data = await res.json();

const filtered = data.filter(
release => !release.tag_name.includes('aztec') && !release.tag_name.includes('nightly'),
);

const latestStable = filtered.find(release => !release.prerelease).tag_name;
const latestPreRelease = filtered.find(release => release.prerelease).tag_name;

const workflowOutput = JSON.stringify({ stable: latestStable, prerelease: latestPreRelease });
console.log(workflowOutput); // DON'T REMOVE, GITHUB WILL CAPTURE THIS OUTPUT
}

main();
71 changes: 71 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Nightly drift test

on:
pull_request:
paths:
- 'vite-hardhat/**'

jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4

- name: Get versions to test for drift
id: versions_step
run: |
output=$(node ./.github/scripts/latestStable.js)
echo "Output from Node.js script: $output"
echo "::set-output name=versionArray::$output"
- name: Set Up Matrix
id: set-matrix
run: |
VERSIONS='${{ steps.versions_step.outputs.versionArray }}'
echo "Versions for Matrix: $VERSIONS"
MATRIX=$(echo "$VERSIONS" | jq -c '{versions: .} | .versions | to_entries | map({key: .key, value: (.value | sub("^v"; ""))})')
echo "::set-output name=matrix::{\"include\":$MATRIX}"
test-drift-vite-hardhat:
needs: setup
runs-on: ubuntu-latest
defaults:
run:
working-directory: vite-hardhat
strategy:
matrix: ${{fromJson(needs.setup.outputs.matrix)}}
steps:
- uses: actions/checkout@v4

- name: Set up test environment
uses: ./.github/actions/setup
with:
project: vite-hardhat
version: ${{ matrix.value }}

- name: Install test version
run: |
yarn add \
@noir-lang/noir_js@${{ matrix.value }} \
@noir-lang/backend_barretenberg@${{ matrix.value }} \
@noir-lang/noir_wasm@${{ matrix.value }} \
@noir-lang/types@${{ matrix.value }}
- name: 'Create env file'
run: |
touch .env
echo SEPOLIA_ALCHEMY_KEY="${{ secrets.SEPOLIA_ALCHEMY_KEY }}" >> .env
echo SEPOLIA_DEPLOYER_PRIVATE_KEY="${{ secrets.SEPOLIA_DEPLOYER_PRIVATE_KEY }}" >> .env
echo MUMBAI_ALCHEMY_KEY"=${{ secrets.MUMBAI_ALCHEMY_KEY }}" >> .env
echo MUMBAI_DEPLOYER_PRIVATE_KEY="${{ secrets.MUMBAI_DEPLOYER_PRIVATE_KEY }}" >> .env
- name: Generate verifier contract
run: |
nargo codegen-verifier
working-directory: vite-hardhat/circuits

- name: Run test
run: yarn test
continue-on-error: ${{ matrix.key == 'prerelease' }}
7 changes: 3 additions & 4 deletions .github/workflows/vite_hardhat.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: PR - vite-hardhat
on:
push:
# pull_request:
# paths:
# - 'vite-hardhat/**'
pull_request:
paths:
- 'vite-hardhat/**'

jobs:
test-vite-hardhat:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

node_modules
package-lock.json

# To use with nektos/act
.github/event.json
34 changes: 23 additions & 11 deletions vite-hardhat/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -756,10 +756,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@noir-lang/acvm_js@0.35.0":
version "0.35.0"
resolved "https://registry.yarnpkg.com/@noir-lang/acvm_js/-/acvm_js-0.35.0.tgz#81130d0236c259b2fb47b0d8efc577bbb5ee18f9"
integrity sha512-LiQUSF3P4/1VGfMZc0hSivLs4oiPsRt+ADFBMF7sOg4oaImeQ4L6tu0Og2Wh1Pc0k2y1EXdv1EKxN2N1WRDdKg==
"@noir-lang/acvm_js@0.37.1":
version "0.37.1"
resolved "https://registry.yarnpkg.com/@noir-lang/acvm_js/-/acvm_js-0.37.1.tgz#5cf3523a4a07e6c0cad95084afa633ce2e9d5600"
integrity sha512-VBAq2XoyTnxQyjJ6YNwnWMFZRZfPedJRm+tazDhzcilk85gzjet+yvDWB7VekjG3VY3q+WFo8zI9xbltoTTmPg==

"@noir-lang/backend_barretenberg@^0.19.4":
version "0.19.4"
Expand All @@ -770,14 +770,14 @@
"@noir-lang/types" "0.19.4"
fflate "^0.8.0"

"@noir-lang/noir_js@^0.19.4":
version "0.19.4"
resolved "https://registry.yarnpkg.com/@noir-lang/noir_js/-/noir_js-0.19.4.tgz#e71fc27e28a17cd03b21e498aaaf0f901b2bb75e"
integrity sha512-V/3jLoor3dMuYuv0ad154M0Ko1xZWxx0qoRDLC/Y/xMH5Wbe5yH4yOvBjCXzQ0dLG5JX1IWGOCC7xxzpStk+hA==
"@noir-lang/noir_js@^0.21.0":
version "0.21.0"
resolved "https://registry.yarnpkg.com/@noir-lang/noir_js/-/noir_js-0.21.0.tgz#df9ceaee68cb186c5cd816dc6176f6eb6ccf7db3"
integrity sha512-KqB5HAC64WGc1yddxAycbDUaUICp5F0foTLgtjQzJLLxRSxlQEa3uomtoLV0ocCFdF4MQd9S6tywgehHVTwvoQ==
dependencies:
"@noir-lang/acvm_js" "0.35.0"
"@noir-lang/noirc_abi" "0.19.4"
"@noir-lang/types" "0.19.4"
"@noir-lang/acvm_js" "0.37.1"
"@noir-lang/noirc_abi" "0.21.0"
"@noir-lang/types" "0.21.0"

"@noir-lang/noir_wasm@^0.19.4":
version "0.19.4"
Expand All @@ -789,6 +789,11 @@
resolved "https://registry.yarnpkg.com/@noir-lang/noirc_abi/-/noirc_abi-0.19.4.tgz#a51e76efabf70d49de92ca0a114ef5721ab857a4"
integrity sha512-g3fa3rVGyvnqu1BQdXytCPzIFQDvK1kH9uMjNrEz5UG/LKl+EPvIl1Te8FcOsSi5/eVSbMWveyz3HJu+SwMjDQ==

"@noir-lang/[email protected]":
version "0.21.0"
resolved "https://registry.yarnpkg.com/@noir-lang/noirc_abi/-/noirc_abi-0.21.0.tgz#00d9771e79855375dd00d0f978dc823fa3b9f35e"
integrity sha512-vVM1QRTFecZdCXminhgoW3sBsZJMsHOO+Sh8rG353r+n4GSgNR/oP3OQEOHlaJgq2wT9hCqcFU4gT954DfzawA==

"@noir-lang/source-resolver@^0.19.4":
version "0.19.4"
resolved "https://registry.yarnpkg.com/@noir-lang/source-resolver/-/source-resolver-0.19.4.tgz#cd1fb5909e783f45ccd8ee90fbd9bba406da0634"
Expand All @@ -801,6 +806,13 @@
dependencies:
"@noir-lang/noirc_abi" "0.19.4"

"@noir-lang/[email protected]":
version "0.21.0"
resolved "https://registry.yarnpkg.com/@noir-lang/types/-/types-0.21.0.tgz#c64d9b25c48522c4b5edadd657bcaddf6c872b21"
integrity sha512-v6CC04mvydBOGMVRCQd9Ytvz5Bjn0pGCE5ENDD+ROjs6+U5wShW5InFBQu5j9UixKybYUtuXk+5TMpuJ/yagog==
dependencies:
"@noir-lang/noirc_abi" "0.21.0"

"@nomicfoundation/[email protected]":
version "5.0.2"
resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.2.tgz#13a7968f5964f1697da941281b7f7943b0465d04"
Expand Down

0 comments on commit b018ca7

Please sign in to comment.