Skip to content

Add PyBaMM IDAKLU Solver #946

Add PyBaMM IDAKLU Solver

Add PyBaMM IDAKLU Solver #946

Workflow file for this run

name: PyBOP
on:
workflow_dispatch:
pull_request:
concurrency:
# github.workflow: name of the workflow, so that we don't cancel other workflows
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Cancel in-progress runs when a new workflow with the same group name is triggered
# This avoids workflow runs on both pushes and PRs
cancel-in-progress: true
jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Check formatting with pre-commit
run: |
python -m pip install pre-commit
pre-commit run ruff
integration_tests:
needs: style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-14]
python-version: ["3.12"]
name: Tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
steps:
- name: Check out PyBOP repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox
- name: Check out PyBaMM v24.1
uses: actions/checkout@v4
with:
repository: pybamm-team/PyBaMM
ref: v24.1
path: pybamm
- name: Compile PyBaMM from source with IDAKLU solver (ubuntu-latest)
if: matrix.os == 'ubuntu-latest'
run: |
cd pybamm
sudo apt-get update && sudo apt-get install -y libopenblas-dev
python -m nox -s pybamm-requires
python -m pip install .[all]
cd ..
- name: Compile PyBaMM from source with IDAKLU solver (macos-latest)
if: matrix.os == 'macos-latest'
run: |
brew reinstall gcc
brew install libomp
cd pybamm
python -m nox -s pybamm-requires
python -m pip install .[all]
cd ..
- name: Compile PyBaMM from source with IDAKLU solver (macos-14)
if: matrix.os == 'macos-14'
run: |
brew reinstall gcc
brew install libomp
cd pybamm
python -m nox -s pybamm-requires
python -m pip install .[all]
cd ..
# TODO: remove later, temporary addition to test Windows build
- name: Compile PyBaMM from source with IDAKLU solver (windows-latest)
if: matrix.os == 'windows-latest'
env:
PYBAMM_USE_VCPKG: "ON"
VCPKG_ROOT_DIR: C:\vcpkg
VCPKG_DEFAULT_TRIPLET: x64-windows-static-md
VCPKG_FEATURE_FLAGS: manifests,registries
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM: x64
CMAKE_BUILD_PARALLEL_LEVEL: 4
run: |
cd pybamm
git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git
python -m pip install .[all]
cd ..
- name: Unit and notebook tests with nox
run: |
pip install -e .[all,dev]
python -m pytest --unit
python -m pytest --nbmake --examples examples/
python -m pytest --integration
# Runs only on Ubuntu with Python 3.12
check_coverage:
needs: style
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: Coverage tests (ubuntu-latest / Python 3.12)
steps:
- name: Check out PyBOP repository
uses: actions/checkout@v4
- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.12
cache: 'pip'
cache-dependency-path: setup.py
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox
- name: Check out PyBaMM v24.1
uses: actions/checkout@v4
with:
repository: pybamm-team/PyBaMM
ref: v24.1
path: pybamm
- name: Compile PyBaMM from source with IDAKLU solver (ubuntu-latest)
run: |
cd pybamm
sudo apt-get update
sudo apt-get install -y libopenblas-dev
python -m nox -s pybamm-requires
python -m pip install .[all]
rm -rf pybind11/
cd ..
- name: Run coverage tests for Ubuntu with Python 3.12 and generate report
run: |
pip install -e .[all,dev]
python -m pytest --unit --examples --cov --cov-report=xml
- name: Upload coverage report
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}