Skip to content

Commit

Permalink
Allow us to expose all arguments in the generated matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Dec 17, 2024
1 parent 39a7c1d commit 2e0b404
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
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

0 comments on commit 2e0b404

Please sign in to comment.