diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index c472b7e5a..9be04f070 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -283,10 +283,40 @@ jobs: else echo "[INFO] Current Python is not 3.14t, skip torchao." fi + + ${{ matrix.install_cmd }} || echo "RETRY_INSTALL=true" >> $GITHUB_ENV + + - name: Clear installer cache on failure + if: always() && env.RETRY_INSTALL == 'true' + run: | + source "${{ matrix.env_name }}/bin/activate" + + INSTALL_CMD='${{ matrix.install_cmd }}' + + if [[ "$INSTALL_CMD" == uv* || "$INSTALL_CMD" == *" uv "* ]]; then + echo "[INFO] Previous install command uses uv, clearing uv cache..." + uv cache clean + elif [[ "$INSTALL_CMD" == pip* || "$INSTALL_CMD" == *" pip "* ]]; then + echo "[INFO] Previous install command uses pip, clearing pip cache..." + pip cache purge + fi + + - name: retry ${{ matrix.name }} + if: always() && env.RETRY_INSTALL == 'true' + run: | + source "${{ matrix.env_name }}/bin/activate" + if [[ "${{ matrix.use_pip }}" == "true" ]]; then + uv pip install pip -U + fi + if python -VV 2>&1 | grep -q '3\.14.*free-threading'; then + echo "[INFO] Python 3.14t detected, installing torchao..." + uv pip install http://10.0.13.31/files/torchao-0.18.0+git13cd013d6-cp314-cp314t-linux_x86_64.whl + else + echo "[INFO] Current Python is not 3.14t, skip torchao." + fi ${{ matrix.install_cmd }} - setuptools-compatibility: uses: ./.github/workflows/setuptools_compatibility_reusable.yml with: