forked from pybamm-team/PyBaMM
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (86 loc) · 2.98 KB
/
run_benchmarks_over_history.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# GitHub actions workflow that runs the benchmark suite in benchmarks/
# from "commit_start" to "commit_end". It pushes the results to the
# pybamm-bench repo and updates the display website.
# This workflow is meant to be triggered manually, see
# https://docs.github.com/en/[email protected]/actions/managing-workflow-runs/manually-running-a-workflow
name: Manual benchmarks
on:
workflow_dispatch:
inputs:
commit_start:
description: "Identifier of commit from which to start"
default: "v0.1.0"
commit_end:
description: "Identifier of commit at which to end"
default: "develop"
ncommits:
description: "Number of commits to benchmark between commit_start and commit_end"
default: "100"
env:
PYBAMM_DISABLE_TELEMETRY: "true"
jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install nox and asv
run: pip install -U pip nox asv
- name: Fetch develop branch
# Not required when worklow trigerred
# on develop, but useful when
# experimenting/developing on another branch.
if: github.ref != 'refs/heads/develop'
run: |
git fetch origin develop:develop
- name: Run benchmarks
run: |
asv machine --machine "GitHubRunner"
asv run -m "GitHubRunner" -s ${{ github.event.inputs.ncommits }} \
${{ github.event.inputs.commit_start }}..${{ github.event.inputs.commit_end }}
- name: Upload results as artifact
uses: actions/[email protected]
with:
name: asv_over_history_results
path: results
if-no-files-found: error
publish-results:
if: github.repository_owner == 'pybamm-team'
name: Push and publish results
needs: benchmarks
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install asv
run: pip install asv
- name: Checkout pybamm-bench repo
uses: actions/checkout@v4
with:
repository: pybamm-team/pybamm-bench
token: ${{ secrets.BENCH_PAT }}
- name: Download results artifact(s)
uses: actions/download-artifact@v4
with:
path: results
merge-multiple: true
- name: Copy new results and push to pybamm-bench repo
env:
PUSH_BENCH_EMAIL: ${{ secrets.PUSH_BENCH_EMAIL }}
PUSH_BENCH_NAME: ${{ secrets.PUSH_BENCH_NAME }}
run: |
git config --global user.email "$PUSH_BENCH_EMAIL"
git config --global user.name "$PUSH_BENCH_NAME"
git add results
git commit -am "Add new results"
git push
- name: Publish results
run: |
asv publish
git fetch origin gh-pages:gh-pages
asv gh-pages