Skip to content

Commit 2149349

Browse files
wei3erHasexorsal
andauthored
fix: benchmark (#89)
Co-authored-by: zorzal <zorzal@wonderland.xyz>
1 parent e68c76b commit 2149349

2 files changed

Lines changed: 41 additions & 215 deletions

File tree

.github/workflows/comment-benchmark.yml

Lines changed: 0 additions & 115 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
name: Aztec Benchmark
1+
name: Aztec Benchmark Diff
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened]
65

76
concurrency:
87
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
@@ -17,73 +16,27 @@ env:
1716
BENCH_DIR: ./benchmarks
1817

1918
jobs:
20-
check-changes:
21-
if: false # Temporary disable benchmarking cross-version comparison
22-
name: Check for relevant changes
23-
runs-on: ubuntu-latest
24-
outputs:
25-
should-benchmark: ${{ steps.changes.outputs.should-benchmark }}
26-
steps:
27-
- name: Checkout repository
28-
uses: actions/checkout@v6
29-
30-
- name: Check for relevant changes
31-
id: changes
32-
uses: actions/github-script@v8
33-
with:
34-
script: |
35-
console.log('Checking for changes that would affect benchmarks...');
36-
37-
const { data: files } = await github.rest.pulls.listFiles({
38-
owner: context.repo.owner,
39-
repo: context.repo.repo,
40-
pull_number: context.issue.number,
41-
});
42-
43-
console.log('Changed files:');
44-
files.forEach(file => console.log(`- ${file.filename}`));
45-
46-
// Check for Noir contracts, config, or benchmark changes
47-
const relevantPatterns = /^(src\/nr\/|Nargo\.toml|benchmarks\/)/;
48-
const hasRelevantChanges = files.some(file => relevantPatterns.test(file.filename));
49-
50-
// Check for AZTEC_VERSION change in package.json
51-
const hasAztecVersionChange = files.some(file =>
52-
file.filename === 'package.json' && file.patch?.includes('aztecVersion')
53-
);
54-
55-
const shouldBenchmark = hasRelevantChanges || hasAztecVersionChange;
56-
57-
if (hasRelevantChanges) {
58-
console.log('📝 Noir contracts, config, or benchmark files changed');
59-
} else if (hasAztecVersionChange) {
60-
console.log('🔄 AZTEC_VERSION changed in package.json');
61-
} else {
62-
console.log('⏭️ No benchmark-relevant changes detected, skipping benchmarks');
63-
}
64-
65-
core.setOutput('should-benchmark', shouldBenchmark);
66-
6719
benchmark:
68-
if: false # Temporary disable benchmarking cross-version comparison
69-
name: Run comparison
70-
needs: check-changes
71-
if: needs.check-changes.outputs.should-benchmark == 'true'
72-
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
os: [ubuntu-latest-m]
23+
threads: [12]
24+
25+
runs-on:
26+
labels: ${{ matrix.os }}
27+
timeout-minutes: 60
7328

7429
steps:
7530
# ──────────────────────────────────────────────────────────────
7631
# 0️⃣ SHARED TOOLING – Buildx + Aztec CLI skeleton
7732
# ──────────────────────────────────────────────────────────────
78-
- name: Checkout repository
33+
- name: Checkout repo (full history)
7934
uses: actions/checkout@v6
8035
with:
8136
fetch-depth: 0
8237

83-
- name: Setup Node.js
84-
uses: actions/setup-node@v6
85-
with:
86-
node-version: '22.17.0'
38+
- name: Set up Docker Buildx (Aztec local network needs BuildKit)
39+
uses: docker/setup-buildx-action@v2
8740

8841
- name: Install Aztec CLI
8942
run: |
@@ -101,6 +54,10 @@ jobs:
10154
with:
10255
ref: ${{ github.event.pull_request.base.sha }}
10356

57+
- uses: actions/setup-node@v6
58+
with:
59+
node-version: "22.17.0"
60+
10461
- name: Detect Aztec version (BASE)
10562
id: basever
10663
run: |
@@ -110,21 +67,22 @@ jobs:
11067
11168
- name: Switch CLI to BASE version
11269
run: |
113-
aztec-up ${{ steps.basever.outputs.ver }}
70+
VERSION=${{ steps.basever.outputs.ver }} aztec-up
11471
115-
- name: Manually tag the aztec version as `latest`
116-
run: |
117-
docker tag aztecprotocol/aztec:${{ steps.basever.outputs.ver }} aztecprotocol/aztec:latest
118-
119-
- name: Start sandbox (BASE, background)
120-
run: aztec start --sandbox &
72+
- name: Start local network (BASE, background)
73+
run: aztec start --local-network &
12174

