-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |