Integrate Process into Other CI Platforms
With the CI Support Package for Simulink, you can define a development and verification process for your team and run that process as a pipeline in CI. You can use any of the MATLAB®-supported Continuous Integration (CI) platforms to run your automated pipeline of tasks. For more information on the supported platforms, see Continuous Integration with MATLAB on CI Platforms.
Before You Integrate
Your process model file defines the pipeline of tasks that the runprocess
function runs in CI. If you do not already have a process model, the support package includes process model templates that you can use to get started. For more information, see Automate and Run Tasks with Process Advisor.
Before you try to run your process as part of an automated pipeline of tasks in CI, you must connect your CI platform, remote repository, and project.
Create a remote repository for your project. Many CI platforms provide source-controlled remote repositories as part of their platform. But for other CI platforms you might must host your remote repository on another platform. See the documentation for your chosen CI platform to identify how you want to set up your remote repository.
Set up a build agent. Your build agent is responsible for running MATLAB and communicating the results back to your chosen CI platform. Depending on the CI platform, you can set up the platform to run MATLAB on your own, self-hosted machine or in the cloud. Make sure that your build agent can run MATLAB and that you install the support package and any other products required by your process. For information on licensing considerations, Docker® containers, and virtual displays, see Tips for Setting Up CI Agents.
Connect your project, remote repository, and CI platform by adding the remote URL to your local repository. For more information, see Share Git Repository to Remote.
Make sure that your process model file is available on the MATLAB path for your build agent. As a best practice, keep your process model file in the project root folder and add the process model file to the project.
Run MATLAB in Batch Mode
To run your process in CI, you can use the matlab
command with the
-batch
option in your CI system. You can use matlab
-batch
to run MATLAB code, including the runprocess
function,
noninteractively. For example, you can start MATLAB noninteractively, open the project, and run each of the tasks in the
pipeline defined by the process model file (processmodel.p
or
processmodel.m
) in the
project.
matlab -batch "openProject(pwd);[~,exitCode] = runprocess();exit(exitCode);"
MATLAB terminates automatically with the exit code 0
if the specified code executes successfully without generating an error. Otherwise, MATLAB terminates with a nonzero exit code.