Skip to content

Commit 189543c

Browse files
Update Actions (#2074)
### Description This updates Actions to be compatible with the new configuration and installation setup in MONAI core. ### Checks <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Avoid including large-size files in the PR. - [x] Clean up long text outputs from code cells in the notebook. - [x] For security purposes, please check the contents and remove any sensitive info such as user names and private key. - [x] Ensure (1) hyperlinks and markdown anchors are working (2) use relative paths for tutorial repo files (3) put figure and graphs in the `./figure` folder - [x] Notebook runs automatically `./runner.sh -t <path to .ipynb file>` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Strengthened automated workflow permissions and isolated concurrent workflow runs. - Updated repository checkout tooling and standardized workflow setup. - Improved dependency installation reliability using the CPU PyTorch package source and local MONAI checkout. - **Tests** - Updated formatting, guidelines, copyright, and test workflows with consistent MONAI installation settings. - Refined notebook validation to use the current MONAI configuration command. - Removed redundant dependency installation steps from test setup. - **Documentation** - Updated the 2D classification notebook to include dataset support in its imports. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- 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 b3c6c99 commit 189543c

4 files changed

Lines changed: 69 additions & 18 deletions

File tree

‎.github/workflows/copyright.yml‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,38 @@ on:
77
- main
88
pull_request:
99

10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
# automatically cancel the previously triggered workflows when there's a newer version
15+
group: copyright-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
1018
jobs:
1119
copyright:
1220
runs-on: ubuntu-latest
1321
steps:
14-
- uses: actions/checkout@v6
22+
- uses: actions/checkout@v7
23+
- uses: actions/checkout@v7
24+
with:
25+
repository: Project-MONAI/MONAI
26+
path: monai
1527
- name: Set up Python 3.10
1628
uses: actions/setup-python@v6
1729
with:
1830
python-version: '3.10'
1931
cache: 'pip'
2032
- name: Install dependencies
33+
env:
34+
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster
35+
BUILD_MONAI: 0
2136
run: |
2237
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
23-
python -m pip install --upgrade pip wheel wheel-stub
38+
python -m pip install --upgrade pip wheel
39+
(cd monai; pip install .[all])
2440
python -m pip install -r requirements.txt
2541
- name: Copyright check
2642
run: |
43+
rm -rf monai
2744
$(pwd)/runner.sh --no-run --no-checks --copyright

‎.github/workflows/guidelines.yml‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,36 @@ on:
77
- main
88
pull_request:
99

10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
# automatically cancel the previously triggered workflows when there's a newer version
15+
group: guidelines-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
1018
jobs:
1119
guidelines:
1220
runs-on: ubuntu-latest
1321
steps:
14-
- uses: actions/checkout@v6
22+
- uses: actions/checkout@v7
23+
- uses: actions/checkout@v7
24+
with:
25+
repository: Project-MONAI/MONAI
26+
path: monai
1527
- name: Set up Python 3.10
1628
uses: actions/setup-python@v6
1729
with:
1830
python-version: '3.10'
1931
cache: 'pip'
2032
- name: Install dependencies
33+
env:
34+
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster
35+
BUILD_MONAI: 0
2136
run: |
2237
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
23-
python -m pip install --upgrade pip wheel wheel-stub
38+
python -m pip install --upgrade pip wheel
39+
(cd monai; pip install .[all])
2440
python -m pip install -r requirements.txt
2541
- name: Guidelines notebook format check
2642
run: |

‎.github/workflows/pep8.yml‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,36 @@ on:
77
- main
88
pull_request:
99

10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
# automatically cancel the previously triggered workflows when there's a newer version
15+
group: pep8-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
1018
jobs:
1119
pep8:
1220
runs-on: ubuntu-latest
1321
steps:
14-
- uses: actions/checkout@v6
22+
- uses: actions/checkout@v7
23+
- uses: actions/checkout@v7
24+
with:
25+
repository: Project-MONAI/MONAI
26+
path: monai
1527
- name: Set up Python 3.10
1628
uses: actions/setup-python@v6
1729
with:
1830
python-version: '3.10'
1931
cache: 'pip'
2032
- name: Install dependencies
33+
env:
34+
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster
35+
BUILD_MONAI: 0
2136
run: |
2237
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
2338
python -m pip install --upgrade pip wheel wheel-stub
39+
(cd monai; pip install .[all])
2440
python -m pip install -r requirements.txt
2541
- name: PEP8 check
2642
run: |

‎.github/workflows/test-modified.yml‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
- main
88
pull_request:
99

10+
permissions:
11+
contents: read
12+
1013
concurrency:
1114
# automatically cancel the previously triggered workflows when there's a newer version
1215
group: build-${{ github.event.pull_request.number || github.ref }}
@@ -16,7 +19,11 @@ jobs:
1619
build:
1720
runs-on: ubuntu-latest
1821
steps:
19-
- uses: actions/checkout@v6
22+
- uses: actions/checkout@v7
23+
- uses: actions/checkout@v7
24+
with:
25+
repository: Project-MONAI/MONAI
26+
path: monai
2027
- name: Set up Python 3.10
2128
uses: actions/setup-python@v6
2229
with:
@@ -27,25 +34,20 @@ jobs:
2734
env:
2835
PIP_NO_CACHE_DIR: "1"
2936
PIP_DISABLE_PIP_VERSION_CHECK: "1"
37+
BUILD_MONAI: 0
38+
PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster
3039
run: |
3140
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
3241
df -h
3342
which python
34-
python -m pip install -U pip wheel wheel-stub
35-
# Force CPU-only PyTorch wheels so we don't download huge CUDA/nvidia-* wheels in CI.
36-
# Keep PyPI available for torch's dependencies.
37-
pip install --index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pypi.org/simple torch torchvision torchaudio
38-
39-
pip install --no-build-isolation -r https://raw.githubusercontent.com/Project-MONAI/MONAI/dev/requirements-dev.txt
40-
pip install -r requirements.txt
41-
42-
# Avoid PEP517 build isolation (which can re-install torch and pull CUDA wheels).
43-
BUILD_MONAI=0 pip install --no-build-isolation git+https://github.com/Project-MONAI/MONAI#egg=MONAI
44-
pip list
43+
python -m pip install -U pip wheel
44+
(cd monai; pip install .[all])
45+
python -m pip install -r requirements.txt
46+
python -m pip list
4547
- name: Notebook quick check
4648
shell: bash
4749
run: |
48-
python -c "import monai; monai.config.print_debug_info()"
50+
python -m monai.config
4951
git fetch origin main
5052
git diff --name-only origin/main | while read line
5153
do

0 commit comments

Comments
 (0)