You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
updating README in preparation for matlab-actions/run-command@v2 (#48)
* Update README.md
replacing v1 with v2
* Update README.md
using the latest "checkout" action
* removing redundant text
* adding a link for self-hosted runners
* incorporating Mark's edit
Co-authored-by: Mark Cafaro <34887852+mcafaro@users.noreply.github.com>
* addressing two of Mark's comments
* removing quotes
* replacing 20b with 21a
* adding lines
* replacing vm with runner
---------
Co-authored-by: Mark Cafaro <34887852+mcafaro@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+12-16Lines changed: 12 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,12 @@
1
1
# Action for Running MATLAB Commands
2
2
3
-
The [Run MATLAB Command](#run-matlab-command) action enables you to execute MATLAB® scripts, functions, or statements on a [self-hosted](https://docs.github.com/en/free-pro-team@latest/actions/hosting-your-own-runners/about-self-hosted-runners) or [GitHub®-hosted](https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners) runner:
4
-
5
-
- To use a self-hosted runner, you must set up a computer with MATLAB (R2013b or later) as your runner. The runner uses the topmost MATLAB version on the system path to execute your workflow.
6
-
7
-
- To use a GitHub-hosted runner, you must include the [Setup MATLAB](https://github.com/matlab-actions/setup-matlab/) action in your workflow to set up MATLAB on the runner. Currently, this action is available only for public projects. It does not set up transformation products, such as MATLAB Coder™ and MATLAB Compiler™.
3
+
The [Run MATLAB Command](#run-matlab-command) action enables you to execute MATLAB® scripts, functions, and statements on a self-hosted or GitHub®-hosted runner. The action uses the topmost MATLAB version on the system path.
8
4
9
5
## Examples
10
6
Use the **Run MATLAB Command** action to run MATLAB scripts, functions, and statements. You can use this action to flexibly customize your test run or add a step in MATLAB to your workflow.
11
7
12
8
### Run MATLAB Script on Self-Hosted Runner
13
-
Use a self-hosted runner to run the commands in a file named `myscript.m` in the root of your repository.
9
+
Use a [self-hosted runner](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners) to run the commands in a file named `myscript.m` in the root of your repository.
14
10
15
11
```yaml
16
12
name: Run MATLAB Script on Self-Hosted Runner
@@ -21,15 +17,15 @@ jobs:
21
17
runs-on: self-hosted
22
18
steps:
23
19
- name: Check out repository
24
-
uses: actions/checkout@v3
20
+
uses: actions/checkout@v4
25
21
- name: Run script
26
-
uses: matlab-actions/run-command@v1
22
+
uses: matlab-actions/run-command@v2
27
23
with:
28
24
command: myscript
29
25
```
30
26
31
27
### Run MATLAB Commands on GitHub-Hosted Runner
32
-
Before you run MATLAB code or Simulink models on a GitHub-hosted runner, first use the [Setup MATLAB](https://github.com/matlab-actions/setup-matlab/) action. The action sets up your specified MATLAB release (R2020a or later) on a Linux® virtual machine. If you do not specify a release, the action sets up the latest release of MATLAB.
28
+
Before you run MATLAB code or Simulink models on a [GitHub-hosted runner](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners), first use the [Setup MATLAB](https://github.com/matlab-actions/setup-matlab/) action. The action sets up your specified MATLAB release (R2021a or later) on a Linux®, Windows®, or macOS® runner. If you do not specify a release, the action sets up the latest release of MATLAB.
33
29
34
30
For example, set up the latest release of MATLAB on a GitHub-hosted runner, and then use the **Run MATLAB Command** action to execute your MATLAB commands.
When you define your workflow in the `.github/workflows` directory of your repository, specify the **Run MATLAB Command** action as `matlab-actions/run-command@v1`. The action requires an input and also accepts an optional input.
51
+
When you define your workflow in the `.github/workflows` directory of your repository, specify the **Run MATLAB Command** action as `matlab-actions/run-command@v2`. The action requires an input and also accepts an optional input.
56
52
57
53
Input | Description
58
54
------------------------- | ---------------
59
-
`command` | (Required) Script, function, or statement to execute. If the value of `command` is the name of a MATLAB script or function, do not specify the file extension. If you specify more than one script, function, or statement, use a comma or semicolon to separate them.<br/>MATLAB exits with exit code 0 if the specified script, function, or statement executes successfully without error. Otherwise, MATLAB terminates with a nonzero exit code, which causes the build to fail. To fail the build in certain conditions, use the [`assert`](https://www.mathworks.com/help/matlab/ref/assert.html) or [`error`](https://www.mathworks.com/help/matlab/ref/error.html) function.<br/>**Example:** `command: myscript`<br/>**Example:** `command: results = runtests, assertSuccess(results);`
60
-
`startup-options` | (Optional) MATLAB startup options. If you specify more than one option, use a space to separate them. For more information about startup options, see [Commonly Used Startup Options](https://www.mathworks.com/help/matlab/matlab_env/commonly-used-startup-options.html).<br/>Using this input to specify the `-batch` or `-r` option is not supported.<br/>**Example:** `startup-options: -nojvm`<br/>**Example:** `startup-options: -nojvm -logfile "output.log"`
55
+
`command` | <p>(Required) Script, function, or statement to execute. If the value of `command` is the name of a MATLAB script or function, do not specify the file extension. If you specify more than one script, function, or statement, use a comma or semicolon to separate them.<p/><p>MATLAB exits with exit code 0 if the specified script, function, or statement executes successfully without error. Otherwise, MATLAB terminates with a nonzero exit code, which causes the build to fail. To fail the build in certain conditions, use the [`assert`](https://www.mathworks.com/help/matlab/ref/assert.html) or [`error`](https://www.mathworks.com/help/matlab/ref/error.html) function.<p/><p>**Example:** `command: myscript`<br/>**Example:** `command: results = runtests, assertSuccess(results);`</p>
56
+
`startup-options` | <p>(Optional) MATLAB startup options. If you specify more than one option, use a space to separate them. For more information about startup options, see [Commonly Used Startup Options](https://www.mathworks.com/help/matlab/matlab_env/commonly-used-startup-options.html).<p/><p>Using this input to specify the `-batch` or `-r` option is not supported.<p/><p>**Example:** `startup-options: -nojvm`<br/>**Example:** `startup-options: -nojvm -logfile output.log`</p>
61
57
62
58
When you use this action, all of the required files must be on the MATLAB search path. If your script or function is not in the root of your repository, you can use the [`addpath`](https://www.mathworks.com/help/matlab/ref/addpath.html), [`cd`](https://www.mathworks.com/help/matlab/ref/cd.html), or [`run`](https://www.mathworks.com/help/matlab/ref/run.html) function to put it on the path. For example, to run `myscript.m` in a folder named `myfolder` located in the root of the repository, you can specify `command` like this:
63
59
@@ -70,7 +66,7 @@ When you use this action, all of the required files must be on the MATLAB search
70
66
## See Also
71
67
- [Action for Running MATLAB Builds](https://github.com/matlab-actions/run-build/)
72
68
- [Action for Running MATLAB Tests](https://github.com/matlab-actions/run-tests/)
73
-
- [Action for Setting Up MATLAB on GitHub-Hosted Runner](https://github.com/matlab-actions/setup-matlab/)
69
+
- [Action for Setting Up MATLAB](https://github.com/matlab-actions/setup-matlab/)
74
70
- [Continuous Integration with MATLAB and Simulink](https://www.mathworks.com/solutions/continuous-integration.html)
0 commit comments