Skip to content

Commit fcdc0d7

Browse files
mw-hrastegamcafaro
andauthored
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>
1 parent 0735747 commit fcdc0d7

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# Action for Running MATLAB Commands
22

3-
The [Run MATLAB Command](#run-matlab-command) action enables you to execute MATLAB&reg; 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&reg;-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&trade; and MATLAB Compiler&trade;.
3+
The [Run MATLAB Command](#run-matlab-command) action enables you to execute MATLAB&reg; scripts, functions, and statements on a self-hosted or GitHub&reg;-hosted runner. The action uses the topmost MATLAB version on the system path.
84

95
## Examples
106
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.
117

128
### 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.
1410

1511
```yaml
1612
name: Run MATLAB Script on Self-Hosted Runner
@@ -21,15 +17,15 @@ jobs:
2117
runs-on: self-hosted
2218
steps:
2319
- name: Check out repository
24-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2521
- name: Run script
26-
uses: matlab-actions/run-command@v1
22+
uses: matlab-actions/run-command@v2
2723
with:
2824
command: myscript
2925
```
3026
3127
### 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&reg; 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&reg;, Windows&reg;, or macOS&reg; runner. If you do not specify a release, the action sets up the latest release of MATLAB.
3329
3430
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.
3531
@@ -42,22 +38,22 @@ jobs:
4238
runs-on: ubuntu-latest
4339
steps:
4440
- name: Check out repository
45-
uses: actions/checkout@v3
41+
uses: actions/checkout@v4
4642
- name: Set up MATLAB
47-
uses: matlab-actions/setup-matlab@v1
43+
uses: matlab-actions/setup-matlab@v2
4844
- name: Run commands
49-
uses: matlab-actions/run-command@v1
45+
uses: matlab-actions/run-command@v2
5046
with:
5147
command: results = runtests, assertSuccess(results);
5248
```
5349
5450
## Run MATLAB Command
55-
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.
5652

5753
Input | Description
5854
------------------------- | ---------------
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>
6157

6258
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:
6359

@@ -70,7 +66,7 @@ When you use this action, all of the required files must be on the MATLAB search
7066
## See Also
7167
- [Action for Running MATLAB Builds](https://github.com/matlab-actions/run-build/)
7268
- [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/)
7470
- [Continuous Integration with MATLAB and Simulink](https://www.mathworks.com/solutions/continuous-integration.html)
7571

7672
## Contact Us

0 commit comments

Comments
 (0)