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
Copy file name to clipboardExpand all lines: README.md
+42-18Lines changed: 42 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,37 @@
1
1
# Action for Setting Up MATLAB on GitHub-Hosted Runner
2
2
3
-
Before you run MATLAB® code and Simulink® models on a [GitHub®-hosted](https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners) runner, first use the [Setup MATLAB](#set-up-matlab) action. The action sets up the specified MATLAB release on a Linux® virtual machine. If you do not specify a release, the action sets up the latest release of MATLAB.
3
+
Before you run MATLAB® code and Simulink® models on a [GitHub®-hosted](https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners) runner, first use the [Setup MATLAB](#set-up-matlab) action. The action sets up the specified MATLAB release on a Linux®or Windows®virtual machine. If you do not specify a release, the action sets up the latest release of MATLAB.
4
4
5
-
The **Setup MATLAB** action is not supported on [self-hosted](https://docs.github.com/en/free-pro-team@latest/actions/hosting-your-own-runners/about-self-hosted-runners) runners. Currently, it is available only for public projects. It does not set up transformation products, such as MATLAB Coder™ and MATLAB Compiler™.
5
+
The **Setup MATLAB** action is not supported on [self-hosted](https://docs.github.com/en/free-pro-team@latest/actions/hosting-your-own-runners/about-self-hosted-runners) runners. Public licensing is not available for transformation products, such as MATLAB Coder™ and MATLAB Compiler™.
6
6
7
7
## Usage Examples
8
-
Once you set up MATLAB, you can use the runner to execute MATLAB scripts, functions, or statements. You also can use the runner to execute MATLAB and Simulink tests and generate artifacts. To execute code on the runner, include the [Run MATLAB Command](https://github.com/matlab-actions/run-command/) or [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/) actions in your workflow.
8
+
Once you set up MATLAB, you can build and test your MATLAB project as part of your workflow. To execute code on the runner, include the [Run MATLAB Build](https://github.com/matlab-actions/run-build/), [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/), or [Run MATLAB Command](https://github.com/matlab-actions/run-command/) actions in your workflow.
9
9
10
-
### Run MATLAB Script on GitHub-Hosted Runner
11
-
Set up a GitHub-hosted runner to run the commands in a file named `myscript.m` in the root of your repository. To run the script, include the [Run MATLAB Command](https://github.com/matlab-actions/run-command/) action in your workflow.
10
+
### Run MATLAB Build on GitHub-Hosted Runner
11
+
Set up a GitHub-hosted runner to run a specific task and its depended-on tasks that are specified in a file named `buildfile.m` in the root of your repository. To run tasks using the MATLAB build tool, include the [Run MATLAB Build](https://github.com/matlab-actions/run-build/) action in your workflow. This action is supported in MATLAB R2022b and later.
12
12
13
13
```yaml
14
-
name: Run MATLAB Script on GitHub-Hosted Runner
14
+
name: Run MATLAB Build on GitHub-Hosted Runner
15
15
on: [push]
16
16
jobs:
17
17
my-job:
18
-
name: Run MATLAB Script
18
+
name: Run MATLAB Build
19
19
runs-on: ubuntu-latest
20
20
steps:
21
21
- name: Check out repository
22
-
uses: actions/checkout@v2
22
+
uses: actions/checkout@v3
23
23
- name: Set up MATLAB
24
-
uses: matlab-actions/setup-matlab@v1
25
-
- name: Run script
26
-
uses: matlab-actions/run-command@v1
24
+
uses: matlab-actions/setup-matlab@v2-beta
25
+
with:
26
+
products: Simulink Simulink_Test
27
+
- name: Run build
28
+
uses: matlab-actions/run-build@v1
27
29
with:
28
-
command: myscript
30
+
tasks: test
29
31
```
30
32
31
33
### Run MATLAB Tests on GitHub-Hosted Runner
32
-
Set up a GitHub-hosted runner to automatically run the tests in your [MATLAB project](https://www.mathworks.com/help/matlab/projects.html) and generate a JUnit test results report and a Cobertura code coverage report. To run the tests and generate the artifacts, include the [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/) action in your workflow.
34
+
Set up a GitHub-hosted runner to run the tests in your [MATLAB project](https://www.mathworks.com/help/matlab/projects.html) and generate a JUnit test results report and a Cobertura code coverage report. To run the tests and generate the artifacts, include the [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/) action in your workflow.
Set up a GitHub-hosted runner to run the commands in a file named `myscript.m` in the root of your repository. To run the script, include the [Run MATLAB Command](https://github.com/matlab-actions/run-command/) action in your workflow.
57
+
58
+
```yaml
59
+
name: Run MATLAB Script on GitHub-Hosted Runner
60
+
on: [push]
61
+
jobs:
62
+
my-job:
63
+
name: Run MATLAB Script
64
+
runs-on: ubuntu-latest
65
+
steps:
66
+
- name: Check out repository
67
+
uses: actions/checkout@v3
68
+
- name: Set up MATLAB
69
+
uses: matlab-actions/setup-matlab@v2-beta
70
+
- name: Run script
71
+
uses: matlab-actions/run-command@v1
72
+
with:
73
+
command: myscript
74
+
```
75
+
53
76
## Set Up MATLAB
54
77
When you define your workflow in the `.github/workflows` directory of your repository, specify the **Setup MATLAB** action as `matlab-actions/setup-matlab@v1`. The action accepts an optional input.
55
78
56
79
| Input | Description |
57
80
|-----------|-------------|
58
-
| `release` | (Optional) MATLAB release to set up. You can specify R2020a or a later release. If you do not specify `release`, the action sets up the latest release of MATLAB.<br/>**Example**: `R2021a`
59
-
81
+
| `release` | (Optional) MATLAB release to set up. You can specify R2020a or a later release. If you do not specify `release`, the action sets up the latest release of MATLAB.<br/>**Example**: `R2022a`
82
+
| `products` | (Optional) Space-separated list of products to install. If a product name contains white-space characters, replace them with underscores. For the full list of available products and their names, see [Products and Services](https://www.mathworks.com/products.html). By default, the task installs MATLAB and Parallel Computing Toolbox.<br/> **Example**: `Simulink`</br>**Example:** `Simulink Deep_Learning_Toolbox`
60
83
## Notes
61
84
When you use the **Setup MATLAB** action, you execute third-party code that is licensed under separate terms.
62
85
63
86
## See Also
64
-
- [Action for Running MATLAB Commands](https://github.com/matlab-actions/run-command/)
87
+
- [Action for Running MATLAB Builds](https://github.com/matlab-actions/run-build/)
65
88
- [Action for Running MATLAB Tests](https://github.com/matlab-actions/run-tests/)
89
+
- [Action for Running MATLAB Commands](https://github.com/matlab-actions/run-command/)
66
90
- [Continuous Integration with MATLAB and Simulink](https://www.mathworks.com/solutions/continuous-integration.html)
Verify changes by running tests and building locally with the following command:
4
+
5
+
```
6
+
npm run ci
7
+
```
8
+
9
+
## Creating a New Release
10
+
11
+
Familiarize yourself with the best practices for [releasing and maintaining GitHub actions](https://docs.github.com/en/actions/creating-actions/releasing-and-maintaining-actions).
12
+
13
+
Changes should be made on a new branch. The new branch should be merged to the main branch via a pull request. Ensure that all of the CI pipeline checks and tests have passed for your changes.
14
+
15
+
After the pull request has been approved and merged to main, follow the Github process for [creating a new release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository). The release must follow semantic versioning (ex: vX.Y.Z). This will kick off a new pipeline execution, and the action will automatically be published to the GitHub Actions Marketplace if the pipeline finishes successfully. Check the [GitHub Marketplace](https://github.com/marketplace/actions/setup-matlab) and check the major version in the repository (ex: v1 for v1.0.0) to ensure that the new semantically versioned tag is available.
0 commit comments