From 2e0b40415912cd3e08a280a519f6d8fbcef9f46e Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 17 Dec 2024 11:15:29 +0000 Subject: [PATCH] Allow us to expose all arguments in the generated matrix --- README.md | 18 ++++++++++++++++-- entrypoint.py | 2 ++ tests/test_action.py | 6 +++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 58a7d8a..8889d8a 100644 --- a/README.md +++ b/README.md @@ -68,10 +68,12 @@ jobs: lint pkg py39-all:tox -f py39 - py39-arm64:tox -e py39:runner=ubuntu-24.04-arm64 + py39-arm64:tox -e py39:runner=ubuntu-24.04-arm64;foo=bar # ^ job-visible name : optional command : optional arguments # command can use ; as separator to run multiple commands - # the only recognized argument is now 'runner' + # 'runner' argument has special meaning, it is used to determine + # the value of 'os' variable in the matrix job. Others are just + # passed to the exploded matrix. build: name: ${{ matrix.name }} @@ -96,6 +98,18 @@ jobs: pip install tox - run: ${{ matrix.command }} + + - run: ${{ matrix.command2 }} + if: ${{ matrix.command2 }} + + - run: ${{ matrix.command3 }} + if: ${{ matrix.command3 }} + + - run: ${{ matrix.command4 }} + if: ${{ matrix.command4 }} + + - run: ${{ matrix.command5 }} + if: ${{ matrix.command5 }} ``` ## Q&A diff --git a/entrypoint.py b/entrypoint.py index a00b7eb..80e6a7b 100755 --- a/entrypoint.py +++ b/entrypoint.py @@ -157,6 +157,8 @@ def sort_key(s: str) -> tuple[int, str]: args["runner"] = PLATFORM_MAP[platform_name] data = { + # we expose all args in the output + **args, "name": name, "command": commands[0], "python_version": "\n".join(pythons), diff --git a/tests/test_action.py b/tests/test_action.py index d0f9174..7f5f60c 100644 --- a/tests/test_action.py +++ b/tests/test_action.py @@ -19,7 +19,7 @@ "INPUT_MACOS": "minmax", "INPUT_MAX_PYTHON": "3.8", "INPUT_MIN_PYTHON": "3.8", - "INPUT_OTHER_NAMES": "z\nall-linux-arm64:tox -e py38-unit;tox -e py310-integration\nfoo::runner=custom-arm64", + "INPUT_OTHER_NAMES": "z\nall-linux-arm64:tox -e py38-unit;tox -e py310-integration\nfoo::runner=custom-arm64;mise=true", "INPUT_PLATFORMS": "linux-arm64:ubuntu-24.04-arm64-2core", "INPUT_SKIP_EXPLODE": "1", "INPUT_WINDOWS": "minmax", @@ -33,18 +33,22 @@ "name": "all-linux-arm64", "os": "ubuntu-24.04-arm64-2core", "python_version": "3.8\n3.10", + "runner": "ubuntu-24.04-arm64-2core", }, { "command": "tox -e foo", + "mise": "true", "name": "foo", "os": "custom-arm64", "python_version": "3.8", + "runner": "custom-arm64", }, { "command": "tox -e z", "name": "z", "os": "ubuntu-24.04", "python_version": "3.8", + "runner": "ubuntu-24.04", }, ], },