Pin publish test to 3.12 (#8951)
Some checks are pending
CI / integration test | github actions (push) Blocked by required conditions
CI / integration test | free-threaded on windows (push) Blocked by required conditions
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
CI / integration test | graalpy on windows (push) Blocked by required conditions
CI / integration test | determine publish changes (push) Blocked by required conditions
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / test windows trampoline | x86_64 (push) Blocked by required conditions
CI / typos (push) Waiting to run
CI / Determine changes (push) Waiting to run
CI / check windows trampoline | i686 (push) Blocked by required conditions
CI / lint (push) Waiting to run
CI / cargo clippy | ubuntu (push) Blocked by required conditions
CI / cargo clippy | windows (push) Blocked by required conditions
CI / cargo dev generate-all (push) Blocked by required conditions
CI / cargo shear (push) Waiting to run
CI / check windows trampoline | x86_64 (push) Blocked by required conditions
CI / cargo test | ubuntu (push) Blocked by required conditions
CI / cargo test | macos (push) Blocked by required conditions
CI / cargo test | windows (push) Blocked by required conditions
CI / check windows trampoline | aarch64 (push) Blocked by required conditions
CI / test windows trampoline | i686 (push) Blocked by required conditions
CI / mkdocs (push) Waiting to run
CI / build binary | linux (push) Blocked by required conditions
CI / build binary | macos aarch64 (push) Blocked by required conditions
CI / build binary | macos x86_64 (push) Blocked by required conditions
CI / build binary | windows (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / integration test | conda on ubuntu (push) Blocked by required conditions
CI / integration test | free-threaded on linux (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86_64 (push) Blocked by required conditions
CI / check system | python3.10 on windows (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / check system | python3.13 on windows (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on linux (push) Blocked by required conditions
CI / check system | conda3.8 on linux (push) Blocked by required conditions
CI / check system | conda3.11 on macos (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
CI / check system | conda3.8 on macos (push) Blocked by required conditions
CI / check system | conda3.11 on windows (push) Blocked by required conditions
CI / check system | conda3.8 on windows (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions

The bump to 3.13 broke the test
This commit is contained in:
konsti 2024-11-10 15:43:47 +01:00 committed by GitHub
parent 249089c96a
commit 874aa29b57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 11 deletions

View file

@ -1139,6 +1139,7 @@ jobs:
env:
# No dbus in GitHub Actions
PYTHON_KEYRING_BACKEND: keyrings.alt.file.PlaintextKeyring
PYTHON_VERSION: 3.12
permissions:
# For trusted publishing
id-token: write
@ -1149,7 +1150,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "${{ env.PYTHON_VERSION }}"
- name: "Download binary"
uses: actions/download-artifact@v4
@ -1169,7 +1170,7 @@ jobs:
- name: "Publish test packages"
# `-p 3.12` prefers the python we just installed over the one locked in `.python_version`.
run: ./uv run -p 3.12 scripts/publish/test_publish.py --uv ./uv all
run: ./uv run -p ${{ env.PYTHON_VERSION }} scripts/publish/test_publish.py --uv ./uv all
env:
RUST_LOG: uv=debug,uv_publish=trace
UV_TEST_PUBLISH_TOKEN: ${{ secrets.UV_TEST_PUBLISH_TOKEN }}
@ -1177,6 +1178,7 @@ jobs:
UV_TEST_PUBLISH_GITLAB_PAT: ${{ secrets.UV_TEST_PUBLISH_GITLAB_PAT }}
UV_TEST_PUBLISH_CODEBERG_TOKEN: ${{ secrets.UV_TEST_PUBLISH_CODEBERG_TOKEN }}
UV_TEST_PUBLISH_CLOUDSMITH_TOKEN: ${{ secrets.UV_TEST_PUBLISH_CLOUDSMITH_TOKEN }}
UV_TEST_PUBLISH_PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
cache-test-ubuntu:
timeout-minutes: 10

View file

@ -69,6 +69,7 @@ from packaging.utils import (
from packaging.version import Version
TEST_PYPI_PUBLISH_URL = "https://test.pypi.org/legacy/"
PYTHON_VERSION = os.environ.get("UV_TEST_PUBLISH_PYTHON_VERSION", "3.12")
cwd = Path(__file__).parent
@ -124,8 +125,8 @@ all_targets: dict[str, TargetConfiguration] = local_targets | {
}
def get_new_version(project_name: str, client: httpx.Client) -> Version:
"""Return the next free patch version on all indexes of the package."""
def get_latest_version(project_name: str, client: httpx.Client) -> Version:
"""Return the latest version on all indexes of the package."""
# To keep the number of packages small we reuse them across targets, so we have to
# pick a version that doesn't exist on any target yet
versions = set()
@ -151,10 +152,12 @@ def get_new_version(project_name: str, client: httpx.Client) -> Version:
time.sleep(1)
else:
raise RuntimeError(f"Failed to fetch {url}") from error
max_version = max(versions)
return max(versions)
# Bump the path version to obtain an empty version
release = list(max_version.release)
def get_new_version(latest_version: Version) -> Version:
"""Bump the path version to obtain an empty version."""
release = list(latest_version.release)
release[-1] += 1
return Version(".".join(str(i) for i in release))
@ -193,7 +196,10 @@ def build_project_at_version(
if project_root.exists():
rmtree(project_root)
check_call([uv, "init", "--lib", "--name", project_name, dir_name], cwd=cwd)
check_call(
[uv, "init", "-p", PYTHON_VERSION, "--lib", "--name", project_name, dir_name],
cwd=cwd,
)
pyproject_toml = project_root.joinpath("pyproject.toml")
# Set to an unclaimed version
@ -217,7 +223,12 @@ def build_project_at_version(
return project_root
def wait_for_index(index_url: str, project_name: str, version: Version, uv: Path):
def wait_for_index(
index_url: str,
project_name: str,
version: Version,
uv: Path,
):
"""Check that the index URL was updated, wait up to 100s if necessary.
Often enough the index takes a few seconds until the index is updated after an
@ -231,6 +242,8 @@ def wait_for_index(index_url: str, project_name: str, version: Version, uv: Path
uv,
"pip",
"compile",
"-p",
PYTHON_VERSION,
"--index",
index_url,
"--quiet",
@ -241,7 +254,7 @@ def wait_for_index(index_url: str, project_name: str, version: Version, uv: Path
"-",
],
text=True,
input=project_name,
input=f"{project_name}",
)
if f"{project_name}=={version}" in output and output.count("--hash") == 2:
break
@ -265,7 +278,8 @@ def publish_project(target: str, uv: Path, client: httpx.Client):
print(f"\nPublish {project_name} for {target}")
# The distributions are build to the dist directory of the project.
version = get_new_version(project_name, client)
previous_version = get_latest_version(project_name, client)
version = get_new_version(previous_version)
project_dir = build_project_at_version(project_name, version, uv)
# Upload configuration