Skip to content

Commit 3437e60

Browse files
[CI] auto clean cache & retry (#2895)
* [CI] auto clean cache & retry * [CI] source eenv * [CI] move flag to top * [CI] fix retry was skipped * [CI] remove duplicated env creation * [CI] don't fall at first try
1 parent 7c4fd47 commit 3437e60

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

.github/workflows/unit_tests.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,40 @@ jobs:
283283
else
284284
echo "[INFO] Current Python is not 3.14t, skip torchao."
285285
fi
286+
287+
${{ matrix.install_cmd }} || echo "RETRY_INSTALL=true" >> $GITHUB_ENV
288+
289+
- name: Clear installer cache on failure
290+
if: always() && env.RETRY_INSTALL == 'true'
291+
run: |
292+
source "${{ matrix.env_name }}/bin/activate"
293+
294+
INSTALL_CMD='${{ matrix.install_cmd }}'
295+
296+
if [[ "$INSTALL_CMD" == uv* || "$INSTALL_CMD" == *" uv "* ]]; then
297+
echo "[INFO] Previous install command uses uv, clearing uv cache..."
298+
uv cache clean
299+
elif [[ "$INSTALL_CMD" == pip* || "$INSTALL_CMD" == *" pip "* ]]; then
300+
echo "[INFO] Previous install command uses pip, clearing pip cache..."
301+
pip cache purge
302+
fi
303+
304+
- name: retry ${{ matrix.name }}
305+
if: always() && env.RETRY_INSTALL == 'true'
306+
run: |
307+
source "${{ matrix.env_name }}/bin/activate"
308+
if [[ "${{ matrix.use_pip }}" == "true" ]]; then
309+
uv pip install pip -U
310+
fi
311+
if python -VV 2>&1 | grep -q '3\.14.*free-threading'; then
312+
echo "[INFO] Python 3.14t detected, installing torchao..."
313+
uv pip install http://10.0.13.31/files/torchao-0.18.0+git13cd013d6-cp314-cp314t-linux_x86_64.whl
314+
else
315+
echo "[INFO] Current Python is not 3.14t, skip torchao."
316+
fi
286317
287318
${{ matrix.install_cmd }}
288319
289-
290320
setuptools-compatibility:
291321
uses: ./.github/workflows/setuptools_compatibility_reusable.yml
292322
with:

0 commit comments

Comments
 (0)