Skip to content

Commit de0154e

Browse files
authored
Merge pull request #252 from bgilbert/artifacts
workflows: update to artifacts v4
2 parents 47f2e7f + fa5c3d5 commit de0154e

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

.github/workflows/python.yml

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ jobs:
9090
run: |
9191
case "${{ matrix.os }}" in
9292
ubuntu-latest)
93+
echo OS_TAG=linux >> $GITHUB_ENV
9394
sudo apt-get install libopenslide0
9495
;;
9596
macos-latest)
97+
echo OS_TAG=macos >> $GITHUB_ENV
9698
brew install openslide
9799
;;
98100
esac
@@ -115,26 +117,35 @@ jobs:
115117
exit 1
116118
fi
117119
esac
118-
mkdir -p "artifacts/${{ needs.pre-commit.outputs.dist-base }}"
119-
mv dist/* "artifacts/${{ needs.pre-commit.outputs.dist-base }}"
120+
if [ -z "$wheel_only" ]; then
121+
mkdir -p "artifacts/src/${{ needs.pre-commit.outputs.dist-base }}"
122+
mv dist/*.tar.gz "artifacts/src/${{ needs.pre-commit.outputs.dist-base }}"
123+
fi
124+
mkdir -p "artifacts/whl/${{ needs.pre-commit.outputs.dist-base }}"
125+
mv dist/* "artifacts/whl/${{ needs.pre-commit.outputs.dist-base }}"
120126
# save version-specific wheels and oldest abi3 wheel
121127
python -c 'import sys
122128
if sys.version_info < (3, 12): print("archive_wheel=1")' >> $GITHUB_ENV
123129
- name: Install
124-
run: pip install artifacts/${{ needs.pre-commit.outputs.dist-base }}/*.whl
130+
run: pip install artifacts/whl/${{ needs.pre-commit.outputs.dist-base }}/*.whl
125131
- name: Run tests
126132
run: pytest -v
127133
- name: Tile slide
128134
run: python examples/deepzoom/deepzoom_tile.py --viewer -o tiled tests/fixtures/small.svs
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
134-
uses: actions/upload-artifact@v3
135+
- name: Archive sdist
136+
if: matrix.sdist
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: ${{ needs.pre-commit.outputs.dist-base }}-source
140+
path: artifacts/src
141+
compression-level: 0
142+
- name: Archive wheel
143+
if: env.archive_wheel
144+
uses: actions/upload-artifact@v4
135145
with:
136-
name: ${{ needs.pre-commit.outputs.dist-base }}
137-
path: artifacts
146+
name: ${{ needs.pre-commit.outputs.dist-base }}-${{ env.OS_TAG }}-${{ matrix.python-version }}
147+
path: artifacts/whl
148+
compression-level: 0
138149

139150
windows:
140151
name: Windows
@@ -170,13 +181,13 @@ jobs:
170181
- name: Build wheel
171182
run: |
172183
python -m build -w
173-
mkdir -p "artifacts/${{ needs.pre-commit.outputs.dist-base }}"
174-
mv dist/*.whl "artifacts/${{ needs.pre-commit.outputs.dist-base }}"
184+
mkdir -p "artifacts/whl/${{ needs.pre-commit.outputs.dist-base }}"
185+
mv dist/*.whl "artifacts/whl/${{ needs.pre-commit.outputs.dist-base }}"
175186
# save version-specific wheels and oldest abi3 wheel
176187
python -c 'import sys
177188
if sys.version_info < (3, 12): print("archive_wheel=1")' >> $GITHUB_ENV
178189
- name: Install
179-
run: pip install artifacts/${{ needs.pre-commit.outputs.dist-base }}/*.whl
190+
run: pip install artifacts/whl/${{ needs.pre-commit.outputs.dist-base }}/*.whl
180191
- name: Run tests
181192
# Reads OPENSLIDE_PATH
182193
run: pytest -v
@@ -191,10 +202,11 @@ jobs:
191202
run: python examples/deepzoom/deepzoom_tile.py --viewer -o tiled tests/fixtures/small.svs
192203
- name: Archive wheel
193204
if: env.archive_wheel
194-
uses: actions/upload-artifact@v3
205+
uses: actions/upload-artifact@v4
195206
with:
196-
name: ${{ needs.pre-commit.outputs.dist-base }}
197-
path: artifacts
207+
name: ${{ needs.pre-commit.outputs.dist-base }}-windows-${{ matrix.python-version }}
208+
path: artifacts/whl
209+
compression-level: 0
198210

199211
docs:
200212
name: Docs
@@ -214,7 +226,7 @@ jobs:
214226
- name: Build
215227
run: sphinx-build -d doctrees doc artifact/${{ needs.pre-commit.outputs.docs-base }}
216228
- name: Archive
217-
uses: actions/upload-artifact@v3
229+
uses: actions/upload-artifact@v4
218230
with:
219231
name: ${{ needs.pre-commit.outputs.docs-base }}
220232
path: artifact
@@ -233,9 +245,10 @@ jobs:
233245
id-token: write
234246
steps:
235247
- name: Download artifacts
236-
uses: actions/download-artifact@v3
248+
uses: actions/download-artifact@v4
237249
with:
238-
name: ${{ needs.pre-commit.outputs.dist-base }}
250+
pattern: "${{ needs.pre-commit.outputs.dist-base }}-*"
251+
merge-multiple: true
239252
- name: Release to PyPI
240253
uses: pypa/gh-action-pypi-publish@release/v1
241254
with:

0 commit comments

Comments
 (0)