Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,44 @@ jobs:
continue-on-error: true
steps:
- uses: actions/checkout@v7
# PyBaMM main is a uv workspace that also holds the solvers (packages/pybammsolvers).
# Their version is only bumped at a release, so the PyPI wheel cannot be told apart
# from main's source, which may need it (main called a solver function that no
# release had). So both are built from main's source, as PyBaMM's own tests do.
- uses: actions/checkout@v7
with:
repository: pybamm-team/PyBaMM
ref: main
path: pybamm-main
submodules: recursive
# pybamm's version comes from its git tags: the history without file contents
fetch-depth: 0
filter: blob:none
persist-credentials: false
- uses: astral-sh/[email protected]
# Building SUNDIALS and SuiteSparse takes most of the time. They are built into
# packages/pybammsolvers/.idaklu, which the solver module finds through an absolute
# RPATH, so that folder is cached, keyed on what it is built from: the submodule pins
# and the build script. On a cache hit only the solver module itself is compiled.
- name: Solver libraries cache key
id: solver-libraries
working-directory: pybamm-main/packages/pybammsolvers
run: >-
echo "key=idaklu-${{ runner.os }}-$(git rev-parse HEAD:./sundials
HEAD:./SuiteSparse HEAD:./install_KLU_Sundials.py | sha256sum | cut -c1-16)"
>> "$GITHUB_OUTPUT"
- uses: actions/cache@v6
with:
path: pybamm-main/packages/pybammsolvers/.idaklu
key: ${{ steps.solver-libraries.outputs.key }}
# The compilers and BLAS that PyBaMM's tests install
- run: sudo apt-get update && sudo apt-get install -y gfortran libopenblas-dev
- run: uv sync
# PyBaMM main is a uv workspace (packages/pybamm, packages/pybammsolvers, ...); install
# the pybamm package only. Its workspace source for pybammsolvers would compile the
# solvers (SuiteSparse, SUNDIALS, which need BLAS), so take pybammsolvers from PyPI
# instead. If main ever requires an unreleased pybammsolvers, build it with BLAS.
# Without the workspace sources: through them pybamm pulls in pybammsolvers as an
# editable install, which rebuilds itself on import, without its build tools
- run: >-
uv pip install --no-sources-package pybammsolvers
"pybamm @ git+https://github.com/pybamm-team/PyBaMM.git@main#subdirectory=packages/pybamm"
uv pip install --no-sources ./pybamm-main/packages/pybammsolvers
./pybamm-main/packages/pybamm
- run: uv run --no-sync pytest

changelog:
Expand Down
Loading