Skip to content

Commit

Permalink
Merge branch 'develop' into docker-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
arjxn-py committed Sep 21, 2023
2 parents c15f96f + 2eb5c59 commit e515c26
Show file tree
Hide file tree
Showing 103 changed files with 5,957 additions and 2,620 deletions.
21 changes: 21 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,27 @@
"ideas",
"bug"
]
},
{
"login": "bobonice",
"name": "bobonice",
"avatar_url": "https://avatars.githubusercontent.com/u/22030806?v=4",
"profile": "https://github.com/bobonice",
"contributions": [
"bug",
"code"
]
},
{
"login": "kratman",
"name": "Eric G. Kratz",
"avatar_url": "https://avatars.githubusercontent.com/u/10170302?v=4",
"profile": "https://github.com/kratman",
"contributions": [
"doc",
"infra",
"bug"
]
}
],
"contributorsPerLine": 7,
Expand Down
14 changes: 0 additions & 14 deletions .github/release_checklist.md

This file was deleted.

9 changes: 9 additions & 0 deletions .github/release_reminder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Create {{ date | date('YY.MM') }} (final or rc0) release
---
Quarterly reminder to create a -

1. pre-release if the month has just started.
2. non-pre-release if the month is about to end (**before the end of the month**).

See [Release Workflow](./release_workflow.md) for more information.
74 changes: 74 additions & 0 deletions .github/release_workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Release workflow

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

## rc0 releases (automated)

1. The `update_version.yml` workflow will run on every 1st of January, May and September, updating incrementing the version to `YY.MMrc0` by running `scripts/update_version.py` in the following files -

- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to a new branch `YY.MM`.

2. Create a new GitHub _pre-release_ with the tag `YY.MMrc0` from the `YY.MM` branch and a description copied from `CHANGELOG.md`.

3. This release will automatically trigger `publish_pypi.yml` and create a _pre-release_ on PyPI.

## rcX releases (manual)

If a new release candidate is required after the release of `rc0` -

1. Fix a bug in `YY.MM` (no new features should be added to `YY.MM` once `rc0` is released) and `develop` individually.

2. Run `update_version.yml` manually while using `append_to_tag` to specify the release candidate version number (`rc1`, `rc2`, ...).

3. This will increment the version to `YY.MMrcX` by running `scripts/update_version.py` in the following files -

- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to the existing branch `YY.MM`.

4. Create a new GitHub _pre-release_ with the same tag (`YY.MMrcX`) from the `YY.MM` branch and a description copied from `CHANGELOG.md`.

5. This release will automatically trigger `publish_pypi.yml` and create a _pre-release_ on PyPI.

## Actual release (manual)

Once satisfied with the release candidates -

1. Run `update_version.yml` manually, leaving the `append_to_tag` field blank ("") for an actual release.

2. This will increment the version to `YY.MMrcX` by running `scripts/update_version.py` in the following files -

- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to the existing branch `YY.MM`.

3. Next, a PR from `YY.MM` to `main` will be generated that should be merged once all the tests pass.

4. Create a new GitHub _release_ with the same tag from the `main` branch and a description copied from `CHANGELOG.md`.

5. This release will automatically trigger `publish_pypi.yml` and create a _release_ on PyPI.

## Other checks

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
50 changes: 0 additions & 50 deletions .github/workflows/create_release.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/lychee_url_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
--accept 200,429
--exclude-path ./CHANGELOG.md
--exclude-path ./scripts/update_version.py
--exclude-path docs/conf.py
'./**/*.rst'
'./**/*.md'
'./**/*.py'
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Build and publish package to PyPI

on:
push:
branches: main
release:
types: [published]
workflow_dispatch:
inputs:
target:
description: 'Deployment target. Can be "pypi" or "testpypi"'
default: "pypi"
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

jobs:
build_windows_wheels:
Expand Down Expand Up @@ -130,15 +130,12 @@ jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: 3.8

- name: Install dependencies
run: pip install wheel
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/release_reminder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create a release reminder

