Skip to content
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: 5 additions & 13 deletions docs/tasks/running-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ depends = ["build"]

This will ensure that the `build` task is run before the `test` task.

You can also define a mise task to run other tasks sequentially (or in series).
You can do this by calling `mise run <task>` in the `run` property of a task.
You can also define a mise task to run other tasks in parallel or in series:

```toml
[tasks.example1]
Expand All @@ -148,19 +147,12 @@ run = "echo 'example1'"
[tasks.example2]
run = "mise example2"

[tasks.one_by_one]
run = [
'mise run example1',
'mise run example2',
]
```

This assumes that `mise` is in your `PATH`. If you are using [mise generate bootstrap](/cli/generate/bootstrap.html) or if `mise` is not on `PATH`, it's better to use <span v-pre>[`{{mise_bin}}`](/templates.html#variables)</span> instead of `mise` in the task definition.
[tasks.example3]
run = "echo 'example3'"

```toml
[tasks.one_by_one]
run = [
'{{mise_bin}} run example1',
'{{mise_bin}} run example2',
{ task = "example1" }, # will wait for example1 to finish before running the next step
{ tasks = ["example2", "example3"] }, # these 2 are run in parallel
]
```
22 changes: 18 additions & 4 deletions docs/tasks/task-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@ All examples are in toml-task format instead of file, however they apply in both

### `run`

- **Type**: `string | string[]`
- **Type**: `string | (string | { task: string } | { tasks: string[] })[]`

The command(s) to run. This is the only required property for a task.

The command to run. This is the only required property for a task. Note that tasks can be defined in
`mise.toml` in various ways in order to simplify the config, e.g.: these are all equal:
You can now mix scripts with task references:

```toml
[tasks.grouped]
run = [
{ task = "t1" }, # run t1 (with its dependencies)
{ tasks = ["t2", "t3"] }, # run t2 and t3 in parallel (with their dependencies)
"echo end", # then run a script
]
```

Simple forms still work and are equivalent:

```toml
tasks.a = "echo hello"
Expand All @@ -26,7 +38,9 @@ run = ["echo hello"]

### `run_windows`

An alternative script to run when `mise run` is executed on windows:
- **Type**: `string | (string | { task: string } | { tasks: string[] })[]`

Windows-specific variant of `run` supporting the same structured syntax:

```toml
[tasks.build]
Expand Down
30 changes: 30 additions & 0 deletions e2e/tasks/test_task_run_groups
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

cat <<EOF >mise.toml
[tasks.t1]
run = 'echo one'

[tasks.t2]
run = 'echo two'

[tasks.t3]
run = 'echo three'

[tasks.grouped]
run = [
{ task = 't1' },
{ tasks = ['t2','t3'] },
'echo end',
]
EOF

# All outputs should appear
assert_contains "mise run grouped" "one"
assert_contains "mise run grouped" "two"
assert_contains "mise run grouped" "three"
assert_contains "mise run grouped" "end"

# Ensure trailing script runs after grouped tasks complete
assert_matches "mise run grouped" "one(.|\n)*end"
assert_matches "mise run grouped" "two(.|\n)*end"
assert_matches "mise run grouped" "three(.|\n)*end"
49 changes: 49 additions & 0 deletions schema/mise-task.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,55 @@
"title": "mise-task-schema",
"type": "object",
"$defs": {
"run_step": {
"oneOf": [
{
"description": "script to run",
"type": "string"
},
{
"additionalProperties": false,
"properties": {
"task": {
"description": "single task name (with optional args) to run",
"type": "string"
}
},
"required": ["task"],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"tasks": {
"description": "parallel task group to run",
"items": {
"description": "task name and args",
"type": "string"
},
"type": "array"
}
},
"required": ["tasks"],
"type": "object"
}
]
},
"run_field": {
"oneOf": [
{
"description": "script to run",
"type": "string"
},
{
"description": "list of steps mixing scripts and task references",
"items": {
"$ref": "#/$defs/run_step"
},
"type": "array"
}
]
},
"task": {
"oneOf": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/cli/mcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ impl ServerHandler for MiseServer {
"quiet": task.quiet,
"silent": task.silent,
"tools": task.tools.clone(),
"run": task.run.clone(),
"run": task.run_script_strings(),
"usage": task.usage.clone(),
})
}).collect();
Expand Down
Loading
Loading