Skip to content

Commit cddc2a8

Browse files
committed
resolves CI drive out of space by prune caching and use CPU version of torch
Signed-off-by: jirka <[email protected]>
1 parent 15fd428 commit cddc2a8

File tree

1 file changed

+9
-51
lines changed

1 file changed

+9
-51
lines changed

.github/workflows/pythonapp.yml

Lines changed: 9 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,7 @@ jobs:
3333
uses: actions/setup-python@v6
3434
with:
3535
python-version: '3.9'
36-
- name: cache weekly timestamp
37-
id: pip-cache
38-
run: |
39-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
40-
- name: cache for pip
41-
uses: actions/cache@v4
42-
id: cache
43-
with:
44-
path: ~/.cache/pip
45-
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
36+
cache: 'pip'
4637
- name: Install dependencies
4738
run: |
4839
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
@@ -75,22 +66,11 @@ jobs:
7566
uses: actions/setup-python@v6
7667
with:
7768
python-version: '3.9'
69+
cache: 'pip'
7870
- name: Prepare pip wheel
7971
run: |
8072
which python
8173
python -m pip install --upgrade pip wheel
82-
- name: cache weekly timestamp
83-
id: pip-cache
84-
run: |
85-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
86-
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
87-
shell: bash
88-
- name: cache for pip
89-
uses: actions/cache@v4
90-
id: cache
91-
with:
92-
path: ${{ steps.pip-cache.outputs.dir }}
93-
key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }}
9474
- if: runner.os == 'windows'
9575
name: Install torch cpu from pytorch.org (Windows only)
9676
run: |
@@ -136,26 +116,15 @@ jobs:
136116
uses: actions/setup-python@v6
137117
with:
138118
python-version: '3.9'
139-
- name: cache weekly timestamp
140-
id: pip-cache
141-
run: |
142-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
143-
- name: cache for pip
144-
uses: actions/cache@v4
145-
id: cache
146-
with:
147-
path: |
148-
~/.cache/pip
149-
~/.cache/torch
150-
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
119+
cache: 'pip'
151120
- name: Install dependencies
152121
run: |
153122
find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \;
154123
python -m pip install --user --upgrade pip setuptools wheel twine packaging
155124
# install the latest pytorch for testing
156125
# however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated
157126
# fresh torch installation according to pyproject.toml
158-
python -m pip install torch>=2.5.1 torchvision
127+
python -m pip install torch>=2.5.1 torchvision --extra-index-url https://download.pytorch.org/whl/cpu
159128
- name: Check packages
160129
run: |
161130
pip uninstall monai
@@ -184,7 +153,7 @@ jobs:
184153
working-directory: ${{ steps.mktemp.outputs.tmp_dir }}
185154
run: |
186155
# install from wheel
187-
python -m pip install monai*.whl
156+
python -m pip install monai*.whl --extra-index-url https://download.pytorch.org/whl/cpu
188157
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
189158
python -c 'import monai; print(monai.__file__)'
190159
python -m pip uninstall -y monai
@@ -195,7 +164,7 @@ jobs:
195164
# install from tar.gz
196165
name=$(ls *.tar.gz | head -n1)
197166
echo $name
198-
python -m pip install $name[all]
167+
python -m pip install $name[all] --extra-index-url https://download.pytorch.org/whl/cpu
199168
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
200169
python -c 'import monai; print(monai.__file__)'
201170
- name: Quick test
@@ -205,7 +174,7 @@ jobs:
205174
cp ${{ steps.root.outputs.pwd }}/requirements*.txt .
206175
cp -r ${{ steps.root.outputs.pwd }}/tests .
207176
ls -al
208-
python -m pip install -r requirements-dev.txt
177+
python -m pip install -r requirements-dev.txt --extra-index-url https://download.pytorch.org/whl/cpu
209178
python -m unittest -v
210179
env:
211180
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354
@@ -218,22 +187,11 @@ jobs:
218187
uses: actions/setup-python@v6
219188
with:
220189
python-version: '3.9'
221-
- name: cache weekly timestamp
222-
id: pip-cache
223-
run: |
224-
echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT
225-
- name: cache for pip
226-
uses: actions/cache@v4
227-
id: cache
228-
with:
229-
path: |
230-
~/.cache/pip
231-
~/.cache/torch
232-
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
190+
cache: 'pip'
233191
- name: Install dependencies
234192
run: |
235193
python -m pip install --upgrade pip wheel
236-
python -m pip install -r docs/requirements.txt
194+
python -m pip install -r docs/requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
237195
- name: Make html
238196
run: |
239197
cd docs/

0 commit comments

Comments
 (0)