Skip to content

Commit 178a4fd

Browse files
committed
Automate release process with changelog and downstream test workflows
1 parent 69d4324 commit 178a4fd

3 files changed

Lines changed: 180 additions & 28 deletions

File tree

.github/ISSUE_TEMPLATE/release-checklist.md

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,17 @@ assignees: ''
1616

1717
**Before release**:
1818

19-
- [ ] Make sure that all pull requests which will be included in the release have been properly documented as changelog files in the [`changes/` directory](https://github.com/zarr-developers/zarr-python/tree/main/changes).
20-
- [ ] Run ``towncrier build --version x.y.z`` to create the changelog, and commit the result to `main`.
2119
- [ ] Check [SPEC 0](https://scientific-python.org/specs/spec-0000/#support-window) to see if the minimum supported version of Python or NumPy needs bumping.
22-
- [ ] Check to ensure that:
23-
- [ ] Deprecated workarounds/codes/tests are removed. Run `grep "# TODO" **/*.py` to find all potential TODOs.
24-
- [ ] All tests pass in the ["Tests" workflow](https://github.com/zarr-developers/zarr-python/actions/workflows/test.yml).
25-
- [ ] All tests pass in the ["GPU Tests" workflow](https://github.com/zarr-developers/zarr-python/actions/workflows/gpu_test.yml).
26-
- [ ] All tests pass in the ["Hypothesis" workflow](https://github.com/zarr-developers/zarr-python/actions/workflows/hypothesis.yaml).
27-
- [ ] Check that downstream libraries work well (maintainers can make executive decisions about whether all checks are required for this release).
28-
- [ ] numcodecs
29-
- [ ] Xarray (@jhamman @dcherian @TomNicholas)
30-
- Zarr's upstream compatibility is tested via the [Upstream Dev CI worklow](https://github.com/pydata/xarray/actions/workflows/upstream-dev-ci.yaml).
31-
- Click on the most recent workflow and check that the `upstream-dev` job has run and passed. `upstream-dev` is not run on all all workflow runs.
32-
- Check that the expected version of Zarr-Python was tested using the `Version Info` step of the `upstream-dev` job.
33-
- If testing on a branch other than `main` is needed, open a PR modifying https://github.com/pydata/xarray/blob/90ee30943aedba66a37856b2332a41264e288c20/ci/install-upstream-wheels.sh#L56 and add the `run-upstream` label.
34-
- [ ] Titiler.Xarray (@maxrjones)
35-
- [Modify dependencies](https://github.com/developmentseed/titiler/blob/main/src/titiler/xarray/pyproject.toml) for titiler.xarray.
36-
- Modify triggers for running [the test workflow](https://github.com/developmentseed/titiler/blob/61549f2de07b20cca8fb991cfcdc89b23e18ad05/.github/workflows/ci.yml#L5-L7).
37-
- Push the branch to the repository and check for the actions for any failures.
20+
- [ ] Verify that the latest CI workflows on `main` are passing: [Tests](https://github.com/zarr-developers/zarr-python/actions/workflows/test.yml), [GPU Tests](https://github.com/zarr-developers/zarr-python/actions/workflows/gpu_test.yml), [Hypothesis](https://github.com/zarr-developers/zarr-python/actions/workflows/hypothesis.yaml), [Docs](https://github.com/zarr-developers/zarr-python/actions/workflows/docs.yml), [Lint](https://github.com/zarr-developers/zarr-python/actions/workflows/lint.yml), [Wheels](https://github.com/zarr-developers/zarr-python/actions/workflows/releases.yml).
21+
- [ ] Run the ["Downstream" workflow](https://github.com/zarr-developers/zarr-python/actions/workflows/downstream.yml) and verify Xarray and numcodecs tests pass.
22+
- [ ] Run the ["Prepare release" workflow](https://github.com/zarr-developers/zarr-python/actions/workflows/prepare_release.yml) with the target version. This will build the changelog and open a release PR.
23+
- [ ] Review the release PR and verify the changelog in `docs/release-notes.md` looks correct.
24+
- [ ] Merge the release PR.
3825

3926
**Release**:
4027

41-
- [ ] Go to https://github.com/zarr-developers/zarr-python/releases.
42-
- [ ] Click "Draft a new release".
43-
- [ ] Choose a version number prefixed with a `v` (e.g. `v0.0.0`). For pre-releases, include the appropriate suffix (e.g. `v0.0.0a1` or `v0.0.0rc2`).
44-
- [ ] Set the target to `main`.
45-
- [ ] Set the description of the release to: `See release notes https://zarr.readthedocs.io/en/stable/release-notes.html#release-0-0-0`, replacing the correct version numbers. For pre-release versions, the URL should omit the pre-release suffix, e.g. "a1" or "rc1".
46-
- [ ] Click on "Generate release notes" to auto-fill the description.
47-
- [ ] Make a release by clicking the 'Publish Release' button, this will automatically create a tag too.
48-
- [ ] Verify that release workflows succeeded.
49-
- [ ] The latest version is correct on [PyPI](https://pypi.org/project/zarr/).
50-
- [ ] The stable version is correct on [ReadTheDocs](https://zarr.readthedocs.io/en/stable/).
28+
- [ ] [Draft a new GitHub Release](https://github.com/zarr-developers/zarr-python/releases/new) with tag `vX.Y.Z` targeting `main`. Use "Generate release notes" for the description.
29+
- [ ] Verify the release is published on [PyPI](https://pypi.org/project/zarr/) and [ReadTheDocs](https://zarr.readthedocs.io/en/stable/).
5130

5231
**After release**:
5332

.github/workflows/downstream.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Downstream
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
xarray:
15+
name: Xarray zarr backend tests
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Check out zarr-python
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: false
23+
24+
- name: Check out xarray
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
repository: pydata/xarray
28+
path: xarray
29+
persist-credentials: false
30+
31+
- name: Set up pixi
32+
uses: prefix-dev/setup-pixi@19eac09b398e3d0c747adc7921926a6d802df4da # v0.8.8
33+
with:
34+
manifest-path: xarray/pixi.toml
35+
36+
- name: Install zarr-python from branch
37+
working-directory: xarray
38+
run: pixi run -e test-py313 -- pip install --no-deps ..
39+
40+
- name: Show versions
41+
working-directory: xarray
42+
run: |
43+
pixi run -e test-py313 -- python -c "
44+
import zarr; print(f'zarr {zarr.__version__}')
45+
import xarray; print(f'xarray {xarray.__version__}')
46+
"
47+
48+
- name: Run xarray zarr backend tests
49+
working-directory: xarray
50+
run: |
51+
pixi run -e test-py313 -- python -m pytest -x --no-header -q \
52+
xarray/tests/test_backends.py -k zarr \
53+
xarray/tests/test_backends_api.py -k zarr \
54+
xarray/tests/test_backends_datatree.py -k zarr
55+
56+
numcodecs:
57+
name: numcodecs zarr3 codec tests
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Check out zarr-python
61+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
62+
with:
63+
fetch-depth: 0
64+
persist-credentials: false
65+
66+
- name: Check out numcodecs
67+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
68+
with:
69+
repository: zarr-developers/numcodecs
70+
path: numcodecs
71+
persist-credentials: false
72+
73+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
74+
with:
75+
python-version: '3.13'
76+
77+
- name: Install numcodecs with test-zarr-main group
78+
working-directory: numcodecs
79+
run: |
80+
pip install uv
81+
uv sync --group test-zarr-main
82+
83+
- name: Override zarr-python with branch version
84+
working-directory: numcodecs
85+
run: uv pip install --no-deps ..
86+
87+
- name: Show versions
88+
working-directory: numcodecs
89+
run: |
90+
uv run python -c "
91+
import zarr; print(f'zarr {zarr.__version__}')
92+
import numcodecs; print(f'numcodecs {numcodecs.__version__}')
93+
"
94+
95+
- name: Run numcodecs zarr3 tests
96+
working-directory: numcodecs
97+
run: uv run python -m pytest -x --no-header -q tests/test_zarr3.py
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Prepare release notes
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version notes (e.g. 3.2.0)'
8+
required: true
9+
type: string
10+
target_branch:
11+
description: 'Branch to target'
12+
required: false
13+
default: 'main'
14+
type: string
15+
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
jobs:
21+
prepare:
22+
name: Build changelog and open PR
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Validate inputs
26+
run: |
27+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-\.][a-zA-Z0-9]+)*$ ]]; then
28+
echo "::error::Invalid version format: '$VERSION'"
29+
exit 1
30+
fi
31+
if [[ ! "$TARGET_BRANCH" =~ ^[a-zA-Z0-9._/-]+$ ]]; then
32+
echo "::error::Invalid branch name: '$TARGET_BRANCH'"
33+
exit 1
34+
fi
35+
env:
36+
VERSION: ${{ inputs.version }}
37+
TARGET_BRANCH: ${{ inputs.target_branch }}
38+
39+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
40+
with:
41+
ref: ${{ inputs.target_branch }}
42+
fetch-depth: 0
43+
persist-credentials: false
44+
45+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
46+
with:
47+
python-version: '3.12'
48+
49+
- name: Install towncrier
50+
run: pip install towncrier
51+
52+
- name: Build changelog
53+
run: towncrier build --version "$VERSION" --yes
54+
env:
55+
VERSION: ${{ inputs.version }}
56+
57+
- name: Create pull request
58+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
59+
with:
60+
branch: release/v${{ inputs.version }}
61+
base: ${{ inputs.target_branch }}
62+
title: "Release v${{ inputs.version }}"
63+
body: |
64+
Automated release preparation for v${{ inputs.version }}.
65+
66+
This PR was generated by the "Prepare release" workflow. It includes:
67+
- Rendered changelog via `towncrier build --version ${{ inputs.version }}`
68+
- Removal of consumed changelog fragments from `changes/`
69+
70+
## Checklist
71+
72+
- [ ] Review the rendered changelog in `docs/release-notes.md`
73+
- [ ] Downstream tests pass (see [downstream workflow](https://github.com/zarr-developers/zarr-python/actions/workflows/downstream.yml))
74+
- [ ] Merge this PR, then [draft a GitHub Release](https://github.com/zarr-developers/zarr-python/releases/new) targeting `${{ inputs.target_branch }}` with tag `v${{ inputs.version }}`
75+
commit-message: "chore: build changelog for v${{ inputs.version }}"
76+
delete-branch: true

0 commit comments

Comments
 (0)