Skip to content

Commit d123249

Browse files
authored
Merge pull request #245 from bgilbert/workflows
workflows: rename wheels GH artifact; fix archiving source tarball; cleanups
2 parents 5fab25f + fd39a83 commit d123249

File tree

2 files changed

+36
-25
lines changed

2 files changed

+36
-25
lines changed

.github/ISSUE_TEMPLATE/release.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
- [ ] Update `CHANGELOG.md` and version in `openslide/_version.py`
44
- [ ] Create and push signed tag
55
- [ ] `git clean -dxf && mkdir dist`
6-
- [ ] Find the [workflow run](https://github.com/openslide/openslide-python/actions) for the tag; download its docs and wheels artifacts
7-
- [ ] `unzip /path/to/downloaded/openslide-python-wheels.zip && mv openslide-python-wheels-*/* dist/`
6+
- [ ] Find the [workflow run](https://github.com/openslide/openslide-python/actions/workflows/python.yml) for the tag; download its dist and docs artifacts
7+
- [ ] `unzip /path/to/downloaded/openslide-python-dist.zip && mv openslide-python-dist-*/* dist/`
88
- [ ] `twine upload dist/*`
99
- [ ] Recompress tarball with `xz`
1010
- [ ] Attach release notes to [GitHub release](https://github.com/openslide/openslide-python/releases/new); upload tarballs and wheels

.github/workflows/python.yml

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,25 @@ jobs:
1717
pre-commit:
1818
name: Rerun pre-commit checks
1919
runs-on: ubuntu-latest
20+
outputs:
21+
dist-base: ${{ steps.paths.outputs.dist }}
22+
docs-base: ${{ steps.paths.outputs.docs }}
2023
steps:
21-
- uses: actions/checkout@v4
22-
- uses: actions/setup-python@v4
24+
- name: Check out repo
25+
uses: actions/checkout@v4
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
2328
with:
2429
python-version: '3.12'
25-
- uses: pre-commit/[email protected]
30+
- name: Run pre-commit hooks
31+
uses: pre-commit/[email protected]
32+
- name: Define artifact paths
33+
id: paths
34+
run: |
35+
suffix="$GITHUB_RUN_NUMBER-$(echo $GITHUB_SHA | cut -c-10)"
36+
echo "dist=openslide-python-dist-$suffix" >> $GITHUB_OUTPUT
37+
echo "docs=openslide-python-docs-$suffix" >> $GITHUB_OUTPUT
38+
2639
tests:
2740
name: Tests
2841
needs: pre-commit
@@ -83,7 +96,7 @@ jobs:
8396
brew install openslide
8497
;;
8598
esac
86-
- name: Build wheel
99+
- name: Build dist
87100
run: |
88101
if [ -z "${{ matrix.sdist }}" ]; then
89102
wheel_only=-w
@@ -102,25 +115,27 @@ jobs:
102115
exit 1
103116
fi
104117
esac
105-
basename=openslide-python-wheels-$GITHUB_RUN_NUMBER-$(echo $GITHUB_SHA | cut -c-10)
106-
mkdir -p "artifacts/${basename}"
107-
mv dist/* "artifacts/${basename}"
108-
echo "basename=${basename}" >> $GITHUB_ENV
118+
mkdir -p "artifacts/${{ needs.pre-commit.outputs.dist-base }}"
119+
mv dist/* "artifacts/${{ needs.pre-commit.outputs.dist-base }}"
109120
# save version-specific wheels and oldest abi3 wheel
110121
python -c 'import sys
111122
if sys.version_info < (3, 12): print("archive_wheel=1")' >> $GITHUB_ENV
112123
- name: Install
113-
run: pip install artifacts/${basename}/*.whl
124+
run: pip install artifacts/${{ needs.pre-commit.outputs.dist-base }}/*.whl
114125
- name: Run tests
115126
run: pytest -v
116127
- name: Tile slide
117128
run: python examples/deepzoom/deepzoom_tile.py --viewer -o tiled tests/fixtures/small.svs
118-
- name: Archive wheel
119-
if: env.archive_wheel
129+
- name: Remove wheel from upload
130+
if: matrix.sdist && ! env.archive_wheel
131+
run: rm artifacts/${{ needs.pre-commit.outputs.dist-base }}/*.whl
132+
- name: Archive dist
133+
if: matrix.sdist || env.archive_wheel
120134
uses: actions/upload-artifact@v3
121135
with:
122-
name: ${{ env.basename }}
136+
name: ${{ needs.pre-commit.outputs.dist-base }}
123137
path: artifacts
138+
124139
windows:
125140
name: Windows
126141
needs: pre-commit
@@ -155,15 +170,13 @@ jobs:
155170
- name: Build wheel
156171
run: |
157172
python -m build -w
158-
basename=openslide-python-wheels-$GITHUB_RUN_NUMBER-$(echo $GITHUB_SHA | cut -c-10)
159-
mkdir -p "artifacts/${basename}"
160-
mv dist/*.whl "artifacts/${basename}"
161-
echo "basename=${basename}" >> $GITHUB_ENV
173+
mkdir -p "artifacts/${{ needs.pre-commit.outputs.dist-base }}"
174+
mv dist/*.whl "artifacts/${{ needs.pre-commit.outputs.dist-base }}"
162175
# save version-specific wheels and oldest abi3 wheel
163176
python -c 'import sys
164177
if sys.version_info < (3, 12): print("archive_wheel=1")' >> $GITHUB_ENV
165178
- name: Install
166-
run: pip install artifacts/${basename}/*.whl
179+
run: pip install artifacts/${{ needs.pre-commit.outputs.dist-base }}/*.whl
167180
- name: Run tests
168181
# Reads OPENSLIDE_PATH
169182
run: pytest -v
@@ -180,8 +193,9 @@ jobs:
180193
if: env.archive_wheel
181194
uses: actions/upload-artifact@v3
182195
with:
183-
name: ${{ env.basename }}
196+
name: ${{ needs.pre-commit.outputs.dist-base }}
184197
path: artifacts
198+
185199
docs:
186200
name: Docs
187201
needs: pre-commit
@@ -198,12 +212,9 @@ jobs:
198212
python -m pip install --upgrade pip
199213
pip install sphinx
200214
- name: Build
201-
run: |
202-
basename=openslide-python-docs-$GITHUB_RUN_NUMBER-$(echo $GITHUB_SHA | cut -c-10)
203-
sphinx-build -d doctrees doc artifact/${basename}
204-
echo "basename=${basename}" >> $GITHUB_ENV
215+
run: sphinx-build -d doctrees doc artifact/${{ needs.pre-commit.outputs.docs-base }}
205216
- name: Archive
206217
uses: actions/upload-artifact@v3
207218
with:
208-
name: ${{ env.basename }}
219+
name: ${{ needs.pre-commit.outputs.docs-base }}
209220
path: artifact

0 commit comments

Comments
 (0)