Skip to content

Commit

Permalink
add bench workflow (#348) from HigherOrderCO/bench-workflow
Browse files Browse the repository at this point in the history
add bench workflow
  • Loading branch information
enricozb authored May 31, 2024
2 parents 21d630f + 874bed3 commit 22a6cbc
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Bench

on:
pull_request:

concurrency:
group: bench-${{ github.ref }}
cancel-in-progress: true

jobs:
bench:
runs-on: [self-hosted, cuda]
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: dsherret/rust-toolchain-file@v1
- name: compare perf
run: |
git fetch origin main
git clone https://github.com/HigherOrderCO/hvm-bench
cd hvm-bench
NO_COLOR=1 cargo run bench --repo-dir ../ -r main --timeout 20 > ../table
shell: bash -l {0}
- name: write comment
run: |
echo 'Perf run for [`'`git rev-parse --short ${{ github.sha }}`'`](https://github.com/higherorderco/HVM/commit/${{ github.sha }}):' >> comment
echo '```' >> comment
cat table >> comment
echo '```' >> comment
- name: post comment
run: gh pr comment ${{ github.event.number }} -F comment
env:
GH_TOKEN: ${{ secrets.PAT }}
- name: hide old comment
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
COMMENT_ID=$(
gh api graphql -F pr=${{ github.event.number }} -f query='
query($pr: Int!) {
organization(login: "higherorderco") {
repository(name: "HVM") {
pullRequest(number: $pr) {
comments(last: 100) {
nodes { id author { login } }
}
}
}
}
}
' \
| jq -r '
[
.data.organization.repository.pullRequest.comments.nodes | .[]
| select(.author.login == "HigherOrderBot")
| .id
] | .[-2]
'
)
if [ $COMMENT_ID != null ]
then
gh api graphql -F id=$COMMENT_ID -f query='
mutation($id: ID!) {
minimizeComment(input: {
subjectId: $id,
classifier: OUTDATED,
}) { minimizedComment { ...on Comment { id } } }
}
'
fi
- name: delete on cancel
if: ${{ cancelled() }}
run: gh workflow run delete-cancelled.yml -f run_id=${{ github.run_id }}
env:
GH_TOKEN: ${{ secrets.PAT }}
16 changes: 16 additions & 0 deletions .github/workflows/delete-cancelled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Delete Cancelled Benchmarks

on:
workflow_dispatch:
inputs:
run_id:
type: string
description: ""

jobs:
delete:
runs-on: ubuntu-latest
steps:
- run: gh api "repos/higherorderco/hvm-core/actions/runs/${{ inputs.run_id }}" -X DELETE
env:
GH_TOKEN: ${{ secrets.PAT }}

0 comments on commit 22a6cbc

Please sign in to comment.