Skip to content

Commit

Permalink
feat: find hash and specify in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
BD103 committed Jun 11, 2024
1 parent 97d4642 commit 0834f74
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,30 @@ jobs:
- 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
# --no-hash: Do not use the Git hash, because we care about the Bevy commit and not our
# own.
# --file: Upload saved Criterion output instead of running a command.
BENCHER_HASH: ${{ steps.bevy-hash.outputs.hash }}
run: |
bencher run \
--adapter rust_criterion \
--no-hash \
--hash $BENCHER_HASH
--err \
--file results.txt

0 comments on commit 0834f74

Please sign in to comment.