1+ name : ASV benchmarks
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ pull_request :
7+ branches : ["main"]
8+
9+ jobs :
10+ run-benchmarks :
11+ name : Benchmark on ${{ matrix.os }}
12+ runs-on : ${{ matrix.os }}
13+ permissions :
14+ contents : read
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ os : [ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm]
19+
20+ steps :
21+ - uses : actions/checkout@v5
22+ with :
23+ fetch-depth : 0
24+
25+ - name : Set up main branch
26+ run : |
27+ git branch main origin/main
28+
29+ -
uses :
prefix-dev/[email protected] 30+ with :
31+ environments : dev
32+ cache : true
33+
34+ - name : Run benchmarks
35+ shell : bash
36+ run : |
37+ MACHINE=${{ matrix.os }} pixi run asv-build
38+
39+ - name : Upload benchmark results
40+ uses : actions/upload-artifact@v4
41+ with :
42+ name : asv-results-${{ matrix.os }}
43+ path : asv_benchmarks/results
44+
45+ publish-report :
46+ name : Build HTML report
47+ runs-on : ubuntu-latest
48+ needs : run-benchmarks
49+ permissions :
50+ contents : write
51+
52+ steps :
53+ - uses : actions/checkout@v5
54+ with :
55+ fetch-depth : 0
56+
57+ - name : Set up main branch
58+ run : |
59+ git branch main origin/main
60+
61+ - name : Prepare previous ASV results
62+ uses : actions/checkout@v5
63+ continue-on-error : true
64+ with :
65+ ref : gh-pages
66+ path : gh-pages
67+
68+ - name : Copy previous results
69+ run : |
70+ mkdir -p asv_benchmarks/results
71+ cp -r gh-pages/results/* asv_benchmarks/results/ 2>/dev/null || true
72+
73+ - name : Download all benchmark results
74+ uses : actions/download-artifact@v5
75+ with :
76+ pattern : asv-results-*
77+
78+ - name : Merge new benchmark results
79+ run : |
80+ for d in asv-results-*; do
81+ [ -d "$d" ] || continue
82+ cp -r "$d"/* "asv_benchmarks/results/"
83+ done
84+
85+ -
uses :
prefix-dev/[email protected] 86+ with :
87+ environments : dev
88+ cache : true
89+
90+ - name : Generate HTML report
91+ run : |
92+ pixi run asv-publish
93+
94+ - name : Copy results to publish directory
95+ run : |
96+ cp -r asv_benchmarks/results html/
97+
98+ - name : Deploy to GitHub Pages
99+ uses : peaceiris/actions-gh-pages@v4
100+ if : github.event_name == 'push'
101+ with :
102+ github_token : ${{ secrets.GITHUB_TOKEN }}
103+ publish_dir : ./html
104+ keep_files : true
105+ user_name : ' github-actions[bot]'
106+ user_email : ' github-actions[bot]@users.noreply.github.com'
107+ commit_message : ${{ github.event.head_commit.message }}
0 commit comments