forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (69 loc) · 2.58 KB
/
asv-bot.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
76
77
78
name: "ASV Bot"
on:
issue_comment: # Pull requests are issues
types:
- created
env:
ENV_FILE: environment.yml
COMMENT: ${{github.event.comment.body}}
permissions:
contents: read
jobs:
autotune:
permissions:
contents: read
issues: write
pull-requests: write
name: "Run benchmarks"
# TODO: Support more benchmarking options later, against different branches, against self, etc
if: startsWith(github.event.comment.body, '@github-actions benchmark')
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -el {0}
concurrency:
# Set concurrency to prevent abuse(full runs are ~5.5 hours !!!)
# each user can only run one concurrent benchmark bot at a time
# We don't cancel in progress jobs, but if you want to benchmark multiple PRs, you're gonna have
# to wait
group: ${{ github.actor }}-asv
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Although asv sets up its own env, deps are still needed
# during discovery process
- name: Set up Conda
uses: ./.github/actions/setup-conda
- name: Run benchmarks
id: bench
continue-on-error: true # This is a fake failure, asv will exit code 1 for regressions
run: |
# extracting the regex, see https://stackoverflow.com/a/36798723
REGEX=$(echo "$COMMENT" | sed -n "s/^.*-b\s*\(\S*\).*$/\1/p")
cd asv_bench
asv check -E existing
git remote add upstream https://github.com/pandas-dev/pandas.git
git fetch upstream
asv machine --yes
asv continuous -f 1.1 -b $REGEX upstream/main HEAD
echo 'BENCH_OUTPUT<<EOF' >> $GITHUB_ENV
asv compare -f 1.1 upstream/main HEAD >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo "REGEX=$REGEX" >> $GITHUB_ENV
- uses: actions/github-script@v6
env:
BENCH_OUTPUT: ${{env.BENCH_OUTPUT}}
REGEX: ${{env.REGEX}}
with:
script: |
const ENV_VARS = process.env
const run_url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '\nBenchmarks completed. View runner logs here.' + run_url + '\nRegex used: '+ 'regex ' + ENV_VARS["REGEX"] + '\n' + ENV_VARS["BENCH_OUTPUT"]
})