Benchmark Reports #158
This file contains hidden or 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
| name: Benchmark Reports | |
| on: | |
| schedule: | |
| - cron: '0 7 * * *' # Nightly (ish) Pacific | |
| push: | |
| branches: [ "release-*" ] | |
| workflow_dispatch: | |
| # uncomment for only for testing changes to this workflow while in a PR | |
| # pull_request: | |
| # branches: [ main ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| RISC0_BUILD_LOCKED: 1 | |
| RISC0_RUST_TOOLCHAIN_VERSION: 1.88.0 | |
| RISC0_CPP_TOOLCHAIN_VERSION: 2024.01.05 | |
| RISC0_GROTH16_VERSION: 0.1.0 | |
| jobs: | |
| bench: | |
| runs-on: [self-hosted, cluster, bench, "${{ matrix.os }}", "${{ matrix.arch }}", "${{ matrix.device }}"] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: Linux | |
| arch: X64 | |
| feature: cuda | |
| device: nvidia_rtx_4090 | |
| - os: macOS | |
| arch: ARM64 | |
| feature: prove | |
| device: apple_m2_pro | |
| env: | |
| FEATURE: ${{ matrix.feature }} | |
| EXTRA: "" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - if: matrix.feature == 'cuda' | |
| uses: ./.github/actions/cuda | |
| - uses: ./.github/actions/rustup | |
| - uses: ./.github/actions/sccache | |
| - uses: ./.github/actions/protoc | |
| - run: cargo run --bin rzup -- --verbose install rust $RISC0_RUST_TOOLCHAIN_VERSION | |
| - run: cargo run --bin rzup -- --verbose install cpp $RISC0_CPP_TOOLCHAIN_VERSION | |
| - run: cargo run --bin rzup -- --verbose install risc0-groth16 $RISC0_GROTH16_VERSION | |
| - name: Save commit hash to a file | |
| run: | | |
| echo "${{ github.sha }}" > benchmarks/COMMIT_HASH.txt | |
| echo "${{ github.sha }}" > risc0/zkvm/COMMIT_HASH.txt | |
| - run: cargo run --release -F $FEATURE -- --out ${{ matrix.os }}-${{ matrix.device }}.csv | |
| working-directory: benchmarks | |
| - name: Upload benchmarks | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-result-${{ matrix.os }}-${{ matrix.device }} | |
| path: | | |
| benchmarks/COMMIT_HASH.txt | |
| benchmarks/${{ matrix.os }}-${{ matrix.device }}.csv | |
| - name: Generate datasheet | |
| run: cargo run --release -F $FEATURE $EXTRA --example datasheet -- --json risc0/zkvm/${{ matrix.os }}-${{ matrix.device }}.json | |
| - name: Upload datasheet | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: datasheet-result-${{ matrix.os }}-${{ matrix.device }} | |
| path: | | |
| risc0/zkvm/COMMIT_HASH.txt | |
| risc0/zkvm/${{ matrix.os }}-${{ matrix.device }}.json | |
| publish: | |
| needs: bench | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout gh-pages repository branch ${{ github.base_ref || github.ref_name }} | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: risc0/ghpages | |
| token: ${{ secrets.BENCHMARK_TOKEN }} | |
| ref: ${{ github.base_ref || github.ref_name }} | |
| - name: Download benchmarks | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: benchmark-result-* | |
| path: dev/benchmarks | |
| merge-multiple: true | |
| - name: Download datasheet | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: datasheet-result-* | |
| path: dev/datasheet | |
| merge-multiple: true | |
| - name: Push results | |
| run: | | |
| git config user.name "r0-ghbot" | |
| git config user.email "[email protected]" | |
| git add --all | |
| if git diff --cached --exit-code; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Add build artifacts" | |
| git push | |
| fi | |
| alert_devops_if_failed: | |
| runs-on: ubuntu-latest | |
| if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }} | |
| needs: [bench, publish] | |
| steps: | |
| - name: DevOps Alert | |
| env: | |
| NEEDS: ${{ toJSON(needs) }} | |
| run: | | |
| curl -X POST -H 'Content-type: application/json' --data '{"text":"Benchmark Reports Job Failed: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' ${{ secrets.DEVOPS_ALERT_WEBHOOK_URL }} |