mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-02 22:30:20 -06:00
96 lines
3.2 KiB
YAML
96 lines
3.2 KiB
YAML
name: Perf (nightly)
|
|
|
|
# The performance scorecard (#221): `cargo xtask perf` on a fixed macOS runner (Apple silicon,
|
|
# Metal), every night and on demand. It never runs on pull requests, so it can't block one.
|
|
# It fails when an enforced budget in perf/budgets.toml breaks or a scenario's p50 regresses
|
|
# more than 15 % against perf/baseline.json from the same machine class (other classes are
|
|
# never compared; a baseline built from several runs is judged against its highest p50). The
|
|
# table goes to the job summary; results.json is uploaded as the `perf-results` artifact.
|
|
#
|
|
# To give this runner class its own baseline: download the `perf-results` artifact of the last
|
|
# five or more nightly runs (`gh run download <run id> -n perf-results -D runs/<run id>`), run
|
|
# `cargo xtask perf --update-baseline --from runs/<id>/results.json ... --allow-contended` (this
|
|
# runner is never idle) and commit perf/baseline.json and docs/scorecard.md in a PR.
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "23 3 * * *"
|
|
workflow_dispatch:
|
|
inputs:
|
|
quick:
|
|
description: "Quick subset (small documents, no budgets)"
|
|
type: boolean
|
|
default: false
|
|
update_baseline:
|
|
description: "Also write perf/baseline.json from this run (uploaded as an artifact, not committed)"
|
|
type: boolean
|
|
default: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: perf-nightly
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
perf:
|
|
name: perf (macOS, Apple GPU)
|
|
# Pinned image, not -latest: the machine class must stay fixed for comparisons.
|
|
runs-on: macos-15
|
|
timeout-minutes: 120
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
|
|
|
|
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
|
|
with:
|
|
key: perf-release
|
|
|
|
- name: Run benchmarks
|
|
id: perf
|
|
env:
|
|
QUICK: ${{ inputs.quick }}
|
|
UPDATE: ${{ inputs.update_baseline }}
|
|
run: |
|
|
args=()
|
|
if [ "$QUICK" = "true" ]; then args+=(--quick); fi
|
|
# This runner is never idle: a baseline from it is recorded labelled as contended.
|
|
if [ "$UPDATE" = "true" ]; then args+=(--update-baseline --allow-contended); fi
|
|
cargo xtask perf "${args[@]}"
|
|
|
|
- name: Job summary
|
|
if: always()
|
|
run: |
|
|
if [ -f target/perf/summary.md ]; then
|
|
cat target/perf/summary.md >> "$GITHUB_STEP_SUMMARY"
|
|
else
|
|
echo "No perf summary: the run failed before writing one (see the log)." >> "$GITHUB_STEP_SUMMARY"
|
|
fi
|
|
|
|
- name: Upload results
|
|
if: always()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: perf-results
|
|
path: |
|
|
target/perf/*.json
|
|
target/perf/summary.md
|
|
if-no-files-found: warn
|
|
retention-days: 30
|
|
|
|
- name: Upload baseline
|
|
if: always() && inputs.update_baseline
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: perf-baseline
|
|
path: perf/baseline.json
|
|
if-no-files-found: warn
|
|
retention-days: 30
|