Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose all arguments in the generated matrix #47

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 5 additions & 1 deletion tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
},
],
},
Expand Down