Skip to content

Commit

Permalink
feat: add ci benchmark action
Browse files Browse the repository at this point in the history
  • Loading branch information
atanmarko committed Oct 3, 2024
1 parent 6e27870 commit 1525fe5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,19 @@ jobs:
name: Execute bash script to generate and verify a proof for a small block.
runs-on: zero-ci
timeout-minutes: 15
env:
REGRESSION_PERCENT_THRESHOLD: 10
EXPECTED_PROVING_TIME_SEC: 410
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Run the script
run: ./scripts/prove_stdio.sh artifacts/witness_b19807080.json
run: |
./scripts/prove_stdio.sh artifacts/witness_b19807080.json | tee proving_stdout.log
MEASURED_PROVING_TIME_SEC=`cat proving_stdout.log | grep 'Proving duration:' | tail -1 | awk '{ print int($3)}'`
./scripts/check_proving_time.sh $EXPECTED_PROVING_TIME_SEC $MEASURED_PROVING_TIME_SEC
simple_proof_witness_only:
name: Execute bash script to generate the proof witness for a small block.
Expand All @@ -169,9 +176,16 @@ jobs:
name: Execute bash script to generate and verify a proof for multiple blocks using parallel proving.
runs-on: zero-ci
timeout-minutes: 10
env:
REGRESSION_PERCENT_THRESHOLD: 10
EXPECTED_PROVING_TIME_SEC: 330
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Run the script
run: ./scripts/prove_stdio.sh artifacts/witness_b3_b6.json
run: |
./scripts/prove_stdio.sh artifacts/witness_b3_b6.json | tee proving_stdout.log
MEASURED_PROVING_TIME_SEC=`cat proving_stdout.log | grep 'Proving duration:' | tail -1 | awk '{ print int($3)}'`
./scripts/check_proving_time.sh $EXPECTED_PROVING_TIME_SEC $MEASURED_PROVING_TIME_SEC
20 changes: 20 additions & 0 deletions scripts/check_proving_time.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Args:
# 1 --> Expected measurement
# 2 --> New measurement

EXPECTED=$1
MEASUREMENT=$2

REGRESSION_PERCENT_THRESHOLD="${REGRESSION_PERCENT_THRESHOLD:-10}"

echo "Measured proving time is {$MEASUREMENT}, expected time ${EXPECTED}"

if (( $MEASUREMENT > $EXPECTED )); then
REGRESSION_PERCENT=$(( (($MEASUREMENT-$EXPECTED)*100) / $EXPECTED ))
if (( $REGRESSION_PERCENT > $REGRESSION_PERCENT_THRESHOLD )); then
echo "Measured proving time has more than {$REGRESSION_PERCENT_THRESHOLD}% regression"
exit 1
fi
fi

0 comments on commit 1525fe5

Please sign in to comment.