-
Notifications
You must be signed in to change notification settings - Fork 400
75 lines (71 loc) · 2.27 KB
/
bench.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
- 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 }}