Daily benchmark #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Daily | |
on: | |
# Run daily at midnight. | |
schedule: | |
- cron: 0 0 * * * | |
# Run whenever this workflow is changed. | |
push: | |
branches: [main] | |
# Allow running manually. | |
workflow_dispatch: | |
env: | |
# Force colorful output, even though we're running in Github Actions. | |
CARGO_TERM_COLOR: always | |
jobs: | |
bench: | |
name: Run benchmarks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache build files | |
uses: Leafwing-Studios/cargo-cache@v1 | |
- name: Install Bencher | |
uses: bencherdev/bencher@main | |
# Run benchmarks, piping output to both `results.txt` and stdout. | |
- name: Run benchmarks | |
run: cargo bench -- 2>&1 | tee results.txt | |
- name: Find Bevy commit hash | |
id: bevy-hash | |
run: | | |
# Find the source property of Bevy, which returns something like: | |
# "git+https://github.com/bevyengine/bevy.git#d659a1f7d506c5c6eba9dfe2a6e878a8c72ecef6" | |
SOURCE=$(cargo metadata --format-version 1 | jq '.packages[] | select(.name == "bevy") | .source') | |
# Regex for a 40-character hexadecimal hash. | |
REGEX="[a-f0-9]{40}" | |
# Capture the hash from the source identifier. | |
HASH=$(echo $SOURCE | grep --extended-regexp --only-matching $REGEX) | |
echo hash=$HASH >> $GITHUB_OUTPUT | |
- name: Upload benchmarks | |
env: | |
BENCHER_PROJECT: bevy | |
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} | |
BENCHER_TESTBED: github-actions | |
BENCHER_HASH: ${{ steps.bevy-hash.outputs.hash }} | |
run: | | |
bencher run \ | |
--adapter rust_criterion \ | |
--hash $BENCHER_HASH | |
--err \ | |
--file results.txt |