mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Each third-party action that StepSecurity publishes a secure drop-in replacement for now uses that replacement, pinned to a commit with its version as a comment. Versions follow what we used: the newest StepSecurity release in the same major, or the closest major they publish. dtolnay/rust-toolchain refs that named a toolchain (stable, nightly, 1.76) become the replacement's `toolchain` input.
102 lines
3.4 KiB
YAML
102 lines
3.4 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:
|
|
- name: Harden runner
|
|
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
|
with:
|
|
egress-policy: audit
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
|
|
- uses: step-security/rust-cache@8871c8ba063416da7c32246932ea6ae08700453e # v2.9.2
|
|
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
|