Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable testing on both macOS amd64 and macOS arm64 #308

Merged
22 changes: 15 additions & 7 deletions .github/workflows/scheduled_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ jobs:
outputs:
pybop_matrix: ${{ steps.set-matrix.outputs.matrix }}

# filter the matrix to only include the macOS-latest entries
# Filter the matrix to only include Python and PyBaMM versions. This job
# is used for the self-hosted macOS-14 (arm64) runner at this time.
filter_pybamm_matrix:
name: Filter the matrix for macOS-latest entries
name: Filter the matrix for OS and Python version
needs: [create_pybamm_matrix]
if: github.repository == 'pybop-team/PyBOP'
runs-on: ubuntu-latest
outputs:
filtered_pybop_matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand All @@ -53,8 +55,12 @@ jobs:
matrix_json = '${{ needs.create_pybamm_matrix.outputs.pybop_matrix }}'
matrix = json.loads(matrix_json)

# Filter the matrix for macOS-latest entries only
filtered_entries = [entry for entry in matrix['include'] if entry['os'] == 'macos-latest']
# Filter the matrix to include just the Python version and PyBaMM version
# First filter the matrix to only include macOS-14 entries
filtered_entries = [entry for entry in matrix['include'] if entry['os'] == 'macos-14']
# Then remove the os key from the entries
for entry in filtered_entries:
entry.pop('os')
filtered_matrix = {'include': filtered_entries}

# Set the output variable for other jobs to use
Expand All @@ -64,7 +70,7 @@ jobs:
shell: python

build:
needs: [create_pybamm_matrix, filter_pybamm_matrix]
needs: [create_pybamm_matrix]
name: Build (${{ matrix.os }}, Python ${{ matrix.python_version }}, PyBaMM ${{ matrix.pybamm_version }})
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -82,7 +88,7 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip nox
python -m pip install --upgrade pip nox[uv]

- name: Unit tests with nox
run: python -m nox -s coverage
Expand All @@ -92,6 +98,8 @@ jobs:

# M-series Mac Mini
build-apple-mseries:
# This job filters the matrix JSON created in build_matrix.sh to provide
# a matrix of only macOS-14 (arm64) entries
needs: [filter_pybamm_matrix]
name: Build (MacOS M-series, Python ${{ matrix.python_version }}, PyBaMM ${{ matrix.pybamm_version }})
runs-on: [self-hosted, macOS, ARM64]
Expand All @@ -117,7 +125,7 @@ jobs:
run: |
eval "$(pyenv init -)"
pyenv activate pybop-${{ matrix.python_version }}-${{ matrix.pybamm_version }}
python -m pip install --upgrade pip nox
python -m pip install --upgrade pip nox[uv]
python -m nox -s coverage
python -m nox -s examples

Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip "nox[uv]"
python -m pip install --upgrade pip nox[uv]

- name: Integration tests
run: |
Expand All @@ -58,19 +58,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
python-version: ["3.9", "3.10", "3.11", "3.12"]
exclude: # We run the coverage tests on Ubuntu with Python 3.12
- os: ubuntu-latest
python-version: "3.12"
# Include MacOS M-series 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 }})

Expand Down Expand Up @@ -133,8 +125,8 @@ jobs:
cache-dependency-path: setup.py

- name: Install dependencies
run: |
python -m pip install --upgrade pip "nox[uv]"
run: python -m pip install --upgrade pip nox[uv]

- name: Run coverage tests for Ubuntu with Python 3.12 and generate report
run: nox -s coverage

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

## Features


- [#301](https://github.com/pybop-team/PyBOP/pull/301) - Updates default echem solver to "fast with events" mode.
- [#251](https://github.com/pybop-team/PyBOP/pull/251) - Increment PyBaMM > v23.5, remove redundant tests within integration tests, increment citation version, fix examples with incorrect model definitions.
- [#285](https://github.com/pybop-team/PyBOP/pull/285) - Drop support for Python 3.8.
Expand All @@ -18,6 +17,7 @@ codesigned binaries and source distributions via `sigstore-python`.

## Bug Fixes

- [#308](https://github.com/pybop-team/PyBOP/pull/308) - Enables testing on both macOS Intel and macOS ARM (Silicon) runners and fixes the scheduled tests.
- [#299](https://github.com/pybop-team/PyBOP/pull/299) - Bugfix multiprocessing support for Linux, MacOS, Windows (WSL) and improves coverage.
- [#270](https://github.com/pybop-team/PyBOP/pull/270) - Updates PR template.
- [#91](https://github.com/pybop-team/PyBOP/issues/91) - Adds a check on the number of parameters for CMAES and makes XNES the default optimiser.
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# nox options
nox.options.reuse_existing_virtualenvs = True
nox.options.force_venv_backend = "uv"
nox.options.force_venv_backend = "uv|virtualenv"
nox.needs_version = ">=2024.4.15"

# Environment variables to control CI behaviour for nox sessions
Expand Down
5 changes: 2 additions & 3 deletions scripts/ci/build_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# scheduled/nightly builds for PyBOP, i.e., in scheduled_tests.yaml
# It generates a matrix of all combinations of the following variables:
# - python_version: 3.X
# - os: ubuntu-latest, windows-latest, macos-latest
# - os: ubuntu-latest, windows-latest, macos-13 (amd64), macos-14 (arm64)
# - pybamm_version: the last X versions of PyBaMM from PyPI, excluding release candidates

# To update the matrix, the variables below can be modified as needed.

python_version=("3.9" "3.10" "3.11" "3.12")
os=("ubuntu-latest" "windows-latest" "macos-latest")
os=("ubuntu-latest" "windows-latest" "macos-13" "macos-14")
# This command fetches the last two PyBaMM versions excluding release candidates from PyPI
pybamm_version=($(curl -s https://pypi.org/pypi/pybamm/json | jq -r '.releases | keys[]' | grep -v rc | tail -n 2 | paste -sd " " -))

Expand Down Expand Up @@ -41,7 +41,6 @@ json+='
}'

# Filter out incompatible combinations
json=$(echo "$json" | jq -c 'del(.include[] | select(.pybamm_version == "23.5" and .python_version == "3.12"))')
json=$(echo "$json" | jq -c 'del(.include[] | select(.pybamm_version == "23.9" and .python_version == "3.12"))')

echo "$json" | jq -c .
Loading