diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d3fa133..dec1926 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -32,21 +32,25 @@ jobs: echo "uv not found in toolcache" fi + - name: Enable Python from toolcache + id: py + run: | + py_bin="$(find /opt/hostedtoolcache/Python -maxdepth 4 -type f -name 'python3*' -perm -111 2>/dev/null | grep -v -- '-config$' | head -1)" + if [ -n "$py_bin" ]; then + dirname "$py_bin" >> "$GITHUB_PATH" + echo "found=true" >> "$GITHUB_OUTPUT" + else + echo "python not found in toolcache" + fi + - name: Install uv if: steps.uv.outputs.found != 'true' uses: astral-sh/setup-uv@v3 with: enable-cache: true - - name: Cache Python toolchain - uses: actions/cache@v4 - with: - path: /opt/hostedtoolcache/Python - key: python-${{ matrix.python-version }}-${{ runner.os }} - restore-keys: | - python-${{ matrix.python-version }}- - - name: Set up Python ${{ matrix.python-version }} + if: steps.py.outputs.found != 'true' uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -95,21 +99,25 @@ jobs: echo "uv not found in toolcache" fi + - name: Enable Python from toolcache + id: py + run: | + py_bin="$(find /opt/hostedtoolcache/Python -maxdepth 4 -type f -name 'python3*' -perm -111 2>/dev/null | grep -v -- '-config$' | head -1)" + if [ -n "$py_bin" ]; then + dirname "$py_bin" >> "$GITHUB_PATH" + echo "found=true" >> "$GITHUB_OUTPUT" + else + echo "python not found in toolcache" + fi + - name: Install uv if: steps.uv.outputs.found != 'true' uses: astral-sh/setup-uv@v3 with: enable-cache: true - - name: Cache Python toolchain - uses: actions/cache@v4 - with: - path: /opt/hostedtoolcache/Python - key: python-3.13-${{ runner.os }} - restore-keys: | - python-3.13- - - name: Set up Python + if: steps.py.outputs.found != 'true' uses: actions/setup-python@v5 with: python-version: "3.13"