-
-
Notifications
You must be signed in to change notification settings - Fork 553
100 lines (86 loc) · 3.25 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python 3.12
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
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/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
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@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12
- name: Install asv
run: pip install asv
- name: Checkout pybamm-bench repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: pybamm-team/pybamm-bench
token: ${{ secrets.BENCH_PAT }}
- name: Download results artifact(s)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
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