Main Content

Integrate Process into Other CI Platforms

With the CI/CD Automation for Simulink Check support package, 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 need to connect your CI platform, remote repository, and project.

  1. 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 need to 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.

  2. Set up a CI agent. Your CI agent machine 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 CI 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.

  3. Connect your project, remote repository, and CI platform. On the Project tab, in the Source Control section, click Remote and specify the URL for your remote repository. For more information, see Use Source Control with Projects.

  4. Make sure that your process model file is available on the MATLAB path for your CI 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.

See Also

|

Related Topics