@@ -6,9 +6,18 @@ permissions:
66on :
77 schedule :
88 - cron : " 0 2 * * 0" # 02:00 of every Sunday
9+ pull_request :
10+ branches :
11+ - dev
12+
13+ env :
14+ PYTHON_VER : ' 3.10'
15+ PYTORCH_VER : ' 2.8.0'
16+ PIP_EXTRA_INDEX_URL : " https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster
917
1018jobs :
1119 static-checks :
20+ if : github.event_name == 'schedule' # only check on cron run, these checks are redundant in a PR
1221 runs-on : ubuntu-latest
1322 strategy :
1423 matrix :
@@ -25,10 +34,10 @@ jobs:
2534 - uses : actions/checkout@v7
2635 with :
2736 persist-credentials : false
28- - name : Set up Python 3.10
37+ - name : Set up Python ${{ env.PYTHON_VER }}
2938 uses : actions/setup-python@v6
3039 with :
31- python-version : ' 3.10 '
40+ python-version : ${{ env.PYTHON_VER }}
3241 cache : ' pip'
3342 - name : Install dependencies
3443 run : |
@@ -40,22 +49,24 @@ jobs:
4049 $(pwd)/runtests.sh --build --clean
4150 $(pwd)/runtests.sh --build --${{ matrix.opt }}
4251
43- packaging :
52+ publish :
4453 if : github.repository == 'Project-MONAI/MONAI'
4554 runs-on : ubuntu-latest
4655 steps :
4756 - uses : actions/checkout@v7
4857 with :
49- ref : dev
58+ # get the ref for the PR branch or dev if this is a cron job
59+ ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'dev' }}
5060 fetch-depth : 0
5161 persist-credentials : false
52- - name : Set up Python 3.10
62+ - name : Set up Python ${{ env.PYTHON_VER }}
5363 uses : actions/setup-python@v6
5464 with :
55- python-version : ' 3.10'
56- - name : Install setuptools
65+ python-version : ${{ env.PYTHON_VER }}
66+ cache : ' pip'
67+ - name : Install tools
5768 run : |
58- python -m pip install --user --upgrade setuptools wheel packaging
69+ python -m pip install -U pip build
5970 - name : Build distribution
6071 run : |
6172 export HEAD_COMMIT_ID=$(git rev-parse HEAD)
7283 git tag "1.7.dev${YEAR_WEEK}"
7384 git log -1
7485 git tag --list
75- python setup.py sdist bdist_wheel
76-
86+ python -m build
87+ ls -lh dist
88+ - name : Test Installation
89+ run : |
90+ pip install dist/*.whl
91+ pip list
92+ (cd "$(mktemp -d)" && python -c 'import monai; print(monai.__version__)')
7793 - name : Publish to PyPI
94+ if : github.event_name == 'schedule' # only publish on cron run
7895 uses : pypa/gh-action-pypi-publish@release/v1
7996 with :
8097 user : __token__
0 commit comments