|
| 1 | +name: Report gates diff |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + compare_protocol_circuits_gates: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v3 |
| 15 | + with: |
| 16 | + fetch-depth: 0 |
| 17 | + |
| 18 | + - name: Install noirup |
| 19 | + run: | |
| 20 | + curl -L $INSTALL_URL | bash |
| 21 | + echo "${HOME}/.nargo/bin" >> $GITHUB_PATH |
| 22 | + env: |
| 23 | + INSTALL_URL: https://raw.githubusercontent.com/noir-lang/noirup/main/install |
| 24 | + NOIRUP_BIN_URL: https://raw.githubusercontent.com/noir-lang/noirup/main/noirup |
| 25 | + |
| 26 | + - uses: actions/cache@v3 |
| 27 | + with: |
| 28 | + path: | |
| 29 | + ~/.cargo/bin/ |
| 30 | + ~/.cargo/registry/index/ |
| 31 | + ~/.cargo/registry/cache/ |
| 32 | + ~/.cargo/git/db/ |
| 33 | + key: ${{ runner.os }}-cargo |
| 34 | + |
| 35 | + - name: Install Barretenberg dependencies |
| 36 | + run: sudo apt update && sudo apt install clang lld cmake libomp-dev |
| 37 | + |
| 38 | + - name: Install nargo from source with noirup |
| 39 | + run: noirup $toolchain |
| 40 | + env: |
| 41 | + toolchain: --path ./noir |
| 42 | + |
| 43 | + - name: Check nargo installation |
| 44 | + run: nargo --version |
| 45 | + |
| 46 | + - name: Generate gates report |
| 47 | + working-directory: ./yarn-project/noir-protocol-circuits/src |
| 48 | + run: | |
| 49 | + nargo info --json > protocol_circuits_report.json |
| 50 | + mv protocol_circuits_report.json ../../../protocol_circuits_report.json |
| 51 | + - name: Compare gates reports |
| 52 | + id: gates_diff |
| 53 | + uses: TomAFrench/noir-gates-diff@e7cf131b7e7f044c01615f93f0b855f65ddc02d4 |
| 54 | + with: |
| 55 | + report: protocol_circuits_report.json |
| 56 | + summaryQuantile: 1 # Display any diff in gate count |
| 57 | + |
| 58 | + - name: Add gates diff to sticky comment |
| 59 | + if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' |
| 60 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 61 | + with: |
| 62 | + # delete the comment in case changes no longer impact circuit sizes |
| 63 | + delete: ${{ !steps.gates_diff.outputs.markdown }} |
| 64 | + message: ${{ steps.gates_diff.outputs.markdown }} |
0 commit comments