Skip to content

Commit 040c384

Browse files
authored
Prepare v0.11.2 and automate the release process (#292)
## Overview Changes: * Prepared release v0.11.2. * Added a GitHub Workflow to automatically bump the version number, and another to create tags from the version bumping process. * Added a pre-commit hook for validating the ReadTheDocs configuration and GitHub Workflows.
2 parents 519207c + a1a09f2 commit 040c384

File tree

6 files changed

+124
-58
lines changed

6 files changed

+124
-58
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
44

5-
Please read the Birdhouse [Developer Guide](https://birdhouse.readthedocs.io/en/latest/dev_guide.html)
5+
Please read the Birdhouse [Developer Guide](https://birdhouse.readthedocs.io/en/latest/guide_dev.html)
66
and the [Finch Documentation](https://finch.readthedocs.io/en/latest/) to get started.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Bump Version and Tag for Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bumpversion:
7+
description: "Bumpversion"
8+
required: true
9+
default: "patch"
10+
options:
11+
- "patch"
12+
- "minor"
13+
- "major"
14+
tag:
15+
description: "Tag"
16+
required: true
17+
default: "true"
18+
options:
19+
- "true"
20+
- "false"
21+
jobs:
22+
bump_patch_version:
23+
name: Bumpversion
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
with:
28+
persist-credentials: false
29+
- uses: actions/setup-python@v4
30+
with:
31+
python-version: "3.x"
32+
- name: Config Commit Bot
33+
run: |
34+
git config --local user.email "bumpversion[bot]@ouranos.ca"
35+
git config --local user.name "bumpversion[bot]"
36+
- name: Current Version
37+
run: |
38+
CURRENT_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
39+
echo "current_version=${CURRENT_VERSION}"
40+
- name: Bump Version
41+
run: |
42+
pip install bump2version
43+
echo "running `bump2version ${{ github.event.inputs.bumpversion }}`"
44+
NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
45+
echo "new_version=${NEW_VERSION}"
46+
- name: Tag Release
47+
if: ${{ github.event.inputs.tag == 'true' }}
48+
run: |
49+
VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
50+
git tag "v${VERSION}"
51+
- name: Push Changes
52+
uses: ad-m/github-push-action@master
53+
with:
54+
force: false
55+
github_token: ${{ secrets.BUMPVERSION_TOKEN }}
56+
branch: ${{ github.ref }}
57+
tags: true

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ repos:
7070
hooks:
7171
- id: blackdoc
7272
additional_dependencies: [ 'black==23.3.0' ]
73+
- repo: https://github.com/python-jsonschema/check-jsonschema
74+
rev: 0.23.3
75+
hooks:
76+
- id: check-github-workflows
77+
- id: check-readthedocs
7378
- repo: meta
7479
hooks:
7580
- id: check-hooks-apply

CHANGES.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
Changes
22
*******
33

4-
0.12.0 (unreleased)
4+
0.11.2 (2023-07-27)
55
===================
66
* Added a Docker-based testing suite to the GitHub Workflows.
77
* Added a wider range of Python versions to test against in the GitHub Workflows.
88
* Migrated conda-build action from mamba-org/provision-with-micromamba to mamba-org/setup-micromamba.
99
* Cleaned up the Dockerfile. Docker now pip-installs finch directly from the GitHub repository.
1010
* Finch now explicitly supports Python3.11.
1111
* Pinned Python below 3.12 on conda and removed pin on pint for ReadTheDocs builds.
12+
* Added a GitHub Workflow to bump the version number and to create tags from the version bumping process on dispatch.
13+
* Added a pre-commit hook for validating the ReadTheDocs configuration and GitHub Workflows.
14+
15+
0.11.1 (2023-06-19)
16+
===================
17+
* Update to xclim 0.43.0.
18+
* Added xclim yml module support:
19+
- Added humidex days above calculation via yml module.
20+
- Reimplmented streamflow indicators via yml module (adjust for xclim 0.41 breaking changes).
21+
* Fixed bug for CanDCS-U6 ensemble "26models" list.
22+
* Passing an empty string to `ensemble_percentiles` in ensemble processes will return the merged un-reduced ensemble. The different members are listed along the `realization` coordinates through raw names allowing for basic distinction between the input members.
1223

1324
0.11.0 (2023-06-13)
1425
===================
15-
* Added xclim yml module support
16-
* Added humidex days above calculation via yml module
17-
* Reimplmented streamflow indicators via yml module (adjust for xclim 0.41 breaking changes)
18-
* Fixed bug for CanDSC-U6 ensemble "26models" list
1926
* Fixed iter_local when depth > 0 to avoid all files to be considered twice
2027
* Revised documentation configuration on ReadTheDocs to leverage Anaconda (Mambaforge)
2128
* Minor adjustments to dependency configurations
22-
* Update to xclim 0.43.0.
23-
* Passing an empty string to `ensemble_percentiles` in ensemble processes will return the merged un-reduced ensemble. The different members are listed along the `realization` coordinates through raw names allowing for basic distinction between the input members.
2429
* Removed configuration elements handling from `finch start`. One can still pass custom config files, but all configuration defaults are handled by `finch/default.cfg` and the WSGI function. `jinja2` is not a dependency anymore.
2530

2631
0.10.0 (2022-11-04)

docs/source/dev_guide.rst

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@ Developer Guide
99

1010
.. WARNING:: To create new processes look at examples in Emu_.
1111

12+
.. _Emu: https://github.com/bird-house/emu
13+
1214
Building the docs
1315
-----------------
1416

1517
First install dependencies for the documentation:
1618

17-
.. code-block:: console
19+
.. code-block:: shell
1820
19-
$ make develop
21+
$ make develop
2022
2123
Run the Sphinx docs generator:
2224

23-
.. code-block:: console
25+
.. code-block:: shell
2426
25-
$ make docs
27+
$ make docs
2628
2729
.. _testing:
2830

@@ -33,75 +35,72 @@ Run tests using pytest_.
3335

3436
First activate the ``finch`` Conda environment and install ``pytest``.
3537

36-
.. code-block:: console
38+
.. code-block:: shell
3739
3840
$ source activate finch
3941
$ pip install -r requirements_dev.txt # if not already installed
40-
OR
42+
# or
4143
$ make develop
4244
4345
Run quick tests (skip slow and online):
4446

45-
.. code-block:: console
47+
.. code-block:: shell
4648
47-
$ pytest -m 'not slow and not online'"
49+
$ pytest -m 'not slow and not online'"
4850
4951
Run all tests:
5052
51-
.. code-block:: console
53+
.. code-block:: shell
5254
53-
$ pytest
55+
$ pytest
5456
5557
Check pep8:
5658
57-
.. code-block:: console
59+
.. code-block:: shell
5860
59-
$ flake8
61+
$ flake8
62+
63+
.. _pytest: https://docs.pytest.org/en/latest/
6064
6165
Run tests the lazy way
6266
----------------------
6367
6468
Do the same as above using the ``Makefile``.
6569
66-
.. code-block:: console
70+
.. code-block:: shell
6771
68-
$ make test
69-
$ make test-all
70-
$ make lint
72+
$ make test
73+
$ make test-all
74+
$ make lint
7175
72-
Prepare a release
73-
-----------------
76+
Updating the Conda environment
77+
------------------------------
7478
75-
Update the Conda specification file to build identical environments_ on a specific OS.
79+
To update the `conda` specification file for building identical environments_ on a specific operating system:
7680
77-
.. note:: You should run this on your target OS, in our case Linux.
81+
.. note:: You should perform this regularly within your Pull Requests on your target OS and architecture (64-bit Linux).
7882
7983
.. code-block:: console
8084
81-
$ conda env create -f environment.yml
82-
$ source activate finch
83-
$ make clean
84-
$ make install
85-
$ conda list -n finch --explicit > spec-file.txt
85+
$ conda env create -f environment.yml
86+
$ source activate finch
87+
$ make clean
88+
$ make install
89+
$ conda list -n finch --explicit > spec-file.txt
8690
8791
.. _environments: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#building-identical-conda-environments
8892
93+
Preparing Finch releases
94+
------------------------
8995
90-
Bump a new version
91-
------------------
92-
93-
Make a new version of Finch in the following steps:
96+
In order to prepare a new release version of Finch, perform the following steps in a new branch:
9497
95-
* Make sure everything is commit to GitHub.
96-
* Update ``CHANGES.rst`` with the next version.
97-
* Dry Run: ``bumpversion --dry-run --verbose --new-version 0.8.1 patch``
98-
* Do it: ``bumpversion --new-version 0.8.1 patch``
99-
* ... or: ``bumpversion --new-version 0.9.0 minor``
100-
* Push it: ``git push``
101-
* Push tag: ``git push --tags``
102-
103-
See the bumpversion_ documentation for details.
104-
105-
.. _bumpversion: https://pypi.org/project/bumpversion/
106-
.. _pytest: https://docs.pytest.org/en/latest/
107-
.. _Emu: https://github.com/bird-house/emu
98+
#. Update ``CHANGES.rst`` with the release notes for the next version.
99+
#. Push changes to GitHub.
100+
#. Open a Pull Request with an appropriate title and description. (e.g. "Prepare release v1.2.3")
101+
#. After merging changes to the main branch, click on the Actions tab and select the "Bump Version and Tag for Release" workflow.
102+
#. Adjust the information as needed ("Bump version": "patch" or "minor" or "major"; "Tag": "true" or "false") the "Run Workflow" button on the main branch.
103+
#. After the workflow has completed, the new version will be tagged and pushed to GitHub.
104+
#. Create a new release on GitHub using the newly tagged commit with the same version number as the tag:
105+
- The release title should be the same as the tag name.
106+
- The release description should be the same as the release notes in ``CHANGES.rst``.

setup.cfg

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[bumpversion]
22
current_version = 0.11.1
33
commit = True
4-
tag = True
4+
tag = False
55

66
[metadata]
77
description-file = README.rst
@@ -23,29 +23,29 @@ search = "version": "{current_version}",
2323
replace = "version": "{new_version}",
2424

2525
[tool:pytest]
26-
addopts =
26+
addopts =
2727
--strict
2828
--tb=native
2929
python_files = test_*.py
30-
markers =
30+
markers =
3131
online: mark test to need internet connection
3232
slow: mark test to be slow
3333

3434
[flake8]
3535
ignore = F401,E402,E203,W503
3636
max-line-length = 120
37-
exclude =
37+
exclude =
3838
.git
3939
__pycache__
4040
docs/source/conf.py
4141
build
4242
dist
4343
src
4444
tests
45-
rst-directives =
45+
rst-directives =
4646
bibliography
4747
autolink-skip
48-
rst-roles =
48+
rst-roles =
4949
doc
5050
mod
5151
py:attr
@@ -64,7 +64,7 @@ rst-roles =
6464
cite:p
6565
cite:t
6666
cite:ts
67-
extend-ignore =
67+
extend-ignore =
6868
RST399
6969
RST201
7070
RST203
@@ -75,7 +75,7 @@ extend-ignore =
7575
[pycodestyle]
7676
count = False
7777
exclude = docs/source/conf.py
78-
ignore =
78+
ignore =
7979
E226
8080
E402
8181
E501

0 commit comments

Comments
 (0)