| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
The Run MATLAB Command action enables you to execute MATLAB® scripts, functions, and statements on a GitHub®-hosted or self-hosted runner:
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.
On a self-hosted runner that has MATLAB installed, run a script named myscript.m in the root of your repository. To run the script, specify the Run MATLAB Command action in your workflow.
name: Run MATLAB Script
on: [push]
jobs:
my-job:
name: Run MATLAB Script
runs-on: self-hosted
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Run script
uses: matlab-actions/run-command@v3
with:
command: myscriptUsing the latest release of MATLAB on a GitHub-hosted runner, run your MATLAB statements. To set up the latest release of MATLAB on the runner, specify the Setup MATLAB action in your workflow. To run the statements, specify the Run MATLAB Command action.
name: Run MATLAB Statements
on: [push]
jobs:
my-job:
name: Run MATLAB Statements
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v3
- name: Run statements
uses: matlab-actions/run-command@v3
with:
command: results = runtests, assertSuccess(results);When you define a workflow using the Setup MATLAB action, you need a MATLAB batch licensing token if your project is private or if your workflow uses transformation products, such as MATLAB Coder™ and MATLAB Compiler™. Batch licensing tokens are strings that enable MATLAB to start in noninteractive environments. You can request a token by submitting the MATLAB Batch Licensing Pilot form.
To use a MATLAB batch licensing token:
For example, use the latest release of MATLAB on a GitHub-hosted runner to run a script named myscript.m in your private project. To set up the latest release of MATLAB on the runner, specify the Setup MATLAB action in your workflow. To run the script, specify the Run MATLAB Command action. In this example, MyToken is the name of the secret that holds the batch licensing token.
name: Use MATLAB Batch Licensing Token
on: [push]
env:
MLM_LICENSE_TOKEN: ${{ secrets.MyToken }}
jobs:
my-job:
name: Run MATLAB Script in Private Project
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v3
- name: Run script
uses: matlab-actions/run-command@v3
with:
command: myscriptWhen you define your workflow in the .github/workflows directory of your repository, specify the Run MATLAB Command action as matlab-actions/run-command@v3. The action requires an input and also accepts optional inputs.
| Input | Description |
|---|---|
| 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. 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 action to fail. To fail the action in certain conditions, use the assert or error function. Example: command: myscript |
| generate-summary | (Optional) Option to generate summaries of build and test results in the GitHub job summary, specified as true or false. By default, the value is true. If you specify a value of false, the action does not generate build and test summaries in the GitHub job summary. When the value is true, the action generates a summary of build results if it runs a build using the MATLAB build tool. The action also generates a summary of test results if it runs tests using a matlab.buildtool.tasks.TestTask instance through a MATLAB build or using a default test runner. You can create a default test runner using the matlab.unittest.TestRunner.withDefaultPlugins method. For more information about build and test summaries, see View Build Results and View Test and Coverage Results. Example: generate-summary: false |
| startup-options | (Optional) MATLAB startup options, specified as a list of options separated by spaces. For more information about startup options, see Commonly Used Startup Options. Using this input to specify the -batch or -r option is not supported. Example: startup-options: -nojvm |
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, cd, or run 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:
command: addpath("myfolder"), myscript
If you encounter a product licensing issue, consider requesting a MATLAB batch licensing token to use in your workflow. For more information, see Use MATLAB Batch Licensing Token.
If you have an enhancement request or other feedback about this action, create an issue on the Issues page.
For support, contact MathWorks Technical Support.
| Back | FazBrowse Home | New Git URL |