Skip to content

Commit 63a518e

Browse files
Further CICD Cleanup (Project-MONAI#8867)
Fixes Project-MONAI#8864 Project-MONAI#8865. ### Description This PR cleans up the CI scripts a little more and removes the full-dep test for macOS (for being very slow) and pytype checking (for being very slow and now deprecated for later Python versions). Some other fixes were included to get failing jobs running. Further work to clean up the actions used for testing should be done. Coverage should be included in the PR so need to get Codecov to report again. The `setupapp.yml` should probably be consolidated into `cicd_tests.yml` with reduced duplication of steps. The `cron.yml`, `pythonapp-gpu.yml`, and `blossom-ci.yml` perhaps should be removed as deprecated actions. This also upgrades the download action version per dependabot, and adds `pytest` as a temporary dependency to get around a CuPy bug: Project-MONAI#8873 (comment) Also a future PR should drop PyTorch 2.8 support from the CI actions since version 2.12 is out now. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 0a8d945 commit 63a518e

13 files changed

Lines changed: 205 additions & 221 deletions

.github/workflows/cicd_tests.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
runs-on: ubuntu-latest
5757
strategy:
5858
matrix:
59-
opt: ["codeformat", "pytype", "mypy"]
59+
opt: ["codeformat", "mypy"] # "pytype" omitted for being essentially deprecated, see #8865
6060
steps:
6161
- name: Clean unused tools
6262
run: |
@@ -171,7 +171,7 @@ jobs:
171171
strategy:
172172
fail-fast: false
173173
matrix:
174-
os: [windows-latest, macOS-latest, ubuntu-latest]
174+
os: [windows-latest, ubuntu-latest] # macOS-latest omitted for now for being very slow, see #8864
175175
timeout-minutes: 120
176176
env:
177177
QUICKTEST: True
@@ -220,7 +220,6 @@ jobs:
220220
- name: Install the complete dependencies
221221
run: |
222222
python -m pip install --user --upgrade pip wheel pybind11 # TODO: pybind11 added for macOS, may not be needed
223-
#python -m pip install torch==${PYTORCH_VER1} torchvision==${TORCHVISION_VER1}
224223
cat "requirements-dev.txt"
225224
python -m pip install --no-build-isolation -r requirements-dev.txt
226225
python -m pip list
@@ -267,8 +266,8 @@ jobs:
267266
python -m pip install torch==${PYTORCH_VER1} torchvision --extra-index-url https://download.pytorch.org/whl/cpu
268267
- name: Check packages
269268
run: |
270-
pip uninstall monai
271-
pip list | grep -iv monai
269+
python -m pip uninstall -y monai
270+
python -m pip list | grep -iv monai
272271
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
273272
set -e
274273
@@ -306,12 +305,3 @@ jobs:
306305
python -m pip install ${name}[all] --extra-index-url https://download.pytorch.org/whl/cpu
307306
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
308307
python -c 'import monai; print(monai.__file__)'
309-
- name: Quick test
310-
working-directory: ${{ steps.mktemp.outputs.tmp_dir }}
311-
run: |
312-
# run min tests
313-
cp ${{ steps.root.outputs.pwd }}/requirements*.txt .
314-
cp -r ${{ steps.root.outputs.pwd }}/tests .
315-
ls -al
316-
python -m pip install --no-build-isolation -r requirements-dev.txt --extra-index-url https://download.pytorch.org/whl/cpu
317-
python -m unittest -v

.github/workflows/cron-ngc-bundle.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,18 @@ jobs:
2222
uses: actions/setup-python@v6
2323
with:
2424
python-version: '3.10'
25-
- name: cache weekly timestamp
26-
id: pip-cache
27-
run: echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
28-
- name: cache for pip
29-
uses: actions/cache@v5
30-
id: cache
31-
with:
32-
path: ~/.cache/pip
33-
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
25+
cache: pip
26+
- name: Install CPU PyTorch
27+
run: |
28+
python -m pip install torch==2.8.0 torchvision --extra-index-url https://download.pytorch.org/whl/cpu
3429
- name: Install dependencies
3530
run: |
3631
rm -rf /github/home/.cache/torch/hub/bundle/
37-
python -m pip install --upgrade pip wheel
38-
python -m pip install -r requirements-dev.txt
32+
python -m pip install --no-build-isolation --upgrade pip wheel wheel-stub
33+
python -m pip install --no-build-isolation -r requirements-dev.txt
3934
- name: Loading Bundles
4035
run: |
4136
# clean up temporary files
4237
$(pwd)/runtests.sh --build --clean
4338
# run tests
44-
python -m tests.ngc_bundle_download
39+
PYTHONPATH=. python -m unittest tests.bundle.test_bundle_download.TestNgcBundleDownload

.github/workflows/cron.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ jobs:
214214
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
215215
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
216216
ngc --version
217-
BUILD_MONAI=1 ./runtests.sh --build --coverage --pytype --unittests --disttests # unit tests with pytype checks, coverage report
217+
BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with pytype checks, coverage report
218218
BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report
219219
coverage xml --ignore-errors
220220
if pgrep python; then pkill python; fi

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
with:
5858
ref: dev
5959
- name: Download version
60-
uses: actions/download-artifact@v6
60+
uses: actions/download-artifact@v8
6161
with:
6262
name: _version.py
6363
- name: docker_build

.github/workflows/pythonapp-gpu.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Jenkinsfile.monai-premerge
22
name: premerge-gpu
33

4-
on:
5-
# quick tests for pull requests and the releasing branches
6-
push:
7-
branches:
8-
- main
9-
- releasing/*
10-
pull_request:
11-
types: [opened, synchronize, closed]
4+
# on:
5+
# # quick tests for pull requests and the releasing branches
6+
# push:
7+
# branches:
8+
# - main
9+
# - releasing/*
10+
# pull_request:
11+
# types: [opened, synchronize, closed]
1212

1313
concurrency:
1414
# automatically cancel the previously triggered workflows when there's a newer version

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: ['3.10', '3.11', '3.12']
16+
python-version: ['3.10', '3.11', '3.12', '3.13']
1717
steps:
1818
- uses: actions/checkout@v6
1919
with:
@@ -127,7 +127,7 @@ jobs:
127127
steps:
128128
- uses: actions/checkout@v6
129129
- name: Download version
130-
uses: actions/download-artifact@v6
130+
uses: actions/download-artifact@v8
131131
with:
132132
name: _version.py
133133
- name: Set tag

.github/workflows/setupapp.yml

Lines changed: 116 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ name: deploy
33

44
on:
55
# full tests for all the important branches
6-
push:
7-
branches:
8-
- main
9-
- releasing/*
10-
- feature/*
11-
- dev
6+
# push:
7+
# branches:
8+
# - main
9+
# - releasing/*
10+
# - feature/*
11+
# - dev
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
1215

1316
concurrency:
1417
# automatically cancel the previously triggered workflows when there's a newer version
@@ -20,98 +23,112 @@ jobs:
2023
# - docker-py3-pip- (shared)
2124
# - ubuntu 37 38 39 310-pip-
2225
# - os-latest-pip (shared)
23-
coverage-py3:
24-
# if: github.repository == 'Project-MONAI/MONAI'
25-
if: ${{ false }} # disable self-hosted job project-monai/monai#7039
26-
container:
27-
image: nvcr.io/nvidia/pytorch:22.04-py3
28-
options: --gpus all
29-
runs-on: [self-hosted, linux, x64, integration]
30-
steps:
31-
- uses: actions/checkout@v6
32-
- name: cache weekly timestamp
33-
id: pip-cache
34-
run: |
35-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
36-
- name: cache for pip
37-
if: ${{ startsWith(github.ref, 'refs/heads/dev') }}
38-
uses: actions/cache@v5
39-
id: cache
40-
with:
41-
path: |
42-
~/.cache/pip
43-
~/.cache/torch
44-
key: docker-py3-pip-${{ steps.pip-cache.outputs.datew }}
45-
- name: Install the dependencies
46-
run: |
47-
which python
48-
python -m pip install --upgrade pip wheel
49-
python -m pip install --upgrade torch torchvision
50-
python -m pip install -r requirements-dev.txt
51-
- name: Run unit tests report coverage
52-
env:
53-
NGC_API_KEY: ${{ secrets.NGC_API_KEY }}
54-
NGC_ORG: ${{ secrets.NGC_ORG }}
55-
NGC_TEAM: ${{ secrets.NGC_TEAM }}
56-
run: |
57-
python -m pip list
58-
git config --global --add safe.directory /__w/MONAI/MONAI
59-
git clean -ffdx
60-
df -h
61-
# python -m pip cache info
62-
nvidia-smi
63-
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils | tail -n 1)
64-
echo $CUDA_VISIBLE_DEVICES
65-
trap 'if pgrep python; then pkill python; fi;' ERR
66-
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 &
67-
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
68-
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
69-
BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report
70-
BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report
71-
coverage xml --ignore-errors
72-
if pgrep python; then pkill python; fi
73-
shell: bash
74-
- name: Upload coverage
75-
uses: codecov/codecov-action@v6
76-
with:
77-
fail_ci_if_error: false
78-
files: ./coverage.xml
7926

80-
test-py3x:
81-
runs-on: ubuntu-latest
82-
strategy:
83-
matrix:
84-
python-version: ['3.10', '3.11', '3.12']
85-
steps:
86-
- uses: actions/checkout@v6
87-
with:
88-
fetch-depth: 0
89-
- name: Set up Python ${{ matrix.python-version }}
90-
uses: actions/setup-python@v6
91-
with:
92-
python-version: ${{ matrix.python-version }}
93-
cache: pip
94-
- name: Install the dependencies
95-
run: |
96-
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
97-
python -m pip install --upgrade pip wheel
98-
python -m pip install --no-build-isolation -r requirements-dev.txt
99-
- name: Run quick tests CPU ubuntu
100-
env:
101-
NGC_API_KEY: ${{ secrets.NGC_API_KEY }}
102-
NGC_ORG: ${{ secrets.NGC_ORG }}
103-
NGC_TEAM: ${{ secrets.NGC_TEAM }}
104-
run: |
105-
python -m pip list
106-
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
107-
BUILD_MONAI=0 ./runtests.sh --build --coverage --quick --unittests
108-
BUILD_MONAI=1 ./runtests.sh --build --coverage --quick --min
109-
coverage xml --ignore-errors
110-
- name: Upload coverage
111-
uses: codecov/codecov-action@v6
112-
with:
113-
fail_ci_if_error: false
114-
files: ./coverage.xml
27+
# TODO: coverage should be re-enable at a future time in PRs as well as longer running jobs, ideally with GPU support
28+
29+
# coverage-py3:
30+
# # if: github.repository == 'Project-MONAI/MONAI'
31+
# if: ${{ false }} # disable self-hosted job project-monai/monai#7039
32+
# container:
33+
# image: nvcr.io/nvidia/pytorch:22.04-py3
34+
# options: --gpus all
35+
# runs-on: [self-hosted, linux, x64, integration]
36+
# steps:
37+
# - uses: actions/checkout@v6
38+
# - name: cache weekly timestamp
39+
# id: pip-cache
40+
# run: |
41+
# echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
42+
# - name: cache for pip
43+
# if: ${{ startsWith(github.ref, 'refs/heads/dev') }}
44+
# uses: actions/cache@v5
45+
# id: cache
46+
# with:
47+
# path: |
48+
# ~/.cache/pip
49+
# ~/.cache/torch
50+
# key: docker-py3-pip-${{ steps.pip-cache.outputs.datew }}
51+
# - name: Install the dependencies
52+
# run: |
53+
# which python
54+
# python -m pip install --upgrade pip wheel wheel-stub
55+
# python -m pip install --upgrade torch torchvision
56+
# python -m pip install -r requirements-dev.txt
57+
# - name: Run unit tests report coverage
58+
# env:
59+
# NGC_API_KEY: ${{ secrets.NGC_API_KEY }}
60+
# NGC_ORG: ${{ secrets.NGC_ORG }}
61+
# NGC_TEAM: ${{ secrets.NGC_TEAM }}
62+
# run: |
63+
# python -m pip list
64+
# git config --global --add safe.directory /__w/MONAI/MONAI
65+
# git clean -ffdx
66+
# df -h
67+
# # python -m pip cache info
68+
# nvidia-smi
69+
# export CUDA_VISIBLE_DEVICES=$(python -m tests.utils | tail -n 1)
70+
# echo $CUDA_VISIBLE_DEVICES
71+
# trap 'if pgrep python; then pkill python; fi;' ERR
72+
# 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 &
73+
# python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
74+
# python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
75+
# BUILD_MONAI=1 ./runtests.sh --build --coverage --unittests --disttests # unit tests with coverage report
76+
# BUILD_MONAI=1 ./runtests.sh --build --coverage --net # integration tests with coverage report
77+
# coverage xml --ignore-errors
78+
# if pgrep python; then pkill python; fi
79+
# shell: bash
80+
# - name: Upload coverage
81+
# uses: codecov/codecov-action@v6
82+
# with:
83+
# fail_ci_if_error: false
84+
# files: ./coverage.xml
85+
86+
87+
# test-py3x:
88+
# runs-on: ubuntu-latest
89+
# strategy:
90+
# matrix:
91+
# python-version: ['3.10', '3.11', '3.12']
92+
# steps:
93+
# - uses: actions/checkout@v6
94+
# with:
95+
# fetch-depth: 0
96+
# - name: Set up Python ${{ matrix.python-version }}
97+
# uses: actions/setup-python@v6
98+
# with:
99+
# python-version: ${{ matrix.python-version }}
100+
# cache: pip
101+
# - name: Install CPU PyTorch
102+
# run: |
103+
# python -m pip install --upgrade pip wheel wheel-stub
104+
# python -m pip install torch==2.8.0 torchvision --extra-index-url https://download.pytorch.org/whl/cpu
105+
# - name: Install the dependencies
106+
# run: |
107+
# find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
108+
# python -m pip install --no-build-isolation -r requirements-min.txt # necessary only here for some reason?
109+
# python -m pip install --no-build-isolation -r requirements-dev.txt
110+
# - name: Run quick tests CPU ubuntu
111+
# env:
112+
# NGC_API_KEY: ${{ secrets.NGC_API_KEY }}
113+
# NGC_ORG: ${{ secrets.NGC_ORG }}
114+
# NGC_TEAM: ${{ secrets.NGC_TEAM }}
115+
# TRANSFORMERS_VERBOSITY: error # stifle huggingface transformers warnings about aliases
116+
# run: |
117+
# python -m pip list
118+
# python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
119+
# BUILD_MONAI=0 python -m pip install --no-build-isolation -e .
120+
# ./runtests.sh --coverage --quick --unittests --disttests
121+
122+
# # TODO: update installation process to allow testing with and without compiled libraries as intended here
123+
# #BUILD_MONAI=0 ./runtests.sh --build --coverage --quick --unittests
124+
# #./runtests.sh --clean
125+
# #BUILD_MONAI=1 ./runtests.sh --build --coverage --quick --min
126+
# coverage xml --ignore-errors
127+
# - name: Upload coverage
128+
# uses: codecov/codecov-action@v6
129+
# with:
130+
# fail_ci_if_error: false
131+
# files: ./coverage.xml
115132

116133
install: # pip install from github url, the default branch is dev
117134
runs-on: ubuntu-latest
@@ -120,18 +137,9 @@ jobs:
120137
uses: actions/setup-python@v6
121138
with:
122139
python-version: '3.10'
123-
- name: cache weekly timestamp
124-
id: pip-cache
140+
- name: Install CPU PyTorch
125141
run: |
126-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
127-
- name: cache for pip
128-
uses: actions/cache@v5
129-
id: cache
130-
with:
131-
path: |
132-
~/.cache/pip
133-
~/.cache/torch
134-
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
142+
python -m pip install torch==2.8.0 torchvision --extra-index-url https://download.pytorch.org/whl/cpu
135143
- name: Install the default branch no build (dev branch only)
136144
if: github.ref == 'refs/heads/dev'
137145
run: |

0 commit comments

Comments
 (0)