forked from risc0/risc0
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (119 loc) · 4.25 KB
/
bench_reports.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Benchmark Reports
on:
schedule:
- cron: '0 7 * * *' # Nightly (ish) Pacific
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
# this is needed to gain access via OIDC to the S3 bucket for caching
permissions:
id-token: write
contents: read
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RISC0_BUILD_LOCKED: 1
RISC0_RUST_TOOLCHAIN_VERSION: r0.1.79.0-2
RISC0_CPP_TOOLCHAIN_VERSION: 2024.01.05
jobs:
bench:
runs-on: [self-hosted, prod, bench, "${{ matrix.os }}", "${{ matrix.device }}"]
strategy:
fail-fast: false
matrix:
include:
- os: Linux
feature: prove
device: cpu
- os: Linux
feature: cuda
device: nvidia_rtx_3090_ti
- os: Linux
feature: cuda
device: g6.xlarge
- os: macOS
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
with:
key: ${{ matrix.os }}-${{ matrix.feature }}
- run: cargo run --bin rzup -- --verbose install rust $RISC0_RUST_TOOLCHAIN_VERSION
- run: cargo run --bin rzup -- --verbose install cpp $RISC0_CPP_TOOLCHAIN_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
- if: matrix.feature == 'cuda'
run: echo "EXTRA=-F docker" >> $GITHUB_ENV
- 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 }}