Migrate to scikit-build-core
#10411
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PyBaMM | |
on: | |
workflow_dispatch: | |
pull_request: | |
env: | |
FORCE_COLOR: 3 | |
PYBAMM_IDAKLU_EXPR_CASADI: ON | |
PYBAMM_IDAKLU_EXPR_IREE: ON | |
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@v5 | |
with: | |
python-version: 3.12 | |
- name: Check style | |
run: | | |
python -m pip install pre-commit | |
pre-commit run -a | |
run_windows_unit_integration_tests: | |
needs: style | |
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" | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
name: Tests (windows_latest / Python ${{ matrix.python-version }}) | |
steps: | |
- name: Check out PyBaMM repository | |
uses: actions/checkout@v4 | |
- name: Install Windows system dependencies | |
run: choco install graphviz --version=8.0.5 | |
- name: Set up Python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Cache packages installed through vcpkg on Windows | |
uses: actions/cache@v4 | |
env: | |
cache-name: vckpg_binary_cache | |
with: | |
path: C:\Users\runneradmin\AppData\Local\vcpkg\archives | |
key: ${{ runner.os }}-build-VS2022-${{ env.cache-name }}-${{ hashFiles('vcpkg*.json') }} | |
- name: Install vcpkg on Windows | |
run: | | |
cd C:\ | |
rm -r -fo 'C:\vcpkg' | |
git clone https://github.com/microsoft/vcpkg | |
cd vcpkg | |
.\bootstrap-vcpkg.bat | |
- name: Install nox and tomlkit | |
run: python -m pip install nox tomlkit | |
- name: Run unit tests for windows-latest with Python ${{ matrix.python-version }} | |
run: python -m nox -s unit | |
- name: Run integration tests for windows-latest with Python ${{ matrix.python-version }} | |
run: python -m nox -s integration | |
run_macos_unit_integration_tests: | |
needs: style | |
runs-on: ${{ matrix.os }} | |
env: | |
PYBAMM_IDAKLU_EXPR_CASADI: ON | |
PYBAMM_IDAKLU_EXPR_IREE: ON | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-12, macos-14] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
name: Tests (${{ matrix.os }} / Python ${{ matrix.python-version }}) | |
steps: | |
- name: Check out PyBaMM repository | |
uses: actions/checkout@v4 | |
- name: Install macOS system dependencies | |
env: | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
HOMEBREW_NO_COLOR: 1 | |
# Speed up CI | |
NONINTERACTIVE: 1 | |
# sometimes gfortran cannot be found, so reinstall gcc just to be sure | |
run: | | |
brew analytics off | |
brew install graphviz libomp openblas | |
brew reinstall gcc | |
- name: Set up Python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install nox and tomlkit | |
run: python -m pip install nox tomlkit | |
- name: Cache pybamm-requires nox environment for macOS | |
uses: actions/cache@v4 | |
with: | |
path: | | |
# Headers and dynamic library files for SuiteSparse and SUNDIALS | |
${{ github.workspace }}/install_KLU_Sundials/ | |
key: nox-${{ matrix.os }}-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py', '**/noxfile.py', '**/test_on_push.yml') }} | |
- name: Install SuiteSparse and SUNDIALS on macOS | |
timeout-minutes: 10 | |
run: python -m nox -s pybamm-requires | |
- name: Run unit tests for ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
run: python -m nox -s unit | |
- name: Run integration tests for ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
run: python -m nox -s integration | |
run_linux_unit_integration_coverage_tests: | |
needs: style | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
name: Tests (ubuntu-latest / Python ${{ matrix.python-version }}) | |
steps: | |
- name: Check out PyBaMM repository | |
uses: actions/checkout@v4 | |
- name: Install Linux system dependencies | |
uses: awalsh128/cache-apt-pkgs-action@v1.4.2 | |
with: | |
packages: gfortran gcc graphviz pandoc | |
execute_install_scripts: true | |
# dot -c is for registering graphviz fonts and plugins | |
- name: Install OpenBLAS and TeXLive for Linux | |
run: | | |
sudo apt-get update | |
sudo dot -c | |
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng | |
- name: Set up Python ${{ matrix.python-version }} | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install nox and tomlkit | |
run: python -m pip install nox tomlkit | |
- name: Cache pybamm-requires nox environment for GNU/Linux | |
uses: actions/cache@v4 | |
with: | |
path: | | |
# Headers and dynamic library files for SuiteSparse and SUNDIALS | |
${{ github.workspace }}/install_KLU_Sundials/ | |
key: nox-ubuntu-latest-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py', '**/noxfile.py', '**/test_on_push.yml') }} | |
- name: Install SuiteSparse and SUNDIALS on GNU/Linux | |
timeout-minutes: 10 | |
run: python -m nox -s pybamm-requires | |
- name: Run unit tests for GNU/Linux with Python ${{ matrix.python-version }} | |
if: matrix.python-version != '3.12' | |
run: python -m nox -s unit | |
- name: Run coverage tests for GNU/Linux with Python ${{ matrix.python-version }} | |
if: matrix.python-version == '3.12' | |
run: python -m nox -s coverage | |
- name: Upload coverage report | |
if: matrix.python-version == '3.12' | |
uses: codecov/codecov-action@v4.5.0 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Run integration tests for GNU/Linux with Python ${{ matrix.python-version }} | |
run: python -m nox -s integration | |
# Skips IDAKLU module compilation for speedups, which is already tested in other jobs. | |
run_doctests: | |
needs: style | |
env: | |
BUILD_IDAKLU: OFF | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
name: Doctests (ubuntu-latest / Python 3.11) | |
steps: | |
- name: Check out PyBaMM repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Linux system dependencies | |
uses: awalsh128/cache-apt-pkgs-action@v1.4.2 | |
with: | |
packages: graphviz pandoc | |
execute_install_scripts: true | |
# dot -c is for registering graphviz fonts and plugins | |
- name: Install TeXLive for Linux | |
run: | | |
sudo apt-get update | |
sudo dot -c | |
sudo apt-get install texlive-latex-extra dvipng | |
- name: Set up Python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
cache: 'pip' | |
- name: Install nox and tomlkit | |
run: python -m pip install nox tomlkit | |
- name: Install docs dependencies and run doctests for GNU/Linux | |
run: python -m nox -s doctests | |
- name: Check if the documentation can be built for GNU/Linux | |
run: python -m nox -s docs | |
run_example_tests: | |
needs: style | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
name: Example notebooks (ubuntu-latest / Python 3.12) | |
steps: | |
- name: Check out PyBaMM repository | |
uses: actions/checkout@v4 | |
- name: Install Linux system dependencies | |
uses: awalsh128/cache-apt-pkgs-action@v1.4.2 | |
with: | |
packages: gfortran gcc graphviz pandoc | |
execute_install_scripts: true | |
# dot -c is for registering graphviz fonts and plugins | |
- name: Install OpenBLAS and TeXLive for Linux | |
run: | | |
sudo apt-get update | |
sudo dot -c | |
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng | |
- name: Set up Python 3.12 | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
cache: 'pip' | |
- name: Install nox and tomlkit | |
run: python -m pip install nox tomlkit | |
- name: Cache pybamm-requires nox environment for GNU/Linux | |
uses: actions/cache@v4 | |
with: | |
path: | | |
# Headers and dynamic library files for SuiteSparse and SUNDIALS | |
${{ github.workspace }}/sundials_KLU_libs/ | |
key: nox-ubuntu-latest-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py', '**/noxfile.py', '**/test_on_push.yml') }} | |
- name: Install SuiteSparse and SUNDIALS on GNU/Linux | |
timeout-minutes: 10 | |
run: python -m nox -s pybamm-requires | |
- name: Run example notebooks tests for GNU/Linux with Python 3.12 | |
run: python -m nox -s examples | |
run_scripts_tests: | |
needs: style | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
name: Example scripts (ubuntu-latest / Python 3.12) | |
steps: | |
- name: Check out PyBaMM repository | |
uses: actions/checkout@v4 | |
- name: Install Linux system dependencies | |
uses: awalsh128/cache-apt-pkgs-action@v1.4.2 | |
with: | |
packages: gfortran gcc graphviz | |
execute_install_scripts: true | |
# dot -c is for registering graphviz fonts and plugins | |
- name: Install OpenBLAS and TeXLive for Linux | |
run: | | |
sudo apt-get update | |
sudo dot -c | |
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng | |
- name: Set up Python 3.12 | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
cache: 'pip' | |
- name: Install nox and tomlkit | |
run: python -m pip install nox tomlkit | |
- name: Cache pybamm-requires nox environment for GNU/Linux | |
uses: actions/cache@v4 | |
with: | |
path: | | |
# Headers and dynamic library files for SuiteSparse and SUNDIALS | |
${{ github.workspace }}/sundials_KLU_libs/ | |
key: nox-${{ matrix.os }}-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py', '**/noxfile.py', '**/test_on_push.yml') }} | |
- name: Install SuiteSparse and SUNDIALS on GNU/Linux | |
timeout-minutes: 10 | |
run: python -m nox -s pybamm-requires | |
- name: Run example scripts tests for GNU/Linux with Python 3.12 | |
run: python -m nox -s scripts |