-
Notifications
You must be signed in to change notification settings - Fork 32
575 lines (516 loc) · 22.3 KB
/
build-and-run.yml
File metadata and controls
575 lines (516 loc) · 22.3 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
name: GPULlama3 Build & Run
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened]
env:
JAVA_VERSION: 21.0.2-open
GRAAL_JARS: /opt/graalJars
MODELS_DIR: /opt/models
QUARKUS_PORT: 8081
# History file committed back to the repo on push to main
PERF_HISTORY_FILE: docs/perf-history.jsonl
jobs:
code-quality:
if: github.repository == 'beehive-lab/GPULlama3.java'
runs-on: self-hosted
timeout-minutes: 30
steps:
- name: Checkout GPULlama3
uses: actions/checkout@v4
- name: Check code formatting (Spotless)
run: |
cd ${{ github.workspace }}
# ./mvnw -T12C -Pspotless spotless:check
# Build: TornadoVM → GPULlama3 → Quarkus LangChain4j
# max-parallel: 1 ensures the opencl and ptx variants run sequentially so
# there are no workspace conflicts between matrix jobs.
build:
if: github.repository == 'beehive-lab/GPULlama3.java'
runs-on: [self-hosted]
needs: code-quality
timeout-minutes: 30
strategy:
fail-fast: true
max-parallel: 1
matrix:
backend:
- name: opencl
- name: ptx
steps:
- name: Checkout GPULlama3
uses: actions/checkout@v4
with:
clean: false
- name: Set up Java
uses: ./.github/actions/setup-java
with:
java_version: ${{ env.JAVA_VERSION }}
- name: Setup TornadoVM
uses: ./.github/actions/setup-tornadovm
env:
TORNADO_ROOT: ${{ runner.tool_cache }}/tornadovm/tornadovm-${{ matrix.backend.name }}
with:
backend: ${{ matrix.backend.name }}
- name: Build GPULlama3.java
run: |
tornado --version
# Strip any pre-existing -SNAPSHOT suffix before appending, making this step idempotent
# across sequential matrix variants (ptx runs after opencl on the same workspace).
BASE_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT$//')
GPULLAMA3_VERSION="${BASE_VERSION}-SNAPSHOT"
echo "GPULlama3 version: $GPULLAMA3_VERSION"
./mvnw versions:set -DnewVersion=$GPULLAMA3_VERSION
./mvnw clean install -DskipTests
echo "GPULLAMA3_VERSION=$GPULLAMA3_VERSION" >> $GITHUB_ENV
- name: Clone Quarkus LangChain4j
run: |
rm -rf quarkus-langchain4j
git clone --depth 1 https://github.com/quarkiverse/quarkus-langchain4j.git
- name: Build Quarkus LangChain4j
run: |
cd ${{ github.workspace }}/quarkus-langchain4j
sed -i 's/<gpu-llama3\.version>.*<\/gpu-llama3\.version>/<gpu-llama3.version>'$GPULLAMA3_VERSION'<\/gpu-llama3.version>/' pom.xml
# -Dtornado activates the TornadoVM profile; -am builds only the gpu-llama3 module + deps
mvn clean install -pl integration-tests/gpu-llama3 -am -DskipTests -Dtornado
standalone-inference:
if: github.repository == 'beehive-lab/GPULlama3.java'
runs-on: [self-hosted]
needs: build
timeout-minutes: 30
strategy:
fail-fast: true
matrix:
backend:
- name: opencl
- name: ptx
steps:
- name: Checkout GPULlama3
uses: actions/checkout@v4
with:
clean: false
- name: Set up Java
uses: ./.github/actions/setup-java
with:
java_version: ${{ env.JAVA_VERSION }}
- name: Setup TornadoVM
uses: ./.github/actions/setup-tornadovm
env:
TORNADO_ROOT: ${{ runner.tool_cache }}/tornadovm/tornadovm-${{ matrix.backend.name }}
with:
backend: ${{ matrix.backend.name }}
# Test standalone mode per model family and quantization
# Note: variants can be represented with matrices
- name: FP16 - Run Llama-3.2-1B-Instruct-F16.gguf - Standard
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Llama-3.2-1B-Instruct-F16.gguf
model: Llama-3.2-1B-Instruct
quantization: F16
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-llama-1b-f16-standard.json
- name: FP16 - Run Llama-3.2-1B-Instruct-F16.gguf - Prefill-Decode
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Llama-3.2-1B-Instruct-F16.gguf
model: Llama-3.2-1B-Instruct
quantization: F16
configuration: prefill-decode
flags: --with-prefill-decode
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-llama-1b-f16-prefill-decode.json
- name: FP16 - Run Llama-3.2-1B-Instruct-F16.gguf - Batch-Prefill-Decode
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Llama-3.2-1B-Instruct-F16.gguf
model: Llama-3.2-1B-Instruct
quantization: F16
configuration: batch-prefill-decode
flags: --with-prefill-decode --batch-prefill-size 32
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-llama-1b-f16-batch-prefill-decode.json
# PTX-only: CUDA-graph variants
- name: PTX - FP16 - Run Llama-3.2-1B-Instruct-F16.gguf - Prefill-Decode-CUDA-Graphs
if: matrix.backend.name == 'ptx'
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Llama-3.2-1B-Instruct-F16.gguf
model: Llama-3.2-1B-Instruct
quantization: F16
configuration: prefill-decode-cuda-graphs
flags: --with-prefill-decode --cuda-graphs
metrics_file: ${{ runner.temp }}/metrics-ptx-llama-1b-f16-prefill-decode-cuda-graphs.json
- name: PTX - FP16 - Run Llama-3.2-1B-Instruct-F16.gguf - Batch-Prefill-Decode-CUDA-Graphs
if: matrix.backend.name == 'ptx'
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Llama-3.2-1B-Instruct-F16.gguf
model: Llama-3.2-1B-Instruct
quantization: F16
configuration: batch-prefill-decode-cuda-graphs
flags: --with-prefill-decode --batch-prefill-size 32 --cuda-graphs
metrics_file: ${{ runner.temp }}/metrics-ptx-llama-1b-f16-batch-prefill-decode-cuda-graphs.json
- name: FP16 - Run Qwen3-4B-f16.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Qwen3-4B-f16.gguf
model: Qwen3-4B
quantization: F16
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-qwen3-4b-f16-standard.json
- name: FP16 - Run Mistral-7B-Instruct-v0.3.fp16.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Mistral-7B-Instruct-v0.3.fp16.gguf
model: Mistral-7B-Instruct-v0.3
quantization: F16
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-mistral-7b-fp16-standard.json
- name: FP16 - Run Qwen2.5-1.5b-instruct-fp16.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: qwen2.5-1.5b-instruct-fp16.gguf
model: Qwen2.5-1.5B-Instruct
quantization: F16
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-qwen2-5-1-5b-fp16-standard.json
- name: FP16 - Run Phi-3-mini-4k-instruct-fp16.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Phi-3-mini-4k-instruct-fp16.gguf
model: Phi-3-mini-4k-instruct
quantization: F16
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-phi3-mini-fp16-standard.json
- name: FP16 - Run Granite-3.2-2b-instruct-f16.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: granite-3.2-2b-instruct-f16.gguf
model: Granite-3.2-2B-Instruct
quantization: F16
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-granite-3-2-2b-f16-standard.json
- name: FP16 - Run Granite-4.0-1b-F16.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: granite-4.0-1b-F16.gguf
model: Granite-4.0-1B
quantization: F16
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-granite-4-0-1b-f16-standard.json
- name: Q8 - Run Llama-3.2-1B-Instruct-Q8_0.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Llama-3.2-1B-Instruct-Q8_0.gguf
model: Llama-3.2-1B-Instruct
quantization: Q8_0
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-llama-1b-q8-standard.json
- name: Q8 - Run Llama-3.2-1B-Instruct-Q8_0.gguf - Prefill-Decode
env:
JAVA_TOOL_OPTIONS: >-
-Dllama.metrics.format=json
-Dllama.metrics.output=file
-Dllama.metrics.file=${{ runner.temp }}/metrics-${{ matrix.backend.name }}-llama-1b-q8-prefill-decode.json
run: |
cd ${{ github.workspace }}
export PATH="$TORNADOVM_HOME/bin:$JAVA_HOME/bin:$PATH"
./llama-tornado --gpu --${{ matrix.backend.name }} \
--model $MODELS_DIR/Llama-3.2-1B-Instruct-Q8_0.gguf \
--prompt "Say hello" \
--with-prefill-decode
python3 scripts/write_metrics_sidecar.py \
--out "${{ runner.temp }}/metrics-${{ matrix.backend.name }}-llama-1b-q8-prefill-decode.meta.json" \
backend="${{ matrix.backend.name }}" \
task=llama-inference \
model_file=Llama-3.2-1B-Instruct-Q8_0.gguf \
model=Llama-3.2-1B-Instruct \
quantization=Q8_0 \
configuration=prefill-decode \
"flags=--with-prefill-decode" \
prompt="Say hello"
- name: Q8 - Run Llama-3.2-1B-Instruct-Q8_0.gguf - Batch-Prefill-Decode
env:
JAVA_TOOL_OPTIONS: >-
-Dllama.metrics.format=json
-Dllama.metrics.output=file
-Dllama.metrics.file=${{ runner.temp }}/metrics-${{ matrix.backend.name }}-llama-1b-q8-batch-prefill-decode.json
run: |
cd ${{ github.workspace }}
export PATH="$TORNADOVM_HOME/bin:$JAVA_HOME/bin:$PATH"
./llama-tornado --gpu --${{ matrix.backend.name }} \
--model $MODELS_DIR/Llama-3.2-1B-Instruct-Q8_0.gguf \
--prompt "Say hello" \
--with-prefill-decode --batch-prefill-size 32
python3 scripts/write_metrics_sidecar.py \
--out "${{ runner.temp }}/metrics-${{ matrix.backend.name }}-llama-1b-q8-batch-prefill-decode.meta.json" \
backend="${{ matrix.backend.name }}" \
task=llama-inference \
model_file=Llama-3.2-1B-Instruct-Q8_0.gguf \
model=Llama-3.2-1B-Instruct \
quantization=Q8_0 \
configuration=batch-prefill-decode \
"flags=--with-prefill-decode --batch-prefill-size 32" \
prompt="Say hello"
# ── PTX-only: CUDA-graph variants ────────────────────────────────────────
- name: PTX - Q8 - Run Llama-3.2-1B-Instruct-Q8_0.gguf - Prefill-Decode-CUDA-Graphs
if: matrix.backend.name == 'ptx'
env:
JAVA_TOOL_OPTIONS: >-
-Dllama.metrics.format=json
-Dllama.metrics.output=file
-Dllama.metrics.file=${{ runner.temp }}/metrics-ptx-llama-1b-q8-prefill-decode-cuda-graphs.json
run: |
cd ${{ github.workspace }}
export PATH="$TORNADOVM_HOME/bin:$JAVA_HOME/bin:$PATH"
./llama-tornado --gpu --ptx \
--model $MODELS_DIR/Llama-3.2-1B-Instruct-Q8_0.gguf \
--prompt "Say hello" \
--with-prefill-decode \
--cuda-graphs
python3 scripts/write_metrics_sidecar.py \
--out "${{ runner.temp }}/metrics-ptx-llama-1b-q8-prefill-decode-cuda-graphs.meta.json" \
backend=ptx \
task=llama-inference \
model_file=Llama-3.2-1B-Instruct-Q8_0.gguf \
model=Llama-3.2-1B-Instruct \
quantization=Q8_0 \
configuration=prefill-decode-cuda-graphs \
"flags=--with-prefill-decode --cuda-graphs" \
prompt="Say hello"
- name: PTX - Q8 - Run Llama-3.2-1B-Instruct-Q8_0.gguf - Batch-Prefill-Decode-CUDA-Graphs
if: matrix.backend.name == 'ptx'
env:
JAVA_TOOL_OPTIONS: >-
-Dllama.metrics.format=json
-Dllama.metrics.output=file
-Dllama.metrics.file=${{ runner.temp }}/metrics-ptx-llama-1b-q8-batch-prefill-decode-cuda-graphs.json
run: |
cd ${{ github.workspace }}
export PATH="$TORNADOVM_HOME/bin:$JAVA_HOME/bin:$PATH"
./llama-tornado --gpu --ptx \
--model $MODELS_DIR/Llama-3.2-1B-Instruct-Q8_0.gguf \
--prompt "Say hello" \
--with-prefill-decode --batch-prefill-size 32 \
--cuda-graphs
python3 scripts/write_metrics_sidecar.py \
--out "${{ runner.temp }}/metrics-ptx-llama-1b-q8-batch-prefill-decode-cuda-graphs.meta.json" \
backend=ptx \
task=llama-inference \
model_file=Llama-3.2-1B-Instruct-Q8_0.gguf \
model=Llama-3.2-1B-Instruct \
quantization=Q8_0 \
configuration=batch-prefill-decode-cuda-graphs \
"flags=--with-prefill-decode --batch-prefill-size 32 --cuda-graphs" \
prompt="Say hello"
- name: Q8 - Run Qwen3-0.6B-Q8_0.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Qwen3-0.6B-Q8_0.gguf
model: Qwen3-0.6B
quantization: Q8_0
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-qwen3-0-6b-q8-standard.json
- name: Q8 - Run Phi-3-mini-4k-instruct-Q8_0.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Phi-3-mini-4k-instruct-Q8_0.gguf
model: Phi-3-mini-4k-instruct
quantization: Q8_0
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-phi3-mini-q8-standard.json
- name: Q8 - Run Qwen2.5-1.5b-instruct-q8_0.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: qwen2.5-1.5b-instruct-q8_0.gguf
model: Qwen2.5-1.5B-Instruct
quantization: Q8_0
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-qwen2-5-1-5b-q8-standard.json
- name: Q8 - Run Mistral-7B-Instruct-v0.3.Q8_0.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: Mistral-7B-Instruct-v0.3.Q8_0.gguf
model: Mistral-7B-Instruct-v0.3
quantization: Q8_0
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-mistral-7b-q8-standard.json
- name: Q8 - Run Granite-3.2-2b-instruct-Q8_0.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: granite-3.2-2b-instruct-Q8_0.gguf
model: Granite-3.2-2B-Instruct
quantization: Q8_0
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-granite-3-2-2b-q8-standard.json
- name: Q8 - Run Granite-4.0-1b-Q8_0.gguf
uses: ./.github/actions/run-inference
with:
backend: ${{ matrix.backend.name }}
model_file: granite-4.0-1b-Q8_0.gguf
model: Granite-4.0-1B
quantization: Q8_0
configuration: standard
metrics_file: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-granite-4-0-1b-q8-standard.json
# Upload metrics for the publish job
- name: Upload metrics artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: metrics-${{ matrix.backend.name }}-${{ github.run_id }}
path: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-*.json
if-no-files-found: warn
# Test integration with Quarkus-langchain4j
quarkus-langchain4j-integration:
if: github.repository == 'beehive-lab/GPULlama3.java'
runs-on: [self-hosted]
needs: build
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
backend:
- name: opencl
- name: ptx
steps:
- name: Checkout GPULlama3
uses: actions/checkout@v4
with:
clean: false
- name: Set up Java
uses: ./.github/actions/setup-java
with:
java_version: ${{ env.JAVA_VERSION }}
- name: Setup TornadoVM
uses: ./.github/actions/setup-tornadovm
env:
TORNADO_ROOT: ${{ runner.tool_cache }}/tornadovm/tornadovm-${{ matrix.backend.name }}
with:
backend: ${{ matrix.backend.name }}
- name: Verify GPULlama3 Dependency
run: |
cd ${{ github.workspace }}/quarkus-langchain4j/integration-tests/gpu-llama3
mvn dependency:tree | grep "io.github.beehive-lab:gpu-llama3"
- name: Start Quarkus Application
run: |
cd ${{ github.workspace }}/quarkus-langchain4j/integration-tests/gpu-llama3
java @"$TORNADOVM_HOME/tornado-argfile" \
-Dtornado.device.memory=8GB \
-Dquarkus.http.port=$QUARKUS_PORT \
-jar target/quarkus-app/quarkus-run.jar &
APP_PID=$!
echo "APP_PID=$APP_PID" >> $GITHUB_ENV
for i in {1..30}; do
if curl -s http://localhost:$QUARKUS_PORT/q/health > /dev/null 2>&1; then
echo "Application ready after ${i} seconds"
break
elif [ $i -eq 30 ]; then
echo "::error::Application failed to start within 30 seconds"
kill $APP_PID || true
exit 1
else
[ $((i % 5)) -eq 0 ] && echo "Still waiting... (${i}s)"
sleep 1
fi
done
- name: Trigger Blocking Endpoint
run: |
for attempt in 1 2 3; do
echo "Attempt $attempt of 3 for blocking endpoint..."
HTTP_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/blocking)
HTTP_CODE="${HTTP_RESPONSE: -3}"
if [ "$HTTP_CODE" = "200" ]; then
echo "SUCCESS: HTTP $HTTP_CODE"
echo "Response body: ${HTTP_RESPONSE%???}"
break
fi
echo "Failed: HTTP $HTTP_CODE"
[ $attempt -lt 3 ] && sleep 2
[ $attempt -eq 3 ] && { echo "::error::Blocking endpoint failed after 3 attempts"; exit 1; }
done
- name: Trigger Streaming Endpoint
run: |
for attempt in 1 2 3; do
echo "Attempt $attempt of 3 for streaming endpoint..."
HTTP_CODE=$(timeout 10s curl -s -o /dev/null -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/streaming)
if [ "$HTTP_CODE" = "200" ]; then
echo "SUCCESS: HTTP $HTTP_CODE"
break
fi
echo "Failed: HTTP $HTTP_CODE"
[ $attempt -lt 3 ] && sleep 2
[ $attempt -eq 3 ] && { echo "::error::Streaming endpoint failed after 3 attempts"; exit 1; }
done
- name: Cleanup & Shutdown
if: always()
run: |
kill $APP_PID || true
wait $APP_PID 2>/dev/null || true
# Collect all matrix metrics and update history
publish-performance-history:
# Guard: only commit history on real pushes to main, not on PRs or forks.
# Prevents duplicate entries from PR runs and avoids push-permission errors on forks.
if: >-
github.repository == 'beehive-lab/GPULlama3.java' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
runs-on: [self-hosted]
needs: standalone-inference
timeout-minutes: 15
steps:
- name: Checkout GPULlama3
uses: actions/checkout@v4
- name: Download metrics artifacts
uses: actions/download-artifact@v4
with:
pattern: metrics-*-${{ github.run_id }}
path: ${{ runner.temp }}/metrics-artifacts
merge-multiple: true
- name: Append to performance history
run: |
python3 scripts/process_metrics.py \
--metrics-dir "${{ runner.temp }}/metrics-artifacts" \
--commit "${{ github.sha }}" \
--branch "${{ github.ref_name }}" \
--run-id "${{ github.run_id }}" \
--run-number "${{ github.run_number }}" \
--run-attempt "${{ github.run_attempt }}" \
--workflow "${{ github.workflow }}" \
--history "$PERF_HISTORY_FILE"
- name: Commit performance history
run: |
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-8)
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add "$PERF_HISTORY_FILE"
git diff --cached --quiet && \
echo "No history changes to commit" && exit 0
git commit -m "perf: record run #${{ github.run_number }} @ ${SHORT_SHA}"
for attempt in 1 2 3; do
git pull --rebase origin main && git push && break || {
if [ $attempt -lt 3 ]; then
echo "Attempt $attempt failed, retrying in $((attempt * 5))s..."
sleep $((attempt * 5))
else
echo "::error::Failed to push after 3 attempts"
exit 1
fi
}
done