12275
- name: Start PXE node (BASE, background)
12376
run: |
124-
VERSION=${{ steps.basever.outputs.ver }} aztec start \
125-
--port 8081 --pxe --pxe.nodeUrl=http://localhost:8080/ \
77+
VERSION=${{ steps.basever.outputs.ver }} aztec \
78+
start --port 8081 --pxe --pxe.nodeUrl=http://localhost:8080/ \
12679
--pxe.proverEnabled false &
12780
81+
# This is a temporary hack to fix a problem with v3 releases.
82+
- name: Manually tag the aztec version as `latest`
83+
run: |
84+
docker tag aztecprotocol/aztec:${{ steps.basever.outputs.ver }} aztecprotocol/aztec:latest
85+
12886
- name: Install deps (BASE)
12987
run: yarn --frozen-lockfile
13088

@@ -174,7 +132,7 @@ jobs:
174132
- name: Kill BASE services
175133
if: steps.prver.outputs.ver_diff == 'true'
176134
run: |
177-
pkill -f "aztec.*--sandbox" || true
135+
pkill -f "aztec.*--local-network" || true
178136
pkill -f "aztec.*--pxe.*8081" || true
179137
sleep 5
180138
@@ -183,23 +141,21 @@ jobs:
183141
run: |
184142
VERSION=${{ steps.prver.outputs.ver }} aztec-up
185143
186-
- name: Manually tag the aztec version as `latest`
187-
run: |
188-
docker tag aztecprotocol/aztec:${{ steps.prver.outputs.ver }} aztecprotocol/aztec:latest
189-
190-
- name: Start sandbox (PR, background)
144+
- name: Start local network (PR, background)
191145
if: steps.prver.outputs.ver_diff == 'true'
192-
run: aztec start --sandbox &
146+
run: aztec start --local-network &
193147

194148
- name: Start PXE node (PR, background)
195149
if: steps.prver.outputs.ver_diff == 'true'
196150
run: |
197-
VERSION=${{ steps.prver.outputs.ver }} aztec start \
198-
--port 8081 --pxe --pxe.nodeUrl=http://localhost:8080/ \
151+
VERSION=${{ steps.prver.outputs.ver }} aztec \
152+
start --port 8081 --pxe --pxe.nodeUrl=http://localhost:8080/ \
199153
--pxe.proverEnabled false &
200154
201-
# - name: Clean project from BASE stage
202-
# run: rm -rf node_modules yarn.lock
155+
# This is a temporary hack to fix a problem with v3 releases.
156+
- name: Manually tag the aztec version as `latest`
157+
run: |
158+
docker tag aztecprotocol/aztec:${{ steps.prver.outputs.ver }} aztecprotocol/aztec:latest
203159
204160
- name: Install deps (PR)
205161
run: yarn --frozen-lockfile
@@ -211,31 +167,16 @@ jobs:
211167
run: yarn codegen
212168

213169
# ──────────────────────────────────────────────────────────────
214-
# 3️⃣ DIFF & UPLOAD ARTIFACTS
170+
# 3️⃣ DIFF & COMMENT
215171
# ──────────────────────────────────────────────────────────────
216-
217-
- name: Generate benchmark comparison
172+
- name: Generate Markdown diff
218173
uses: defi-wonderland/aztec-benchmark/action@main
219174
with:
220175
base_suffix: '_base'
221176
current_suffix: '_pr'
222177

223-
# SECURITY: Upload results for secure comment workflow
224-
- name: Upload benchmark results and metadata
225-
uses: actions/upload-artifact@v6
226-
with:
227-
name: benchmark-results
228-
path: |
229-
benchmark-comparison.md
230-
retention-days: 1
231-
232-
- name: Save PR number for comment workflow
233-
run: |
234-
echo "${{ github.event.number }}" > pr-number.txt
235-
236-
- name: Upload PR metadata
237-
uses: actions/upload-artifact@v6
178+
- name: Comment diff
179+
uses: peter-evans/create-or-update-comment@v5
238180
with:
239-
name: pr-metadata
240-
path: pr-number.txt
241-
retention-days: 1
181+
issue-number: ${{ github.event.pull_request.number }}
182+
body-file: benchmark-comparison.md

0 commit comments

Comments
 (0)