9
9
debug :
10
10
type : boolean
11
11
description : Debugging output
12
+ deploy :
13
+ type : boolean
14
+ description : Deploy the benchmark site
12
15
schedule :
13
16
- cron : ' 15 4 * * *'
14
17
@@ -70,11 +73,15 @@ jobs:
70
73
if : matrix.platform.setup-script != ''
71
74
- name : Clone resource repositories
72
75
run : |
76
+ # TODO:
73
77
# we need a superior way to package the benchmark resources; lfs
74
78
# is too expensive
75
79
# git lfs install
76
80
# git clone https://github.com/libgit2/benchmark-resources resources
81
+
77
82
git clone --bare https://github.com/git/git resources/git
83
+
84
+ # TODO:
78
85
# avoid linux temporarily; the linux blame benchmarks are simply
79
86
# too slow to use
80
87
# git clone --bare https://github.com/torvalds/linux resources/linux
85
92
shell : bash
86
93
- name : Benchmark
87
94
run : |
88
- export BENCHMARK_RESOURCES_PATH="$(pwd)/resources"
95
+ # TODO:
96
+ # avoid benchmark resource path currently
97
+ #export BENCHMARK_RESOURCES_PATH="$(pwd)/resources"
89
98
export BENCHMARK_GIT_PATH="$(pwd)/resources/git"
90
99
# avoid linux temporarily; the linux blame benchmarks are simply
91
100
# too slow to use
@@ -122,7 +131,7 @@ jobs:
122
131
publish :
123
132
name : Publish results
124
133
needs : [ build ]
125
- if : always() && github.repository == 'libgit2/libgit2' && github.event_name == 'schedule'
134
+ if : always() && github.repository == 'libgit2/libgit2'
126
135
runs-on : ubuntu-latest
127
136
steps :
128
137
- name : Check out benchmark repository
@@ -134,40 +143,58 @@ jobs:
134
143
ssh-key : ${{ secrets.BENCHMARKS_PUBLISH_KEY }}
135
144
- name : Download test results
136
145
uses : actions/download-artifact@v4
146
+ - name : Generate API
147
+ run : |
148
+ # Move today's benchmark run into the right place
149
+ for platform in linux macos windows; do
150
+ TIMESTAMP=$(jq .time.start < "benchmark-${platform}/benchmarks.json")
151
+ TIMESTAMP_LEN=$(echo -n ${TIMESTAMP} | wc -c | xargs)
152
+ DENOMINATOR=1
153
+ if [ "${TIMESTAMP_LEN}" = "19" ]; then
154
+ DENOMINATOR="1000000000"
155
+ elif [ "${TIMESTAMP_LEN}" = "13" ]; then
156
+ DENOMINATOR="1000"
157
+ else
158
+ echo "unknown timestamp"
159
+ exit 1
160
+ fi
161
+
162
+ if [[ "$(uname -s)" == "Darwin" ]]; then
163
+ DATE=$(date -R -r $(("${TIMESTAMP}/${DENOMINATOR}")) +"%Y-%m-%d")
164
+ else
165
+ DATE=$(date -d @$(("${TIMESTAMP}/${DENOMINATOR}")) +"%Y-%m-%d")
166
+ fi
167
+
168
+ # move the complete results in
169
+ mkdir -p "site/public/api/runs/${DATE}"
170
+ cp "benchmark-${platform}/benchmarks.json" "site/public/api/runs/${DATE}/${platform}.json"
171
+
172
+ # unzip the individual results
173
+ PLATFORM_TEMP=$(mktemp -d)
174
+ unzip "benchmark-${platform}/benchmarks.zip" -d "${PLATFORM_TEMP}"
175
+
176
+ mkdir -p "site/public/api/runs/${DATE}/${platform}"
177
+ find "${PLATFORM_TEMP}" -name \*\.svg -exec cp {} "site/public/api/runs/${DATE}/${platform}" \;
178
+ done
179
+
180
+ (cd site && node scripts/aggregate.js)
181
+ shell : bash
182
+
183
+ # in debug mode, don't deploy the site; only create a zip file and
184
+ # upload it for debugging
185
+ - name : Upload site
186
+ uses : actions/upload-artifact@v4
187
+ with :
188
+ name : site
189
+ path : site
190
+ if : github.event_name == 'workflow_dispatch'
137
191
- name : Publish API
138
192
run : |
139
- # Move today's benchmark run into the right place
140
- for platform in linux macos windows; do
141
- TIMESTAMP=$(jq .time.start < "benchmark-${platform}/benchmarks.json")
142
- TIMESTAMP_LEN=$(echo -n ${TIMESTAMP} | wc -c | xargs)
143
- DENOMINATOR=1
144
- if [ "${TIMESTAMP_LEN}" = "19" ]; then
145
- DENOMINATOR="1000000000"
146
- elif [ "${TIMESTAMP_LEN}" = "13" ]; then
147
- DENOMINATOR="1000"
148
- else
149
- echo "unknown timestamp"
150
- exit 1
151
- fi
152
-
153
- if [[ "$(uname -s)" == "Darwin" ]]; then
154
- DATE=$(date -R -r $(("${TIMESTAMP}/${DENOMINATOR}")) +"%Y-%m-%d")
155
- else
156
- DATE=$(date -d @$(("${TIMESTAMP}/${DENOMINATOR}")) +"%Y-%m-%d")
157
- fi
158
-
159
- mkdir -p "site/public/api/runs/${DATE}"
160
- cp "benchmark-${platform}/benchmarks.json" "site/public/api/runs/${DATE}/${platform}.json"
161
- done
162
-
163
- (cd site && node scripts/aggregate.js)
164
-
165
- (
166
- cd site &&
167
193
git config user.name 'Benchmark Site Generation' &&
168
194
git config user.email 'libgit2@users.noreply.github.com' &&
169
195
git add . &&
170
196
git commit --allow-empty -m"benchmark update ${DATE}" &&
171
197
git push origin main
172
- )
173
198
shell : bash
199
+ working-directory : site
200
+ if : github.event_name == 'schedule' || github.event.inputs.deploy == 'true'
0 commit comments