Skip to content
This repository was archived by the owner on Jul 10, 2026. It is now read-only.

ci: fixes tests and adds dependabot #12

ci: fixes tests and adds dependabot

ci: fixes tests and adds dependabot #12

Workflow file for this run

name: Aztec Benchmark
on:
pull_request:
types: [opened, synchronize, reopened]
env:
BENCH_DIR: ./benchmarks
jobs:
check-changes:
name: Check for relevant changes
runs-on: ubuntu-latest
outputs:
should-benchmark: ${{ steps.changes.outputs.should-benchmark }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check for relevant changes
id: changes
uses: actions/github-script@v7
with:
script: |
console.log('Checking for changes that would affect benchmarks...');
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
console.log('Changed files:');
files.forEach(file => console.log(`- ${file.filename}`));
// Check for Noir contracts, config, or benchmark changes
const relevantPatterns = /^(src\/nr\/|Nargo\.toml|benchmarks\/)/;
const hasRelevantChanges = files.some(file => relevantPatterns.test(file.filename));
// Check for AZTEC_VERSION change in package.json
const hasAztecVersionChange = files.some(file =>
file.filename === 'package.json' && file.patch?.includes('aztecVersion')
);
const shouldBenchmark = hasRelevantChanges || hasAztecVersionChange;
if (hasRelevantChanges) {
console.log('πŸ“ Noir contracts, config, or benchmark files changed');
} else if (hasAztecVersionChange) {
console.log('πŸ”„ AZTEC_VERSION changed in package.json');
} else {
console.log('⏭️ No benchmark-relevant changes detected, skipping benchmarks');
}
core.setOutput('should-benchmark', shouldBenchmark);
benchmark:
name: Run comparison
needs: check-changes
if: needs.check-changes.outputs.should-benchmark == 'true'
runs-on: ubuntu-latest
steps:
# ──────────────────────────────────────────────────────────────
# 0️⃣ SHARED TOOLING – Buildx + Aztec CLI skeleton
# ──────────────────────────────────────────────────────────────
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install and cache yarn
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'
- name: Install Aztec CLI
run: |
curl -s https://install.aztec.network > tmp.sh
bash tmp.sh <<< yes "yes"
- name: Update path
run: echo "/home/runner/.aztec/bin" >> $GITHUB_PATH
# ──────────────────────────────────────────────────────────────
# 1️⃣ BENCHMARK BASE COMMIT
# ──────────────────────────────────────────────────────────────
- name: Checkout BASE branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Detect Aztec version (BASE)
id: basever
run: |
VER=$(node -p "require('./package.json').config.aztecVersion")
echo "ver=$VER" >> "$GITHUB_OUTPUT"
echo "Base Aztec version is $VER"
- name: Switch CLI to BASE version
run: |
VERSION=${{ steps.basever.outputs.ver }} aztec-up
- name: Start sandbox (BASE, background)
run: aztec start --sandbox &
- name: Start PXE node (BASE, background)
run: |
VERSION=${{ steps.basever.outputs.ver }} aztec \
start --port 8081 --pxe --pxe.nodeUrl=http://localhost:8080/ \
--pxe.proverEnabled false &
- name: Cache node_modules (BASE)
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Install deps (BASE)
run: yarn install --frozen-lockfile
- name: Cache Noir compilation artifacts (BASE)
id: cache-noir-base
uses: actions/cache@v4
with:
path: |
target/
src/artifacts/
key: ${{ runner.os }}-noir-${{ env.AZTEC_VERSION }}-${{ hashFiles('src/nr/**/*', 'Nargo.toml') }}
- name: Compile contracts (BASE)
if: steps.cache-noir-base.outputs.cache-hit != 'true'
run: script -e -c "${AZTEC_NARGO:-aztec-nargo} compile"
- name: Codegen wrappers (BASE)
if: steps.cache-noir-base.outputs.cache-hit != 'true'
run: script -e -c "aztec codegen target --outdir src/artifacts --force"
- name: Benchmark (BASE)
run: |
npx aztec-benchmark --suffix _base --output-dir ${{ env.BENCH_DIR }}
# This is required to avoid the benchmark results being removed by the Checkout PR step
- name: Store base benchmark results
run: |
mkdir -p ../benchmarks_base && mv ${{ env.BENCH_DIR }}/* ../benchmarks_base/
# ──────────────────────────────────────────────────────────────
# 2️⃣ BENCHMARK PR HEAD (github.event.pull_request.head.sha)
# ──────────────────────────────────────────────────────────────
# clean does not work correctly and is removing the benchmark results anyways
# https://github.com/actions/checkout/issues/1201
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
clean: false
# Restore the base benchmark results to avoid the benchmark results being removed by the Checkout PR step
- name: Restore base benchmark results
run: mv ../benchmarks_base/* ${{ env.BENCH_DIR }}/
- name: Detect Aztec version (PR)
id: prver
run: |
VER=$(node -p "require('./package.json').config.aztecVersion")
echo "PR Aztec version is $VER"
if [ "${{ steps.basever.outputs.ver }}" != "$VER" ]; then
echo "ver_diff=true" >> "$GITHUB_OUTPUT"
else
echo "ver_diff=false" >> "$GITHUB_OUTPUT"
fi
echo "ver=$VER" >> "$GITHUB_OUTPUT"
- name: Kill BASE services
if: steps.prver.outputs.ver_diff == 'true'
run: |
pkill -f "aztec.*--sandbox" || true
pkill -f "aztec.*--pxe.*8081" || true
sleep 5
- name: Switch CLI to PR version
if: steps.prver.outputs.ver_diff == 'true'
run: |
VERSION=${{ steps.prver.outputs.ver }} aztec-up
- name: Start sandbox (PR, background)
if: steps.prver.outputs.ver_diff == 'true'
run: aztec start --sandbox &
- name: Start PXE node (PR, background)
if: steps.prver.outputs.ver_diff == 'true'
run: |
VERSION=${{ steps.prver.outputs.ver }} aztec \
start --port 8081 --pxe --pxe.nodeUrl=http://localhost:8080/ \
--pxe.proverEnabled false &
- name: Cache node_modules (PR)
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Install deps (PR)
run: yarn install --frozen-lockfile
- name: Cache Noir compilation artifacts (PR)
id: cache-noir-pr
uses: actions/cache@v4
with:
path: |
target/
src/artifacts/
key: ${{ runner.os }}-noir-${{ env.AZTEC_VERSION }}-${{ hashFiles('src/nr/**/*', 'Nargo.toml') }}
- name: Compile contracts (PR)
if: steps.cache-noir-pr.outputs.cache-hit != 'true'
run: script -e -c "${AZTEC_NARGO:-aztec-nargo} compile"
- name: Codegen wrappers (PR)
if: steps.cache-noir-pr.outputs.cache-hit != 'true'
run: script -e -c "aztec codegen target --outdir src/artifacts --force"
# ──────────────────────────────────────────────────────────────
# 3️⃣ DIFF & UPLOAD ARTIFACTS
# ──────────────────────────────────────────────────────────────
- name: Generate benchmark comparison
uses: defi-wonderland/aztec-benchmark/action@main
with:
base_suffix: '_base'
current_suffix: '_pr'
# SECURITY: Upload results for secure comment workflow
- name: Upload benchmark results and metadata
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: |
benchmark-comparison.md
retention-days: 1
- name: Save PR number for comment workflow
run: |
echo "${{ github.event.number }}" > pr-number.txt
- name: Upload PR metadata
uses: actions/upload-artifact@v4
with:
name: pr-metadata
path: pr-number.txt
retention-days: 1