Skip to content

Commit

Permalink
Merge branch 'develop' into expression-tree-typing
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjrobins authored Feb 21, 2024
2 parents ea03b4f + cf686e7 commit eeceaa7
Show file tree
Hide file tree
Showing 79 changed files with 3,365 additions and 179 deletions.
7 changes: 5 additions & 2 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@
"profile": "https://github.com/jonchapman1",
"contributions": [
"ideas",
"fundingFinding"
"fundingFinding",
"doc"
]
},
{
Expand Down Expand Up @@ -772,7 +773,9 @@
"avatar_url": "https://avatars.githubusercontent.com/u/99216956?v=4",
"profile": "https://github.com/prady0t",
"contributions": [
"infra"
"infra",
"code",
"test"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lychee_url_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

# use stable version for now to avoid breaking changes
- name: Lychee URL checker
uses: lycheeverse/[email protected].1
uses: lycheeverse/[email protected].3
with:
# arguments with file types to check
args: >-
Expand Down
44 changes: 39 additions & 5 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: python -c "import pybamm; pybamm.IDAKLUSolver()"

- name: Build wheels on macOS
- name: Build wheels on macOS amd64
if: matrix.os == 'macos-latest'
run: pipx run cibuildwheel --output-dir wheelhouse
env:
Expand All @@ -150,11 +150,45 @@ jobs:
path: ./wheelhouse/*.whl
if-no-files-found: error

- name: Upload wheels for macOS
- name: Upload wheels for macOS amd64
uses: actions/upload-artifact@v4
if: matrix.os == 'macos-latest'
with:
name: macos_wheels
name: macos_amd64_wheels
path: ./wheelhouse/*.whl
if-no-files-found: error

build_macos_arm64_wheels:
name: Wheels (macos-arm64)
# Current runner is macOS X 14+ on GitHub-hosted runners
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git

- name: Install SuiteSparse and SUNDIALS on macOS
run: |
brew install graphviz openblas libomp
brew reinstall gcc
python -m pip install cmake pipx
python scripts/install_KLU_Sundials.py
- name: Build wheels on macOS arm64
run: python -m pipx run cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_BUILD: python -m pip install cmake casadi setuptools wheel delocate
CIBW_REPAIR_WHEEL_COMMAND: delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: python -c "import pybamm; pybamm.IDAKLUSolver()"

- name: Upload wheels for macOS arm64
uses: actions/upload-artifact@v4
with:
name: macos_arm64_wheels
path: ./wheelhouse/*.whl
if-no-files-found: error

Expand Down Expand Up @@ -182,7 +216,7 @@ jobs:
# This job is only of value to PyBaMM and would always be skipped in forks
if: github.event_name != 'schedule' && github.repository == 'pybamm-team/PyBaMM'
name: Upload package to PyPI
needs: [build_macos_and_linux_wheels, build_windows_wheels, build_sdist]
needs: [build_macos_and_linux_wheels, build_macos_arm64_wheels, build_windows_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
Expand All @@ -191,7 +225,7 @@ jobs:
- name: Move all package files to files/
run: |
mkdir files
mv windows_wheels/* linux_wheels/* macos_wheels/* sdist/* files/
mv windows_wheels/* linux_wheels/* macos_amd64_wheels/* macos_arm64_wheels/* sdist/* files/
- name: Publish on PyPI
if: github.event.inputs.target == 'pypi' || github.event_name == 'release'
Expand Down
59 changes: 48 additions & 11 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,21 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# Include macOS M1 runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"

steps:
- uses: actions/checkout@v4
- name: Check out PyBaMM repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -62,7 +74,7 @@ jobs:
sudo apt install texlive-full
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-latest' || matrix.os == 'macos-14'
run: |
brew analytics off
brew install graphviz openblas libomp
Expand All @@ -76,6 +88,7 @@ jobs:
run: python -m pip install nox

- name: Install SuiteSparse and SUNDIALS on GNU/Linux and macOS
timeout-minutes: 10
if: matrix.os != 'windows-latest'
run: python -m nox -s pybamm-requires

Expand All @@ -89,7 +102,9 @@ jobs:

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
uses: codecov/[email protected]
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Run integration tests
run: python -m nox -s integration
Expand All @@ -110,42 +125,54 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: python -m nox -s scripts

#M-series Mac Mini
# M-series Mac Mini
build-apple-mseries:
if: github.repository_owner == 'pybamm-team'
needs: style
runs-on: [self-hosted, macOS, ARM64]
env:
GITHUB_PATH: ${PYENV_ROOT/bin:$PATH}
LD_LIBRARY_PATH: $HOME/.local/lib
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Install python & create virtualenv
- name: Install Python & create virtualenv
shell: bash
run: |
eval "$(pyenv init -)"
pyenv install ${{ matrix.python-version }} -s
pyenv virtualenv ${{ matrix.python-version }} pybamm-${{ matrix.python-version }}
- name: Install dependencies & run unit tests for Windows and MacOS
- name: Install build-time dependencies & run unit tests for M-series macOS runner
shell: bash
env:
# Point scikits.odes to the correct SUNDIALS installation
SUNDIALS_INST: $HOME/.local/lib
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
NONINTERACTIVE: 1
run: |
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
python -m pip install --upgrade pip wheel setuptools nox
python -m pip install --upgrade pip nox
# Don't use Homebrew to install SUNDIALS because scikits.odes looks for
# in Homebrew folders instead, which we don't want
brew uninstall sundials --force
pip cache remove scikits.odes
python -m nox -s pybamm-requires -- --force
python -m nox -s unit
- name: Run integration tests for Windows and MacOS
- name: Run integration tests for M-series macOS runner
run: |
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
python -m nox -s integration
- name: Uninstall pyenv-virtualenv & python
- name: Uninstall pyenv-virtualenv & Python
if: always()
shell: bash
run: |
Expand All @@ -159,8 +186,18 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
# Include macOS M1 runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
# scikits.odes is not available on Python 3.12 yet
# See https://github.com/bmcage/odes/issues/162
# - os: macos-14
# python-version: "3.12"
fail-fast: false
name: Test pybamm_install_odes on ${{ matrix.os }}
name: Test pybamm_install_odes (${{ matrix.os }} / Python ${{ matrix.python-version }})

steps:
- name: Check out PyBaMM repository
Expand All @@ -172,7 +209,7 @@ jobs:
sudo apt-get update
sudo apt-get install gfortran gcc libopenblas-dev
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-latest' || matrix.os == 'macos-14'
env:
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
Expand Down
41 changes: 32 additions & 9 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ jobs:
exclude:
- os: ubuntu-latest
python-version: "3.11"
# Include macOS M1 runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"
name: Unit tests (${{ matrix.os }} / Python ${{ matrix.python-version }})

steps:
Expand All @@ -51,7 +59,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.3.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
if: matrix.os == 'ubuntu-latest'
with:
packages: gfortran gcc graphviz pandoc
Expand All @@ -66,7 +74,7 @@ jobs:
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-latest' || matrix.os == 'macos-14'
env:
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
Expand Down Expand Up @@ -108,6 +116,7 @@ jobs:
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 and macOS
timeout-minutes: 10
if: matrix.os != 'windows-latest'
run: python -m nox -s pybamm-requires

Expand All @@ -129,7 +138,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.3.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
with:
packages: gfortran gcc graphviz pandoc
execute_install_scripts: true
Expand Down Expand Up @@ -164,13 +173,16 @@ jobs:
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 unit tests for Ubuntu with Python 3.11 and generate coverage report
run: python -m nox -s coverage

- name: Upload coverage report
uses: codecov/[email protected]
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}

run_integration_tests:
needs: style
Expand All @@ -180,6 +192,14 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# Include macOS M1 runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"
name: Integration tests (${{ matrix.os }} / Python ${{ matrix.python-version }})

steps:
Expand All @@ -188,7 +208,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.3.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
if: matrix.os == 'ubuntu-latest'
with:
packages: gfortran gcc graphviz pandoc
Expand All @@ -203,7 +223,7 @@ jobs:
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-latest' || matrix.os == 'macos-14'
env:
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
Expand Down Expand Up @@ -245,6 +265,7 @@ jobs:
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 and macOS
timeout-minutes: 10
if: matrix.os != 'windows-latest'
run: python -m nox -s pybamm-requires

Expand All @@ -268,7 +289,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.3.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
with:
packages: graphviz pandoc
execute_install_scripts: true
Expand Down Expand Up @@ -310,7 +331,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.3.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
with:
packages: gfortran gcc graphviz pandoc
execute_install_scripts: true
Expand Down Expand Up @@ -345,6 +366,7 @@ jobs:
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 notebooks tests for GNU/Linux with Python 3.12
Expand All @@ -364,7 +386,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.3.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
with:
packages: gfortran gcc graphviz
execute_install_scripts: true
Expand Down Expand Up @@ -399,6 +421,7 @@ jobs:
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
Expand Down
Loading

0 comments on commit eeceaa7

Please sign in to comment.