Skip to content

Commit

Permalink
ci: add nightly performance metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstam committed Feb 24, 2024
1 parent 17e6ebc commit 4572919
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/perf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Periodically prove an example and parse the metrics for comparison so that there are no
# performance regressions.
name: Performance Metrics

on:
schedule:
- cron: "0 0 * * *" # Runs at 00:00 UTC every day

jobs:
metrics:
name: Performance Metrics
runs-on: buildjet-32vcpu-ubuntu-2204
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
env:
EXAMPLE_NAME: ssz-withdrawals
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Set up git private repo access
run: |
git config --global url."https://${{ secrets.PRIVATE_PULL_TOKEN }}@github.com/".insteadOf ssh://[email protected]
git config --global url."https://${{ secrets.PRIVATE_PULL_TOKEN }}@github.com".insteadOf https://github.com
- name: rust-cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
~/.rustup/
key: test-rust-nightly-2024-01-25-${{ hashFiles('**/Cargo.toml') }}
restore-keys: rust-nightly-2024-01-25-

- name: Install nightly toolchain
id: rustc-toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-01-25
override: true

- name: Install SP1 toolchain
run: |
cd cli
cargo install --locked --force --path .
cd ~
cargo prove install-toolchain
- name: Build and Run Example
run: |
cd examples/${{ env.EXAMPLE_NAME }}/program
cargo prove | tee output.txt
- name: Parse Metric Values
id: parse_metrics
run: |
currentTime=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
exampleName="${{ env.EXAMPLE_NAME }}"
outputTxt="examples/$exampleName/program/output.txt"
cycles=$(grep -oP 'cycles=\K\d+' "$outputTxt")
e2e=$(grep -oP 'e2e=\K\d+' "$outputTxt")
khz=$(grep -oP 'khz=\K[\d.]+' "$outputTxt")
proofSize=$(grep -oP 'proofSize=\K[\d.]+' "$outputTxt")
echo "Current Time=$currentTime" >> $GITHUB_ENV
echo "Example Name=$exampleName" >> $GITHUB_ENV
echo "Cycles=$cycles" >> $GITHUB_ENV
echo "End-to-End Time=$e2e" >> $GITHUB_ENV
echo "Clock Speed (kHz)=$khz" >> $GITHUB_ENV
echo "Proof Size=$proofSize" >> $GITHUB_ENV
echo "Current Time: $currentTime" > parsed_metrics.txt
echo "Example Name: $exampleName" >> parsed_metrics.txt
echo "Cycles: $cycles" >> parsed_metrics.txt
echo "End-to-End Time: $e2e" >> parsed_metrics.txt
echo "Clock Speed (kHz): $khz" >> parsed_metrics.txt
echo "Proof Size: $proofSize" >> parsed_metrics.txt
- name: Upload Parsed Metrics as Artifact
uses: actions/upload-artifact@v2
with:
name: parsed_metrics
path: parsed_metrics.txt

0 comments on commit 4572919

Please sign in to comment.