{"id":22384739,"url":"https://github.com/matlab-actions/setup-matlab","last_synced_at":"2025-04-04T19:09:32.944Z","repository":{"id":38081965,"uuid":"317288196","full_name":"matlab-actions/setup-matlab","owner":"matlab-actions","description":"Set up your GitHub Actions workflow with a specific version of MATLAB.","archived":false,"fork":false,"pushed_at":"2025-04-02T06:36:16.000Z","size":2611,"stargazers_count":79,"open_issues_count":16,"forks_count":14,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-04T03:02:42.769Z","etag":null,"topics":["mathworks","matlab","simulink"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matlab-actions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-30T16:52:10.000Z","updated_at":"2025-04-02T06:35:47.000Z","dependencies_parsed_at":"2023-10-02T15:57:46.712Z","dependency_job_id":"6cc8a892-9a7e-4261-a52a-db7932005919","html_url":"https://github.com/matlab-actions/setup-matlab","commit_stats":{"total_commits":146,"total_committers":8,"mean_commits":18.25,"dds":0.4383561643835616,"last_synced_commit":"7c1f1fb69e16ea2d0c2411940049b0b4559be735"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matlab-actions%2Fsetup-matlab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matlab-actions%2Fsetup-matlab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matlab-actions%2Fsetup-matlab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matlab-actions%2Fsetup-matlab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matlab-actions","download_url":"https://codeload.github.com/matlab-actions/setup-matlab/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mathworks","matlab","simulink"],"created_at":"2024-12-05T01:19:03.880Z","updated_at":"2025-04-04T19:09:32.914Z","avatar_url":"https://github.com/matlab-actions.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Action for Setting Up MATLAB\n\nThe [Setup MATLAB](#set-up-matlab) action enables you to set up MATLAB\u0026reg; and other MathWorks\u0026reg; products on a [GitHub\u0026reg;-hosted](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners) (Linux\u0026reg;, Windows\u0026reg;, or macOS) runner or [self-hosted](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners) UNIX\u0026reg; (Linux or macOS) runner. When you specify this action as part of your workflow, the action sets up your preferred MATLAB release (R2021a or later) on the runner. If you do not specify a release, the action sets up the latest release of MATLAB. As part of the setup process, the action prepends MATLAB to the `PATH` system environment variable.\n\n\u003e**Note:** For GitHub-hosted runners, the **Setup MATLAB** action automatically includes the dependencies required to run MATLAB and other MathWorks products. However, if you are using a self-hosted runner, you must ensure that the required dependencies are available on your runner. For details, see [Required Software on Self-Hosted Runners](#required-software-on-self-hosted-runners).\n\n## Examples\nOnce you set up MATLAB on a runner, 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/) action in your workflow.\n\n### Run Default Tasks in Build File\nUsing the latest release of MATLAB on a GitHub-hosted runner, run the default tasks in a build file named `buildfile.m` in the root of your repository as well as all the tasks on which they depend. To set up the latest release of MATLAB on the runner, specify the **Setup MATLAB** action in your workflow. To run the tasks, specify the [Run MATLAB Build](https://github.com/matlab-actions/run-build/) action.\n\n```yaml\nname: Run Default Tasks in Build File\non: [push]\njobs:\n  my-job:\n    name: Run MATLAB Build\n    runs-on: ubuntu-latest\n    steps:\n      - name: Check out repository\n        uses: actions/checkout@v4\n      - name: Set up MATLAB\n        uses: matlab-actions/setup-matlab@v2\n      - name: Run build\n        uses: matlab-actions/run-build@v2\n```\n\n### Run Tests in Parallel\nRun your MATLAB and Simulink\u0026reg; tests in parallel (requires Parallel Computing Toolbox\u0026trade;) using the latest release of the required products on a GitHub-hosted runner. To set up the latest release of MATLAB, Simulink, Simulink Test, and Parallel Computing Toolbox on the runner, specify the **Setup MATLAB** action with its `products` input in your workflow. To run the tests in parallel, specify the [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/) action with its `use-parallel` input specified as `true`.\n\n```YAML\nname: Run Tests in Parallel\non: [push]\njobs:\n  my-job:\n    name: Run MATLAB and Simulink Tests\n    runs-on: ubuntu-latest\n    steps:\n      - name: Check out repository\n        uses: actions/checkout@v4\n      - name: Set up products\n        uses: matlab-actions/setup-matlab@v2\n        with:\n          products: \u003e\n            Simulink\n            Simulink_Test\n            Parallel_Computing_Toolbox\n      - name: Run tests\n        uses: matlab-actions/run-tests@v2\n        with:\n          use-parallel: true\n``` \n\n### Run MATLAB Script\nUsing the latest release of MATLAB on a GitHub-hosted runner, run a script named `myscript.m` in the root of your repository. 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](https://github.com/matlab-actions/run-command/) action.\n\n```yaml\nname: Run MATLAB Script\non: [push]\njobs:\n  my-job:\n    name: Run MATLAB Script\n    runs-on: ubuntu-latest\n    steps:\n      - name: Check out repository\n        uses: actions/checkout@v4\n      - name: Set up MATLAB\n        uses: matlab-actions/setup-matlab@v2\n      - name: Run script\n        uses: matlab-actions/run-command@v2\n        with:\n          command: myscript\n```\n\n### Use MATLAB Batch Licensing Token\nWhen you define a workflow using the **Setup MATLAB** action, you need a [MATLAB batch licensing token](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/alternates/non-interactive/MATLAB-BATCH.md#matlab-batch-licensing-token) if your project is private or if your workflow includes transformation products, such as MATLAB Coder\u0026trade; and MATLAB Compiler\u0026trade;. 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](https://www.mathworks.com/support/batch-tokens.html) form. \n\nTo use a MATLAB batch licensing token:\n\n1. Set the token as a secret. For more information about secrets, see [Using secrets in GitHub Actions](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).\n2. Map the secret to an environment variable named `MLM_LICENSE_TOKEN` in your workflow. \n\nFor example, define a workflow that runs the tests in your private project by using the latest release of MATLAB on a self-hosted UNIX runner:\n- To set up the latest release of MATLAB on the self-hosted UNIX runner, specify the **Setup MATLAB** action in your workflow. (The runner must include all the dependencies required to run MATLAB.)\n- To run the tests, specify the [Run MATLAB Tests](https://github.com/matlab-actions/run-tests/) action. License MATLAB to run the tests by mapping a secret to the `MLM_LICENSE_TOKEN` environment variable in your workflow. In this example, `MyToken` is the name of the secret that holds the batch licensing token.\n\n```YAML\nname: Use MATLAB Batch Licensing Token\non: [push]\nenv:\n  MLM_LICENSE_TOKEN: ${{ secrets.MyToken }}\njobs:\n  my-job:\n    name: Run MATLAB Tests in Private Project\n    runs-on: self-hosted\n    steps:\n      - name: Check out repository\n        uses: actions/checkout@v4\n      - name: Set up MATLAB\n        uses: matlab-actions/setup-matlab@v2\n      - name: Run tests\n        uses: matlab-actions/run-tests@v2\n```\n\n### Build Across Multiple Platforms\nThe **Setup MATLAB** action supports the Linux, Windows, and macOS platforms. Define a matrix of job configurations to run a build using the MATLAB build tool on all the supported platforms. This workflow runs three jobs, one for each value in the variable `os`. For more information about matrices, see [Using a matrix for your jobs](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs). \n\n```YAML\nname: Build Across Multiple Platforms\non: [push]\njobs:\n  my-job:\n    name: Run MATLAB Build\n    strategy:\n      matrix:\n        os: [ubuntu-latest, windows-latest, macos-latest]\n    runs-on: ${{ matrix.os }}\n    steps:\n      - name: Check out repository\n        uses: actions/checkout@v4\n      - name: Set up MATLAB\n        uses: matlab-actions/setup-matlab@v2\n      - name: Run build\n        uses: matlab-actions/run-build@v2\n        with:\n          tasks: test\n```\n\n## Set Up MATLAB\nWhen you define your workflow in the `.github/workflows` directory of your repository, specify the **Setup MATLAB** action as `matlab-actions/setup-matlab@v2`. The action accepts optional inputs.\n\n| Input     | Description |\n|-----------|-------------|\n| `release` | \u003cp\u003e(Optional) MATLAB release to set up. You can specify R2021a or a later release. By default, the value of `release` is `latest`, which corresponds to the latest release of MATLAB.\u003c/p\u003e\u003cp\u003e\u003cul\u003e\u003cli\u003eTo set up the latest update of a release, specify only the release name, for example, `R2024a`.\u003c/li\u003e\u003cli\u003eTo set up a specific update release, specify the release name with an update number suffix, for example, `R2024aU4`.\u003c/li\u003e\u003cli\u003eTo set up a release without updates, specify the release name with an update 0 or general release suffix, for example, `R2024aU0` or `R2024aGR`.\u003c/li\u003e\u003c/ul\u003e\u003c/p\u003e\u003cp\u003e**Example**: `release: R2024a`\u003cbr/\u003e**Example**: `release: latest`\u003cbr/\u003e**Example**: `release: R2024aU4`\u003c/p\u003e\n| `products` | \u003cp\u003e(Optional) Products to set up in addition to MATLAB, specified as a list of product names separated by spaces. You can specify `products` to set up most MathWorks products and support packages. The action uses [MATLAB Package Manager](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/MPM.md) (`mpm`) to set up products.\u003c/p\u003e\u003cp\u003eFor a list of supported products, open the input file for your preferred release from the [`mpm-input-files`](https://github.com/mathworks-ref-arch/matlab-dockerfile/tree/main/mpm-input-files) folder on GitHub. Specify products using the format shown in the input file, excluding the `#product.` prefix. For example, to set up Deep Learning Toolbox\u0026trade; in addition to MATLAB, specify `products: Deep_Learning_Toolbox`.\u003c/p\u003e\u003cp\u003eFor an example of how to use the `products` input, see [Run Tests in Parallel](#run-tests-in-parallel).\u003c/p\u003e\u003cp\u003e**Example**: `products: Simulink`\u003cbr/\u003e**Example:** `products: Simulink Deep_Learning_Toolbox`\u003c/p\u003e\n| `cache` | \u003cp\u003e(Optional) Option to enable caching with GitHub Actions, specified as `false` or `true`. By default, the value is `false` and the action does not store MATLAB and the specified products in a GitHub Actions cache for future use. For more information about caching with GitHub Actions, see [Caching dependencies to speed up workflows](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows).\u003c/p\u003e\u003cp\u003e**Example**: `cache: true`\u003c/p\u003e\n\n#### Required Software on Self-Hosted Runners\nBefore using the **Setup MATLAB** action to set up MATLAB and other MathWorks products on a self-hosted UNIX runner, verify that the required software is installed on your runner.\n\n##### Linux\nIf you are using a Linux runner, verify that the following software is installed on your runner:\n- Third-party packages required to run the `mpm` command — To view the list of `mpm` dependencies, refer to the Linux section of [Get MATLAB Package Manager](https://www.mathworks.com/help/install/ug/get-mpm-os-command-line.html).\n- All MATLAB dependencies — To view the list of MATLAB dependencies, go to the [MATLAB Dependencies](https://github.com/mathworks-ref-arch/container-images/tree/main/matlab-deps) repository on GitHub. Then, open the `\u003crelease\u003e/\u003csystem\u003e/base-dependencies.txt` file for your MATLAB release and your runner's operating system.\n\n##### macOS\nIf you are using a macOS runner with an Apple silicon processor, verify that Java\u0026reg; Runtime Environment (JRE\u0026trade;) is installed on your runner. For information about this requirement and to get a compatible JRE version, see [MATLAB on Apple Silicon Macs](https://www.mathworks.com/support/requirements/apple-silicon.html).\n\n\u003e**Tip:** One convenient way to include the required dependencies on a self-hosted runner is to specify the [MATLAB Dependencies container image on Docker\u0026reg; Hub](https://hub.docker.com/r/mathworks/matlab-deps) in your workflow.\n\n#### Licensing\nProduct licensing for your workflow depends on your project visibility as well as the type of products to set up:\n\n- Public project — If your workflow does not include transformation products, such as MATLAB Coder and MATLAB Compiler, then the action automatically licenses any products that you set up. If your workflow includes transformation products, you can request a [MATLAB batch licensing token](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/alternates/non-interactive/MATLAB-BATCH.md#matlab-batch-licensing-token) by submitting the [MATLAB Batch Licensing Pilot](https://www.mathworks.com/support/batch-tokens.html) form.\n- Private project — The action does not automatically license any products for you. You can request a batch licensing token by submitting the [MATLAB Batch Licensing Pilot](https://www.mathworks.com/support/batch-tokens.html) form.\n  \nTo use a MATLAB batch licensing token, first set it as a [secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions). Then, map the secret to an environment variable named `MLM_LICENSE_TOKEN` in your workflow. For an example, see [Use MATLAB Batch Licensing Token](#use-matlab-batch-licensing-token). \n\n## Notes\n- The **Setup MATLAB** action automatically includes the [MATLAB batch licensing executable](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/alternates/non-interactive/MATLAB-BATCH.md) (`matlab-batch`). To use a MATLAB batch licensing token in a workflow that does not use this action, you must first download the executable and add it to the system path.\n- When you use the **Setup MATLAB** action, you execute third-party code that is licensed under separate terms.\n\n## See Also\n- [Action for Running MATLAB Builds](https://github.com/matlab-actions/run-build/)\n- [Action for Running MATLAB Tests](https://github.com/matlab-actions/run-tests/)\n- [Action for Running MATLAB Commands](https://github.com/matlab-actions/run-command/)\n- [Continuous Integration with MATLAB and Simulink](https://www.mathworks.com/solutions/continuous-integration.html)\n\n## Contact Us\nIf you have any questions or suggestions, contact MathWorks at [continuous-integration@mathworks.com](mailto:continuous-integration@mathworks.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatlab-actions%2Fsetup-matlab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatlab-actions%2Fsetup-matlab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatlab-actions%2Fsetup-matlab/lists"}