-
Notifications
You must be signed in to change notification settings - Fork 178
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
Run task under multiple enviroments #1272
Comments
Mm interesting! One problem I see is that currently tasks are tied to features, tasks dont have any relation with environments as in your example. I think that could be quite confusing. Im wondering what an alternative syntax would be. E.g. this could be confusing: [feature.pl019.task]
run-test = { cmd = "pytest", environments = ["pl017", "pl018"] |
good point! Could we extend and apply tasks for environments tables? [environments.tasks]
run_test = { "pytest", environments = ["pl017", "pl018" ] } I think that usually you will want to run tasks under different environments rather than features ( because you can combine features in one environment ) |
Chiming in to add another example that could possibly benefit from this. I couldn't find a more concise way to express my test matrix in |
thanks for sharing this example! so you don't need to maintain them manually |
I think the task graph [tasks.test-all]
depends_on = [
{ task = "test-unit", environment = ["test-oldest", "test-newest"] },
{ task = "test-acceptance", environment = ["test-oldest", "test-newest"] },
{ task = "test-acceptance", environment = "test-newest", env = { JS_COVERAGE="1" } },
]
[tasks.test-unit]
cmd = "pytest tests"
depends_on = [
{ task = "preflight", environment = "$PIXI_ENVIRONMENT_NAME" },
]
[tasks.test-acceptance]
cmd = "robot atest"
depends_on = [
{ task = "preflight", environment = "$PIXI_ENVIRONMENT_NAME" },
{ task = "build-js", env = { JS_COVERAGE = "$JS_COVERAGE" } },
] (with some |
Might be more trivial (or even already possible, but not obviously documented), it would be nice to specify that a task belongs even to just a single environment, e.g. for running pytest within a "test" environment, etc. |
hey! Or you have other usecase ? |
What about extending the idea from @bollwyvl with a simple syntax extension for the taskname with an environment prefix? [task]
test = "pytest"
all-tests = {depends_on = ["py39:test", "py310:test"]}
local-test = {cmd = "echo TESTING", depends_on = ["py39:test"]}
[dependencies]
pytest = "*"
[feature.py310.dependencies]
python = "3.10"
[feature.py39.dependencies]
python = "3.9"
[environments]
py39 = ["py39"]
py310 = ["py310"] The rule being, split on When the |
Ha, gotta be careful with the grammar: there are only so many good separators, as suggested on #1285 for a per-file "namespace". |
Given no movement here, I have started down the dark path of pixi-in-pixi: [tasks.test-all]
cmd = """
pixi r -e test test -m unit
&& pixi r -e test-oldest test -m unit
&& pixi r -e test test -m integration
&& pixi r -e test-oldest test -m integration
""" This feels far worse than an easy-to-reason-about (and therefore visualize, document) More thinking on typography: reusing the [tasks]
test-all = {depends-on=[
"-e test test -m unit",
"-e test-oldest test -m unit",
"-e test test -m integration",
"-e test-oldest test -m integration",
]} TOML is real picky, though: one couldn't mix a string and an inline table in the same list... so I'm still mostly in favor of the "fat" [tasks]
test-all = {depends-on=[
{task = "test", environment=["test", "test-oldest"], args=[["-m unit"], ["-m integration"]]}
]} |
Issue #1519 is related: binding a task to a specific environment. |
Allowing to specify an environment in Consider my current config, using pixi in pixi: [tool.pixi.feature.test.tasks]
tests = "pytest"
[tool.pixi.tasks]
tests-minimal = "pixi run -e minimal tests"
tests-mid = "pixi run -e mid tests"
tests-latest = "pixi run -e latest tests"
tests-all = { depends-on = ["tests-minimal", "tests-mid", "tests-latest"] } This would become: [tool.pixi.feature.test.tasks]
tests = "pytest"
[tool.pixi.tasks]
tests-all = { depends-on = [
{ task = "tests", environment = "minimal" },
{ task = "tests", environment = "mid" },
{ task = "tests", environment = "latest" },
]} |
Problem description
Using polarify example:
and
it would be very useful to define task to run under list of environments automically
so in this case in will run pytest in every enviroment.
This potentially could be useful to use for cross-testing.
The text was updated successfully, but these errors were encountered: