From 153f68a74dae03e0ca821d0f4816d4efd2e023f7 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 25 Apr 2024 22:03:29 +0530 Subject: [PATCH 01/10] Include `macos-13`, `macos-14` runners on PRs --- .github/workflows/test_on_push.yaml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/test_on_push.yaml b/.github/workflows/test_on_push.yaml index 1662fa81d..ca86b9f44 100644 --- a/.github/workflows/test_on_push.yaml +++ b/.github/workflows/test_on_push.yaml @@ -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 }}) From b0873c64f637db2ed9ede96a257d772c4dd945ac Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 25 Apr 2024 22:04:17 +0530 Subject: [PATCH 02/10] Add macOS arm runners to matrix config --- scripts/ci/build_matrix.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/ci/build_matrix.sh b/scripts/ci/build_matrix.sh index 9dccd5085..9dfe32249 100755 --- a/scripts/ci/build_matrix.sh +++ b/scripts/ci/build_matrix.sh @@ -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 " " -)) @@ -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 . From 4a25da6582926fec2c922b5f0b9fc846e10e7bb6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:05:53 +0000 Subject: [PATCH 03/10] chore: update pre-commit hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.1 → v0.4.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.1...v0.4.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea62f0608..5c95a3db5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.1" + rev: "v0.4.2" hooks: - id: ruff args: [--fix, --show-fixes] From 5a10cd82b6f3bfa3c092f30f36b26e4585c6326e Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 1 May 2024 19:46:10 +0530 Subject: [PATCH 04/10] Fall back to `virtualenv` if `nox[uv]` not present --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 4bfe6e46b..455e3ff27 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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 From 7c8ca73a733bfbdcb80e4ba7c98ad6b69d8eaac9 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 1 May 2024 19:52:35 +0530 Subject: [PATCH 05/10] Replace `nox[uv]` with quotes --- .github/workflows/scheduled_tests.yaml | 4 ++-- .github/workflows/test_on_push.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index 9cd68e622..4bdd3da4a 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -82,7 +82,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 @@ -117,7 +117,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 diff --git a/.github/workflows/test_on_push.yaml b/.github/workflows/test_on_push.yaml index ca86b9f44..ff712c085 100644 --- a/.github/workflows/test_on_push.yaml +++ b/.github/workflows/test_on_push.yaml @@ -74,7 +74,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: Unit tests run: | @@ -99,7 +99,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: Run examples run: | From 372a8350f07a30a6135bf0a6b9f619c351861da1 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 1 May 2024 19:53:56 +0530 Subject: [PATCH 06/10] Specify correct jobs for inclusion in schedule --- .github/workflows/scheduled_tests.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index 4bdd3da4a..200f06486 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -64,7 +64,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: @@ -92,6 +92,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] From b59ced9a9f368da667e25466818a85dfa5376c7a Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 1 May 2024 19:54:48 +0530 Subject: [PATCH 07/10] Add a two-pass filter for the self-hosted runner --- .github/workflows/scheduled_tests.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index 200f06486..a81f4e8cb 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -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 }} @@ -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 From 3ddcb9536caec4abd57d664fb5805b7140521ff0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 18:00:30 +0000 Subject: [PATCH 08/10] chore: update pre-commit hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.2 → v0.4.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.2...v0.4.3) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c95a3db5..9490c6f1e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.2" + rev: "v0.4.3" hooks: - id: ruff args: [--fix, --show-fixes] From 8be2b6b0ded08679cf548255a0a2ff738f0f15ab Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 8 May 2024 02:02:56 +0530 Subject: [PATCH 09/10] Remove quotes from `pip install` command args --- .github/workflows/scheduled_tests.yaml | 4 ++-- .github/workflows/test_on_push.yaml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index a81f4e8cb..1ef242e2a 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -88,7 +88,7 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade "pip" "nox[uv]" + python -m pip install --upgrade pip nox[uv] - name: Unit tests with nox run: python -m nox -s coverage @@ -125,7 +125,7 @@ jobs: run: | eval "$(pyenv init -)" pyenv activate pybop-${{ matrix.python_version }}-${{ matrix.pybamm_version }} - python -m pip install --upgrade "pip" "nox[uv]" + python -m pip install --upgrade pip nox[uv] python -m nox -s coverage python -m nox -s examples diff --git a/.github/workflows/test_on_push.yaml b/.github/workflows/test_on_push.yaml index ff712c085..9885ac130 100644 --- a/.github/workflows/test_on_push.yaml +++ b/.github/workflows/test_on_push.yaml @@ -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: | @@ -74,7 +74,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: Unit tests run: | @@ -99,7 +99,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: Run examples run: | @@ -125,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 From ef265db69a364e2ec538969e1f0381a4402d71fe Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 8 May 2024 02:04:37 +0530 Subject: [PATCH 10/10] Update CHANGELOG for #308 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7901de60a..21a72551d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. @@ -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.