Skip to content

Commit 02f5468

Browse files
authored
Merge pull request #457 from bioimage-io/dev
Move release job to build workflow to release only after full tests
2 parents 5b8bd97 + 8ab48ea commit 02f5468

File tree

3 files changed

+68
-77
lines changed

3 files changed

+68
-77
lines changed

.github/workflows/build.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,68 @@ jobs:
257257
with:
258258
branch: gh-pages
259259
folder: dist
260+
261+
publish-pypi:
262+
name: Publish to PyPI
263+
needs: test
264+
if: github.ref == 'refs/heads/main'
265+
runs-on: ubuntu-latest
266+
steps:
267+
- name: Check out the repository
268+
uses: actions/checkout@v4
269+
with:
270+
fetch-depth: 2
271+
272+
- name: Set up Python
273+
uses: actions/setup-python@v5
274+
with:
275+
python-version: '3.13'
276+
- name: Upgrade pip
277+
run: |
278+
python -m pip install --upgrade pip
279+
pip --version
280+
pip install wheel .[tests]
281+
- name: run tests
282+
run: pytest --disable-pytest-warnings
283+
284+
- name: Check if there is a parent commit
285+
id: check-parent-commit
286+
run: |
287+
echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_OUTPUT
288+
289+
- name: Detect new version
290+
id: check-version
291+
if: steps.check-parent-commit.outputs.sha
292+
uses: salsify/[email protected]
293+
with:
294+
create-tag: false
295+
version-command: |
296+
bash -o pipefail -c "cat bioimageio/core/VERSION | jq -r '.version'"
297+
298+
- name: Push tag
299+
id: tag-version
300+
if: steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version
301+
uses: mathieudutour/[email protected]
302+
with:
303+
github_token: ${{ secrets.GITHUB_TOKEN }}
304+
custom_tag: ${{ steps.check-version.outputs.current-version }}
305+
306+
- name: Build package
307+
run: |
308+
python setup.py sdist bdist_wheel
309+
310+
- name: Publish package on PyPI
311+
if: steps.tag-version.outputs.new_tag
312+
uses: pypa/gh-action-pypi-publish@release/v1.10
313+
with:
314+
user: __token__
315+
password: "${{ secrets.PYPI_TOKEN }}"
316+
packages-dir: dist/
317+
verbose: true
318+
- name: Publish the release notes
319+
uses: release-drafter/[email protected]
320+
with:
321+
publish: "${{ steps.tag-version.outputs.new_tag != '' }}"
322+
tag: "${{ steps.tag-version.outputs.new_tag }}"
323+
env:
324+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/release.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@
5151
),
5252
"tensorflow": ["tensorflow", "keras>=2.15,<4"],
5353
"onnx": ["onnxruntime"],
54+
"tests": (test_deps := ["pytest"]), # minimal test requirements
5455
"dev": (
55-
pytorch_deps
56+
test_deps
57+
+ pytorch_deps
5658
+ [
5759
"black",
5860
"cellpose", # for model testing
@@ -67,7 +69,6 @@
6769
"pre-commit",
6870
"pyright==1.1.396",
6971
"pytest-cov",
70-
"pytest",
7172
"segment-anything", # for model testing
7273
"timm", # for model testing
7374
# "crick", # currently requires python<=3.9

0 commit comments

Comments
 (0)