added a top button because of file length (#8163) #2734
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
# Jenkinsfile.monai-postmerge | |
name: deploy | |
on: | |
# full tests for all the important branches | |
push: | |
branches: | |
- main | |
- releasing/* | |
- feature/* | |
- dev | |
concurrency: | |
# automatically cancel the previously triggered workflows when there's a newer version | |
group: deploy-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# caching of these jobs: | |
# - docker-py3-pip- (shared) | |
# - ubuntu 37 38 39 310-pip- | |
# - os-latest-pip (shared) | |
coverage-py3: | |
# if: github.repository == 'Project-MONAI/MONAI' | |
if: ${{ false }} # disable self-hosted job project-monai/monai#7039 | |
container: | |
image: nvcr.io/nvidia/pytorch:22.04-py3 | |
options: --gpus all | |
runs-on: [self-hosted, linux, x64, integration] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache weekly timestamp | |
id: pip-cache | |
run: | | |
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT | |
- name: cache for pip | |
if: ${{ startsWith(github.ref, 'refs/heads/dev') }} | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/torch | |
key: docker-py3-pip-${{ steps.pip-cache.outputs.datew }} | |
- name: Install the dependencies | |
run: | | |
which python | |
python -m pip install --upgrade pip wheel | |
python -m pip install --upgrade torch torchvision | |
python -m pip install -r requirements-dev.txt | |
- name: Run unit tests report coverage | |
env: | |
NGC_API_KEY: ${{ secrets.NGC_API_KEY }} | |
NGC_ORG: ${{ secrets.NGC_ORG }} | |
NGC_TEAM: ${{ secrets.NGC_TEAM }} | |
run: | | |
python -m pip list | |
git config --global --add safe.directory /__w/MONAI/MONAI | |
git clean -ffdx | |
df -h | |
# python -m pip cache info | |
nvidia-smi | |
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils | tail -n 1) | |
echo $CUDA_VISIBLE_DEVICES | |
trap 'if pgrep python; then pkill python; fi;' ERR | |
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null & | |
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))" | |
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))' | |
BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report | |
BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report | |
coverage xml --ignore-errors | |
if pgrep python; then pkill python; fi | |
shell: bash | |
- name: Upload coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
files: ./coverage.xml | |
test-py3x: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: cache weekly timestamp | |
id: pip-cache | |
run: | | |
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT | |
- name: cache for pip | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/torch | |
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ steps.pip-cache.outputs.datew }} | |
- name: Install the dependencies | |
run: | | |
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; | |
python -m pip install --upgrade pip wheel | |
python -m pip install -r requirements-dev.txt | |
- name: Run quick tests CPU ubuntu | |
env: | |
NGC_API_KEY: ${{ secrets.NGC_API_KEY }} | |
NGC_ORG: ${{ secrets.NGC_ORG }} | |
NGC_TEAM: ${{ secrets.NGC_TEAM }} | |
run: | | |
python -m pip list | |
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' | |
BUILD_MONAI=0 ./runtests.sh --build --quick --unittests | |
BUILD_MONAI=1 ./runtests.sh --build --quick --min | |
coverage xml --ignore-errors | |
- name: Upload coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
files: ./coverage.xml | |
install: # pip install from github url, the default branch is dev | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: cache weekly timestamp | |
id: pip-cache | |
run: | | |
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT | |
- 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 the default branch no build (dev branch only) | |
if: github.ref == 'refs/heads/dev' | |
run: | | |
BUILD_MONAI=0 pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI | |
python -c 'import monai; monai.config.print_config()' | |
cd $(python -c 'import monai; import os; print(os.path.dirname(monai.__file__))') | |
ls . | |
pip uninstall -y monai | |
- name: Install the default branch with build (dev branch only) | |
if: github.ref == 'refs/heads/dev' | |
run: | | |
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; | |
BUILD_MONAI=1 pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI | |
python -c 'import monai; monai.config.print_config()' | |
- name: Get the test cases (dev branch only) | |
if: github.ref == 'refs/heads/dev' | |
uses: actions/checkout@v4 | |
with: | |
ref: dev | |
- name: Quick test installed (dev branch only) | |
if: github.ref == 'refs/heads/dev' | |
run: | | |
cd $GITHUB_WORKSPACE | |
rm -rf monai/ | |
ls -al . | |
python -m pip install -r requirements-min.txt | |
python -m tests.min_tests | |
env: | |
QUICKTEST: True |