Skip to content

Commit

Permalink
Merge branch 'develop' into serialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
pipliggins committed Nov 27, 2023
2 parents 92e7c90 + 6ece7a1 commit 95935a0
Show file tree
Hide file tree
Showing 48 changed files with 727 additions and 4,951 deletions.
9 changes: 4 additions & 5 deletions .github/release_workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ This file contains the workflow required to make a `PyBaMM` release on GitHub, P
- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `pyproject.toml`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to a new branch `vYY.MM` and a PR from `vvYY.MM` to `develop` will be created (to sync the branches).
Expand All @@ -32,8 +32,8 @@ If a new release candidate is required after the release of `rc0` -
- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `pyproject.toml`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to the existing `vYY.MM` branch and a PR from `vvYY.MM` to `develop` will be created (to sync the branches).
Expand All @@ -53,8 +53,8 @@ Once satisfied with the release candidates -
- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `pyproject.toml`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to the existing `vYY.MM` branch and a PR from `vvYY.MM` to `develop` will be created (to sync the branches).
Expand All @@ -70,8 +70,7 @@ Once satisfied with the release candidates -
Some other essential things to check throughout the release process -

- If updating our custom vcpkg registory entries [pybamm-team/sundials-vcpkg-registry](https://github.com/pybamm-team/sundials-vcpkg-registry) or [pybamm-team/casadi-vcpkg-registry](https://github.com/pybamm-team/casadi-vcpkg-registry) (used to build Windows wheels), make sure to update the baseline of the registories in vcpkg-configuration.json to the latest commit id.
- Update jax and jaxlib to the latest version in `pybamm.util` and `setup.py`, fixing any bugs that arise
- Make sure the URLs in `docs/_static/versions.json` are valid
- Update jax and jaxlib to the latest version in `pybamm.util` and `pyproject.toml`, fixing any bugs that arise
- As the release workflow is initiated by the `release` event, it's important to note that the default `GITHUB_REF` used by `actions/checkout` during the checkout process will correspond to the tag created during the release process. Consequently, the workflows will consistently build PyBaMM based on the commit associated with this tag. Should new commits be introduced to the `vYY.MM` branch, such as those addressing build issues, it becomes necessary to manually update this tag to point to the most recent commit -
```
git tag -f <tag_name> <commit_hash>
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lychee_url_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,18 @@ jobs:
--accept 200,429
--exclude-path ./CHANGELOG.md
--exclude-path ./scripts/update_version.py
--exclude-path asv.conf.json
--exclude-path docs/conf.py
'./**/*.rst'
'./**/*.md'
'./**/*.py'
'./**/*.ipynb'
'./**/*.json'
'./**/*.toml'
# fail the action on broken links
fail: true
jobSummary: true
format: markdown
env:
# to be used in case rate limits are surpassed
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
62 changes: 24 additions & 38 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Build and publish package to PyPI

on:
release:
types: [published]
Expand Down Expand Up @@ -27,22 +26,18 @@ jobs:
with:
python-version: 3.8

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.12.3

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

# remove when a new vcpkg version is released
- name: Install the latest commit of vcpkg on windows
- 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: Cache packages installed through vcpkg on windows
- name: Cache packages installed through vcpkg on Windows
uses: actions/cache@v3
env:
cache-name: vckpg_binary_cache
Expand All @@ -55,14 +50,13 @@ jobs:
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

- name: Build 64 bits wheels on Windows
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Build 64-bit wheels on Windows
run: pipx run cibuildwheel --output-dir wheelhouse
env:
CIBW_ENVIRONMENT: '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'
CIBW_ARCHS: "AMD64"

- name: Upload windows wheels
- name: Upload Windows wheels
uses: actions/upload-artifact@v3
with:
name: windows_wheels
Expand All @@ -82,42 +76,34 @@ jobs:
with:
python-version: 3.8

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.12.3

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

- name: Install SUNDIALS on macOS
# sometimes gfortran cannot be found, so reinstall gcc just to be sure
- name: Install SuiteSparse and SUNDIALS on macOS
if: matrix.os == 'macos-latest'
run: |
# https://github.com/actions/virtual-environments/issues/1280
rm -f /usr/local/bin/2to3*
rm -f /usr/local/bin/idle3*
rm -f /usr/local/bin/pydoc3*
rm -f /usr/local/bin/python3*
brew update
brew install graphviz openblas libomp
brew reinstall gcc
brew install libomp
python -m pip install cmake wget
python scripts/install_KLU_Sundials.py
- name: Build wheels on Linux and MacOS
run: python -m cibuildwheel --output-dir wheelhouse
- name: Build wheels on ${{ matrix.os }}
run: pipx run cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_BEFORE_ALL_LINUX: >
yum -y install openblas-devel lapack-devel &&
bash build_manylinux_wheels/install_sundials.sh 6.0.3 6.5.0
CIBW_BEFORE_BUILD_LINUX: "python -m pip install cmake casadi numpy"
bash scripts/install_sundials.sh 6.0.3 6.5.0
CIBW_BEFORE_BUILD_LINUX: >
python -m pip install cmake casadi numpy
# override; point to casadi install path so that it can be found by the repair command
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$(python -c 'import casadi; print(casadi.__path__[0])')" auditwheel repair -w {dest_dir} {wheel}
CIBW_BEFORE_BUILD_MACOS: >
python -m pip
install cmake casadi numpy &&
python scripts/fix_casadi_rpath_mac.py &&
scripts/fix_suitesparse_rpath_mac.sh
# got error "re.error: multiple repeat at position 104" on python 3.7 when --require-archs added, so remove
# it for mac
python scripts/fix_casadi_rpath_mac.py && scripts/fix_suitesparse_rpath_mac.sh
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
delocate-listdeps {wheel} &&
delocate-wheel -v -w {dest_dir} {wheel}
Expand All @@ -131,7 +117,7 @@ jobs:
if-no-files-found: error

build_sdist:
name: Build sdist
name: Build SDist
runs-on: ubuntu-latest

steps:
Expand All @@ -141,12 +127,12 @@ jobs:
python-version: 3.11

- name: Install dependencies
run: pip install --upgrade pip setuptools wheel build
run: pip install --upgrade pip setuptools wheel

- name: Build sdist
run: python -m build --sdist
- name: Build SDist
run: pipx run build --sdist

- name: Upload sdist
- name: Upload SDist
uses: actions/upload-artifact@v3
with:
name: sdist
Expand Down
67 changes: 27 additions & 40 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,19 @@ on:
schedule:
- cron: "0 3 * * *"

jobs:
pre_job:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: "never"
cancel_others: "true"
paths_ignore: '["**/README.md"]'
env:
FORCE_COLOR: 3

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:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -66,62 +61,54 @@ jobs:
sudo apt install gfortran gcc libopenblas-dev graphviz pandoc
sudo apt install texlive-full
# Added fixes to homebrew installs:
# rm -f /usr/local/bin/2to3
# (see https://github.com/actions/virtual-environments/issues/2322)
- name: Install MacOS system dependencies
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
run: |
rm -f /usr/local/bin/2to3*
rm -f /usr/local/bin/idle3*
rm -f /usr/local/bin/pydoc3*
rm -f /usr/local/bin/python3*
brew update
brew install graphviz
brew install openblas
brew analytics off
brew install graphviz openblas libomp
brew reinstall gcc
- name: Install Windows system dependencies
if: matrix.os == 'windows-latest'
run: choco install graphviz --version=2.38.0.20190211

- name: Install standard Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
- name: Install nox
run: python -m pip install nox

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

- name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10, and for macOS and Windows with all Python versions
if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest')
run: pipx run nox -s unit
run: python -m nox -s unit

- name: Run unit tests for GNU/Linux with Python 3.11 and generate coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
run: pipx run nox -s coverage
run: python -m nox -s coverage

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
uses: codecov/[email protected]

- name: Run integration tests
run: pipx run nox -s integration
run: python -m nox -s integration

- name: Install docs dependencies and run doctests
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s doctests
run: python -m nox -s doctests

- name: Check if the documentation can be built
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s docs
run: python -m nox -s docs

- name: Install dev dependencies and run example tests
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s examples
run: python -m nox -s examples

- name: Run example scripts tests
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s scripts
run: python -m nox -s scripts

#M-series Mac Mini
build-apple-mseries:
Expand Down
Loading

0 comments on commit 95935a0

Please sign in to comment.