Port MONAI Generative utils (#7134) #73
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
# this is the docker image releasing pipeline, pushing to https://hub.docker.com/r/projectmonai/monai | |
name: docker | |
# versioning: compute a static version file | |
# local_docker: use the version file to build docker images | |
# docker_test_latest: test the latest internal docker image (has flake) | |
# docker_test_dockerhub: test the latest dockerhub release (no flake) | |
on: | |
# dev only docker deployment and quick tests | |
push: | |
branches: | |
- dev | |
# Allows you to run this workflow manually from the Actions tab | |
# This is to trigger building/testing docker image from dev only. | |
workflow_dispatch: | |
jobs: | |
versioning_dev: | |
# compute versioning file from python setup.py | |
# upload as artifact | |
if: github.repository == 'Project-MONAI/MONAI' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# full history so that we can git describe | |
with: | |
ref: dev | |
fetch-depth: 0 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- shell: bash | |
run: | | |
git describe | |
python -m pip install -U pip wheel setuptools | |
python setup.py build | |
cat build/lib/monai/_version.py | |
- name: Upload version | |
uses: actions/upload-artifact@v3 | |
with: | |
name: _version.py | |
path: build/lib/monai/_version.py | |
- name: Clean up directory | |
shell: bash | |
run: | | |
ls -al | |
rm -rf {*,.[^.]*} | |
docker_build_dev: | |
# builds projectmonai/monai:latest | |
if: github.repository == 'Project-MONAI/MONAI' | |
needs: versioning_dev | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: dev | |
- name: Download version | |
uses: actions/download-artifact@v3 | |
with: | |
name: _version.py | |
- name: docker_build | |
shell: bash | |
run: | | |
rm -rf /opt/hostedtoolcache | |
docker --version | |
# get tag info for versioning | |
cat _version.py | |
mv _version.py monai/ | |
# build "latest": remove flake package as it is not needed on hub.docker.com | |
sed -i '/flake/d' requirements-dev.txt | |
docker build -t projectmonai/monai:latest -f Dockerfile . | |
# distribute as always w/ tag "latest" to hub.docker.com | |
echo "${{ secrets.DOCKER_PW }}" | docker login -u projectmonai --password-stdin | |
docker push projectmonai/monai:latest | |
docker logout | |
docker image prune -f | |
docker_test_dockerhub: | |
# if: github.repository == 'Project-MONAI/MONAI' | |
if: ${{ false }} # disable self-hosted job project-monai/monai#7039 | |
needs: docker_build_dev | |
container: | |
image: docker://projectmonai/monai:latest | |
options: "--shm-size=4g --ipc=host" | |
runs-on: [self-hosted, linux, X64, docker] | |
steps: | |
- name: Import | |
run: | | |
export OMP_NUM_THREADS=4 MKL_NUM_THREADS=4 CUDA_VISIBLE_DEVICES= # cpu-only | |
python -c 'import monai; monai.config.print_debug_info()' | |
cd /opt/monai | |
ls -al | |
ngc --version | |
./runtests.sh --min | |
shell: bash | |
env: | |
QUICKTEST: True |