Skip to content

Commit

Permalink
Merge branch 'develop' into random-seed-for-simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Nov 25, 2023
2 parents 2b86a0a + a463246 commit dfde5d0
Show file tree
Hide file tree
Showing 89 changed files with 1,079 additions and 4,814 deletions.
9 changes: 7 additions & 2 deletions .github/release_workflow.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release workflow

This file contains the workflow required to make a `PyBaMM` release on GitHub and PyPI by the maintainers.
This file contains the workflow required to make a `PyBaMM` release on GitHub, PyPI, and conda-forge by the maintainers.

## rc0 releases (automated)

Expand All @@ -9,6 +9,7 @@ This file contains the workflow required to make a `PyBaMM` release on GitHub an
- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `pyproject.toml`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`
Expand All @@ -32,6 +33,7 @@ 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`
Expand All @@ -53,6 +55,7 @@ Once satisfied with the release candidates -
- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `pyproject.toml`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`
Expand All @@ -70,10 +73,12 @@ 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
- Update jax and jaxlib to the latest version in `pybamm.util` and `pyproject.toml`, fixing any bugs that arise
- Make sure the URLs in `docs/_static/versions.json` are valid
- 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>
git push -f <pybamm-team/PyBaMM_remote_name> <tag_name> # can only be carried out by the maintainers
```
- If changes are made to the API, console scripts, entry points, new optional dependencies are added, support for major Python versions is dropped or added, or core project information and metadata are modified at the time of the release, make sure to update the `meta.yaml` file in the `recipe/` folder of the [conda-forge/pybamm-feedstock](https://github.com/conda-forge/pybamm-feedstock) repository accordingly by following the instructions in the [conda-forge documentation](https://conda-forge.org/docs/maintainer/updating_pkgs.html#updating-the-feedstock-repository) and re-rendering the recipe
- The conda-forge release workflow will automatically be triggered following a stable PyPI release, and the aforementioned updates should be carried out directly in the main repository by pushing changes to the automated PR created by the conda-forge-bot. A manual PR can also be created if the updates are not included in the automated PR for some reason. This manual PR **must** bump the build number in `meta.yaml` and **must** be from a personal fork of the repository.
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 dfde5d0

Please sign in to comment.