Skip to content

release

release #109

Workflow file for this run

# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: release
# generating and publishing release package artifacts from the main branch
on:
workflow_dispatch:
inputs:
test_py:
description: 'Publish package to test PY Repository'
required: true
default: 'true'
main_py:
description: 'Publish package to main PY Repository'
required: true
default: 'false'
jobs:
packaging:
if: github.repository == 'Project-MONAI/MONAILabel'
runs-on: ubuntu-latest
env:
MONAI_ZOO_AUTH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Cache for pip
uses: actions/cache@v4
id: cache
with:
path: |
~/.cache/pip
~/.cache/torch
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
- name: Install dependencies
run: |
sudo apt-get install openslide-tools -y
python -m pip install --user --upgrade pip setuptools wheel
python -m pip install torch>=1.7 torchvision
- name: Build Package
run: |
rm -rf /opt/hostedtoolcache
./runtests.sh --clean
BUILD_OHIF=true python setup.py sdist bdist_wheel --build-number $(date +'%Y%m%d%H%M')
ls -l dist
- name: Verify Package
run: |
tmp_dir=$(mktemp -d)
cp dist/monailabel* "$tmp_dir"
rm -r build monailabel*.egg-info
# install from wheel
python -m pip install "$tmp_dir"/monailabel*.whl
python -c 'import monailabel; monailabel.print_config()' 2>&1 | grep -iv "unknown"
python -c 'import monailabel; print(monailabel.__file__)'
# install test utilities
python -m pip install pytest
# start the monailabel server in the background and run the integration tests
./runtests.sh --net
# cleanup
python -m pip uninstall -y monailabel
rm -r "$tmp_dir"
env:
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
- name: Check artifacts
run: |
rm dist/monai*.tar.gz
- name: Publish distribution to Test PyPI
if: ${{ github.event.inputs.test_py == 'true' }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
if: ${{ github.event.inputs.main_py == 'true' }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_TOKEN }}