Trim runtime ID docs and workflow tests

This commit is contained in:
William Woodruff
2026-09-03 16:23:46 -04:00
parent 22b0154feb
commit d171fb509c
5 changed files with 8 additions and 48 deletions
+4 -39
View File
@@ -363,58 +363,23 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.13.1t"]
include:
- os: ubuntu-latest
python-version: "3.13"
- os: ubuntu-latest
python-version: "3.14.0rc2"
- os: ubuntu-latest
python-version: "3.14.0rc2t"
- os: ubuntu-latest
python-version: "pypy3.11"
steps: steps:
- name: Install latest version - name: Install latest version
id: setup-uv id: setup-uv
uses: $/ uses: $/
with: with:
python-version: ${{ matrix.python-version }} python-version: 3.13.1t
activate-environment: true activate-environment: true
enable-cache: true
- name: Verify packages can be installed - name: Verify packages can be installed
run: uv pip install pip run: uv pip install pip
shell: bash shell: bash
- name: Verify Python version outputs and cache key - name: Verify python version is correct
run: | run: |
expected_prefix=$(python -I - <<'PY' python --version
import platform if [ "$(python --version)" != "Python 3.13.1" ]; then
import sys
import sysconfig
runtime = f"{sys.implementation.name}-{platform.python_version()}"
if sysconfig.get_config_var("Py_GIL_DISABLED") == 1:
runtime += "+freethreaded"
print(f"{runtime}-")
PY
)
case "$PYTHON_RUNTIME_ID" in
"$expected_prefix"*) ;;
*) echo "Wrong Python runtime ID: $PYTHON_RUNTIME_ID (expected prefix $expected_prefix)"; exit 1 ;;
esac
if [ "$PYTHON_VERSION" != "$PYTHON_REQUEST" ]; then
echo "Wrong requested Python version: $PYTHON_VERSION"
exit 1 exit 1
fi fi
case "$CACHE_KEY" in
*-"$PYTHON_REQUEST"-*) ;;
*) echo "Cache key no longer contains requested Python version: $CACHE_KEY"; exit 1 ;;
esac
shell: bash shell: bash
env:
CACHE_KEY: ${{ steps.setup-uv.outputs.cache-key }}
PYTHON_REQUEST: ${{ matrix.python-version }}
PYTHON_VERSION: ${{ steps.setup-uv.outputs.python-version }}
PYTHON_RUNTIME_ID: ${{ steps.setup-uv.outputs.python-runtime-id }}
- name: Verify output venv is set - name: Verify output venv is set
run: | run: |
if [ -z "$UV_VENV" ]; then if [ -z "$UV_VENV" ]; then
+1 -3
View File
@@ -138,9 +138,7 @@ Have a look under [Advanced Configuration](#advanced-configuration) for detailed
- `cache-hit`: A boolean value to indicate a cache entry was found. - `cache-hit`: A boolean value to indicate a cache entry was found.
- `venv`: Path to the activated venv if activate-environment is true. - `venv`: Path to the activated venv if activate-environment is true.
- `python-version`: The Python version that was set. - `python-version`: The Python version that was set.
- `python-runtime-id`: An opaque identifier reported by uv for the activated venv's Python runtime, including - `python-runtime-id`: An opaque identifier reported by uv for the activated venv's Python runtime. Empty when `activate-environment` is false.
implementation, full Python version, and free-threaded build information. Useful as a cache-key component.
Empty when `activate-environment` is false. The action fails if the activated runtime cannot be determined.
- `python-cache-hit`: A boolean value to indicate the Python cache entry was found. - `python-cache-hit`: A boolean value to indicate the Python cache entry was found.
### Python version ### Python version
+1 -1
View File
@@ -108,7 +108,7 @@ outputs:
python-version: python-version:
description: "The Python version that was set." description: "The Python version that was set."
python-runtime-id: python-runtime-id:
description: "An opaque identifier reported by uv for the activated venv's Python runtime, including implementation, full Python version, and free-threaded build information. Empty when activate-environment is false. The action fails if the activated runtime cannot be determined." description: "An opaque identifier reported by uv for the activated venv's Python runtime. Empty when activate-environment is false."
python-cache-hit: python-cache-hit:
description: "A boolean value to indicate the Python cache entry was found" description: "A boolean value to indicate the Python cache entry was found"
runs: runs:
-5
View File
@@ -29,11 +29,6 @@ your cache with `id: setup-uv` on the setup step:
key: build-${{ runner.os }}-${{ runner.arch }}-${{ steps.setup-uv.outputs.python-runtime-id }}-${{ hashFiles('uv.lock') }} key: build-${{ runner.os }}-${{ runner.arch }}-${{ steps.setup-uv.outputs.python-runtime-id }}-${{ hashFiles('uv.lock') }}
``` ```
The free-threaded marker describes the interpreter's build even when the GIL is
enabled at runtime. The output is empty when `activate-environment` is false. If
the activated runtime cannot be determined, the action fails. The existing
`python-version` output and setup-uv's cache keys are unaffected.
You can customize the venv location with `venv-path`, for example to place it in the runner temp directory: You can customize the venv location with `venv-path`, for example to place it in the runner temp directory:
```yaml ```yaml
+2
View File
@@ -10,6 +10,8 @@ export async function getPythonRuntimeId(inputs: SetupInputs): Promise<string> {
} }
try { try {
// The venv path restricts results to this invocation's runtime, even if
// earlier setup-uv calls installed other Python versions in the same job.
const { stdout } = await execFileAsync( const { stdout } = await execFileAsync(
"uv", "uv",
[ [