on:
schedule:
# Run at 10 am UTC on days-of-month 1 and 28 in January, May, and September.
- cron: "0 10 1,28 1,5,9 *"

permissions:
contents: read
issues: write

jobs:
remind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/release_reminder.md
4 changes: 4 additions & 0 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: nox -s examples

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

#M-series Mac Mini
build-apple-mseries:
needs: style
Expand Down
68 changes: 45 additions & 23 deletions .github/workflows/update_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,73 @@ name: Update version

on:
workflow_dispatch:
inputs:
append_to_tag:
description: 'Leave blank for an actual release or "rc1", "rc2", ..., for release candidates."'
default: ""
schedule:
# Run at 10 am UTC on day-of-month 1 in January, May, and September.
- cron: "0 10 1 1,5,9 *"

jobs:
update-version:
# This workflow is only of value to PyBaMM and would always be skipped in forks
if: github.repository_owner == 'pybamm-team'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- name: Get current date for the first release candidate
if: github.event_name == 'schedule'
run: |
echo "VERSION=$(date +'v%y.%-m')rc0" >> $GITHUB_ENV
echo "NON_RC_VERSION=$(date +'v%y.%-m')" >> $GITHUB_ENV
- name: Get current date for a manual release
if: github.event_name == 'workflow_dispatch'
run: |
echo "VERSION=$(date +'v%y.%-m')${{ github.event.inputs.append_to_tag }}" >> $GITHUB_ENV
echo "NON_RC_VERSION=$(date +'v%y.%-m')" >> $GITHUB_ENV
- uses: actions/checkout@v4
if: github.event_name == 'schedule'
with:
ref: 'develop'

- uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
ref: '${{ env.NON_RC_VERSION }}'

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: 3.8

- name: Install dependencies
run: |
pip install wheel
pip install --editable .
- name: Get current date
run: echo "VERSION=$(date +'v%y.%-m')" >> $GITHUB_ENV
pip install --editable ".[all]"
- name: Update version
run: python scripts/update_version.py

- name: Create Pull Request
id: version_pr
uses: peter-evans/create-pull-request@v5
- uses: EndBug/add-and-commit@v9
if: github.event_name == 'schedule'
with:
delete-branch: true
branch-suffix: short-commit-hash
commit-message: Update version to ${{ env.VERSION }}
title: Update to ${{ env.VERSION }}
body: |
- [x] Update to ${{ env.VERSION }}
- [ ] Check the [release checklist](https://github.com/pybamm-team/PyBaMM/blob/develop/.github/release_checklist.md)
- name: Make a PR from develop to main
message: 'Bump to ${{ env.VERSION }}'
new_branch: '${{ env.NON_RC_VERSION }}'

- uses: EndBug/add-and-commit@v9
if: github.event_name == 'workflow_dispatch'
with:
message: 'Bump to ${{ env.VERSION }}'

- name: Make a PR from ${{ env.NON_RC_VERSION }} to main
if: github.event_name == 'workflow_dispatch' && !startsWith(github.event.inputs.append_to_tag, 'rc')
uses: repo-sync/pull-request@v2
with:
source_branch: '${{ env.NON_RC_VERSION }}'
destination_branch: "main"
pr_title: "Make release ${{ env.VERSION }}"
pr_body: "**DO NOT MERGE UNTIL #${{ steps.version_pr.outputs.pull-request-number }} IS MERGED.**<br><br>Make release ${{ env.VERSION }}"
pr_title: "Make release ${{ env.NON_RC_VERSION }}"
pr_body: "**Check the [release workflow](https://github.com/pybamm-team/PyBaMM/blob/develop/.github/release_workflow.md)**"
github_token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.284"
rev: "v0.0.290"
hooks:
- id: ruff
args: [--fix, --ignore=E741, --exclude=__init__.py]
Expand All @@ -17,7 +17,7 @@ repos:
args: ["--fix","--ignore=E501,E402"]

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.15.0"
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==22.12.0]
Expand Down
Loading

0 comments on commit e515c26

Please sign in to comment.