weekly-preview #169
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: weekly-preview | |
on: | |
schedule: | |
- cron: "0 2 * * 0" # 02:00 of every Sunday | |
workflow_dispatch: | |
jobs: | |
packaging: | |
if: github.repository == 'Project-MONAI/MONAILabel' | |
runs-on: ubuntu-latest | |
env: | |
MONAI_ZOO_AUTH_TOKEN: ${{ github.token }} | |
DEV_RELEASE_VERSION: 0.5 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install setuptools | |
run: | | |
sudo apt-get install openslide-tools -y | |
python -m pip install --user --upgrade setuptools wheel | |
- name: Generate HEAD Commit Id | |
run: | | |
export HEAD_COMMIT_ID=$(git rev-parse HEAD) | |
sed -i 's/name\ =\ monailabel$/name\ =\ monailabel-weekly/g' setup.cfg | |
echo "__commit_id__ = \"$HEAD_COMMIT_ID\"" >> monailabel/__init__.py | |
git config --global user.name "CI Builder" | |
git config --global user.email "[email protected]" | |
git diff setup.cfg monailabel/__init__.py | |
git add setup.cfg monailabel/__init__.py | |
git commit -m "Weekly build at $HEAD_COMMIT_ID" | |
export YEAR_WEEK=$(date +'%y%U') | |
echo "Year week for tag is ${YEAR_WEEK}" | |
if ! [[ $YEAR_WEEK =~ ^[0-9]{4}$ ]] ; then echo "Wrong 'year week' format. Should be 4 digits."; exit 1 ; fi | |
git tag "$DEV_RELEASE_VERSION.dev${YEAR_WEEK}" | |
git log -1 | |
git tag --list | |
git describe --tags --dirty --always --long | |
- name: Build distribution | |
run: | | |
./runtests.sh --clean | |
BUILD_OHIF=true python setup.py sdist bdist_wheel | |
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-weekly | |
rm -r "$tmp_dir" | |
env: | |
shell: bash | |
- name: Check artifacts | |
run: | | |
rm dist/monai*.tar.gz | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.PYPI_WEEKLY_TOKEN }} |