Skip to content

matrix: uv config fails with multiple python versions #4

@ssbarnea

Description

@ssbarnea

Bug originates in https://github.com/ansible/actions/blob/main/.github/workflows/tox.yml#L60 as we wrongly assumed that we can pass multiple versions with newlines separator to astral-sh/setup-python the same way we did with actions/setup-python.

Our dynamic matrix actions returns a JSON file that can be used by github to generate the job matrix.

One example of output:

"matrix": {
                    "include": [
                        {
                            "command": "tox -e py38-unit",
                            "command2": "tox -e py310-integration",
                            "name": "all-linux-arm64",
                            "os": "ubuntu-24.04-arm64-2core",
                            "python_version": "3.8\n3.14-dev",
                            "uv_python_version": "3.8\n3.14",
                            "runner": "ubuntu-24.04-arm64-2core",
                        },
                        {
                            "command": "tox -e foo",
                            "mise": "true",
                            "name": "foo",
                            "os": "custom-arm64",
                            "python_version": "3.8",
                            "uv_python_version": "3.8",
                            "runner": "custom-arm64",
                        },
}

If we look at python_version returned value we can see that in some cases it can have multiple values and that worked fine.

Because github does not allow loops for steps we cannot run setup-uv multiple times.

As a temporary workaround till we will be able to use the action multiple python versions we will change the implementation to return a single python version inside uv_python_version field. This will make setup-uv action pass and luckily as uv is able to download missing interpreters our jobs will still run. Downside is that this means that caching will work only for the first python version.

Upstream: astral-sh/uv#15659

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions