Main Content

Continuous Integration with MATLAB on CI Platforms

You can use different continuous integration (CI) platforms to run MATLAB® code and Simulink® models as part of your automated pipeline of tasks. In addition, the MATLAB unit testing framework enables you to create a test suite and a test runner, and customize your test runner for continuous integration workflows with the plugin classes in the matlab.unittest.plugins package.

To facilitate running and testing software with continuous integration, MATLAB seamlessly integrates with several CI platforms, such as Azure® DevOps, CircleCI®, and Jenkins™. You can use these platforms to:

  • Run MATLAB scripts, functions, and statements in your pipeline.

  • Run MATLAB and Simulink tests and generate artifacts, such as JUnit test results and Cobertura code coverage reports.

Depending on the CI platform, you might:

  • Configure your pipeline using a script or user interface.

  • Set up the platform to run MATLAB on premises or in the cloud.

Azure DevOps

To perform continuous integration with MATLAB on Azure DevOps, install an extension to your Azure DevOps organization. To run MATLAB in your pipeline, use the extension to author your pipeline YAML in a file named azure-pipelines.yml in the root of your repository. You can run your pipeline using self-hosted or Linux®-based Microsoft®-hosted agents. For more information, see the extension on Visual Studio Marketplace.

CircleCI

To perform continuous Integration with MATLAB on CircleCI, opt-in to using third-party orbs in your organization security settings. To run MATLAB in your pipeline, import the appropriate orb to author your pipeline YAML in a file named .circleci/config.yml in the root of your repository. CircleCI runs your pipeline using a Linux machine executor in the cloud. For more information, see the orb on CircleCI Orb Registry.

Jenkins

To perform continuous integration with MATLAB on Jenkins, install a plugin on your Jenkins agent. Then, you can use an interface to run MATLAB in freestyle and multi-configuration (matrix) projects. You also can configure your pipeline as code checked into source control. For more information, see the plugin on Jenkins Plugins Index.

Other Platforms

To perform continuous integration with MATLAB on other CI platforms, use the matlab command with the -batch option in your pipeline. You can use matlab -batch to run MATLAB scripts, functions, and statements noninteractively. For example, matlab -batch "myscript" starts MATLAB noninteractively and runs the commands in a file named myscript.m. MATLAB terminates automatically with exit code 0 if the specified script, function, or statement executes successfully without error. Otherwise, MATLAB terminates with a nonzero exit code.

See Also

Related Topics