Skip to content

Commit a8928ba

Browse files
[ci] Enhance CI workflows with performance history recording
1 parent b99a5bf commit a8928ba

1 file changed

Lines changed: 45 additions & 8 deletions

File tree

.github/workflows/build-and-run.yml

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,51 @@ jobs:
242242
./llama-tornado --gpu --${{ matrix.backend.name }} \
243243
--model /$MODELS_DIR/granite-4.0-1b-Q8_0.gguf \
244244
--prompt "Say hello"
245-
- name: Publish performance summary
245+
246+
- name: Publish summary and record history
247+
if: always()
248+
run: |
249+
HISTORY_ARG=""
250+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
251+
HISTORY_ARG="--history docs/perf-history.jsonl"
252+
fi
253+
echo "## Llama-3.2-1B-Instruct F16 — ${{ matrix.backend.name }}" >> $GITHUB_STEP_SUMMARY
254+
python3 scripts/process_metrics.py \
255+
--metrics ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-standard.json:standard \
256+
--metrics ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-prefill-decode.json:prefill-decode \
257+
--metrics ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-batch-prefill-decode.json:batch-prefill-decode \
258+
--backend ${{ matrix.backend.name }} \
259+
--model Llama-3.2-1B-Instruct \
260+
--quantization F16 \
261+
--commit ${{ github.sha }} \
262+
--branch ${{ github.ref_name }} \
263+
--run-id ${{ github.run_id }} \
264+
--run-number ${{ github.run_number }} \
265+
--run-attempt ${{ github.run_attempt }} \
266+
--workflow "${{ github.workflow }}" \
267+
$HISTORY_ARG \
268+
>> $GITHUB_STEP_SUMMARY
269+
270+
- name: Upload metrics artifacts
246271
if: always()
272+
uses: actions/upload-artifact@v4
273+
with:
274+
name: metrics-${{ matrix.backend.name }}-${{ github.run_id }}
275+
path: ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-*.json
276+
if-no-files-found: warn
277+
278+
- name: Commit performance history
279+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
247280
run: |
248-
echo "## Llama-3.2-1B FP16 — ${{ matrix.backend.name }}" >> $GITHUB_STEP_SUMMARY
249-
echo "### Standard" >> $GITHUB_STEP_SUMMARY
250-
cat ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-standard.md >> $GITHUB_STEP_SUMMARY
251-
echo "### Prefill-Decode" >> $GITHUB_STEP_SUMMARY
252-
cat ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-prefill-decode.md >> $GITHUB_STEP_SUMMARY
253-
echo "### Batch-Prefill-Decode" >> $GITHUB_STEP_SUMMARY
254-
cat ${{ runner.temp }}/metrics-${{ matrix.backend.name }}-batch-prefill-decode.md >> $GITHUB_STEP_SUMMARY
281+
git config user.name "github-actions[bot]"
282+
git config user.email "github-actions[bot]@users.noreply.github.com"
283+
git add docs/perf-history.jsonl
284+
git diff --cached --quiet && echo "No history changes to commit" && exit 0
285+
git commit -m "perf: record ${{ matrix.backend.name }} run ${{ github.run_id }} @ ${GITHUB_SHA::8}"
286+
for attempt in 1 2 3; do
287+
git pull --rebase origin main && git push && break || {
288+
[ $attempt -lt 3 ] && { echo "Attempt $attempt failed, retrying in $((attempt * 5))s..."; sleep $((attempt * 5)); } \
289+
|| { echo "::error::Failed to push after 3 attempts"; exit 1; }
290+
}
291+
done
255292

0 commit comments

Comments
 (0)