Skip to content

Benchmarks

Benchmarks #1110

# This workflow periodically runs the benchmarks suite in benchmarks/
# using asv and publish the results, effectively updating
# the display website hosted in the liionpack-bench repo
# Steps:
# - Benchmark all commits since the last one that was benchmarked
# - Push results to liionpack-bench repo
# - Publish website
name: Benchmarks
on:
# Everyday at 3 am UTC
schedule:
- cron: "0 3 * * *"
# Make it possible to trigger the
# workflow manually
workflow_dispatch:
jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install tox and asv
run: pip install -U pip tox asv
- name: Run benchmarks
run: |
asv machine --machine "GitHubRunner"
asv run --machine "GitHubRunner" NEW
- name: Upload results as artifact
uses: actions/upload-artifact@v2
with:
name: asv_new_results
path: results
publish-results:
name: Push and publish results
needs: benchmarks
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install asv
run: pip install asv
- name: Checkout liionpack-bench repo
uses: actions/checkout@v3
with:
repository: pybamm-team/liionpack-bench
token: ${{ secrets.BENCH_PAT }}
- name: Download results artifact
uses: actions/download-artifact@v2
with:
name: asv_new_results
path: new_results
- name: Copy new results and push to liionpack-bench repo
env:
PUSH_BENCH_EMAIL: ${{ secrets.PUSH_BENCH_EMAIL }}
PUSH_BENCH_NAME: ${{ secrets.PUSH_BENCH_NAME }}
run: |
cp -vr new_results/* results
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