-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (58 loc) · 2.07 KB
/
asv.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
# This workflow will install Python dependencies, run benchmarks with airspeed velocity (asv)
# and publish the results to a dashboard on GH Pages.
name: Run benchmarks with airspeed velocity
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: write
env:
ASV_CONFIG_FILE: benchmarks/asv.conf.json
GENERATED_HTML_DIR: benchmarks/html
jobs:
run-asv:
runs-on: ubuntu-latest
steps:
- name: Checkout project repository
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install asv
pip install virtualenv
- name: Create ASV machine config file
run: asv machine --config $ASV_CONFIG_FILE --yes -v
- name: Run ASV for current branch
run: asv run --config $ASV_CONFIG_FILE -v
- name: Generate dashboard HTML
if: ${{ github.event_name == 'push' }}
run: asv publish --config $ASV_CONFIG_FILE -v
- name: Deploy to Github pages
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ${{ env.GENERATED_HTML_DIR }}
- name: Run comparison against main branch
if: ${{ github.event_name == 'pull_request' }}
run: asv compare --config $ASV_CONFIG_FILE main HEAD > results.txt
- name: Publish comment to PR
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const comment = fs.readFileSync('results.txt', 'utf-8');
const { data } = await github.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: comment,
});
console.log("Comment published:", data.html_url);