mw-hrastega / Travis-Doc

README for adding MATLAB language to Travis CI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building a MATLAB Project

To run MATLAB® code and Simulink® models as part of your pipeline, specify the value matlab in your .travis.yml file.

language: matlab

When you include language: matlab in your .travis.yml:

  • Travis CI installs the latest release of MATLAB on a Linux®-based build agent.
  • MATLAB runs the tests in your repository and fails the build if any of the tests fails.

If your source code is organized into files and folders within a MATLAB project, then MATLAB runs any test files in the project that have been labeled as Test. If your code does not leverage a MATLAB project, then MATLAB runs all tests in the root of your repository, including its subfolders.

You can override the default test run and generate artifacts by creating a test runner and customizing the runner with the plugin classes in the matlab.unittest.plugins package. For more information on how to specify and run MATLAB commands, see Run Custom MATLAB Commands.

Run Custom MATLAB Commands

You can specify the script key in your .travis.yml to build on the functionality provided bylanguage: matlab. To run custom MATLAB commands in your pipeline, use the matlab command with the -batch option. matlab -batch starts MATLAB noninteractively and runs the specified script, function, or statement. For example, call the disp function as part of your pipeline.

language: matlab
script: matlab -batch 'disp("Hello World")'

If you need to specify more than one MATLAB command, use a comma or semicolon to separate the commands.

language: matlab
script: matlab -batch 'results = runtests, assertSuccess(results);'

You can write a MATLAB script or function as part of your repository and execute this script or function. For example, run the commands in a file named myscript.m in the root of your repository. (To run a MATLAB script or function, do not specify the file extension.)

language: matlab
script: matlab -batch 'myscript'

MATLAB exits with exit code 0 if the specified script, function, or statement executes successfully without error. Otherwise, MATLAB terminates with a nonzero exit code, which causes the build to fail. You can use the assert or error functions in your code to ensure that builds fail when necessary.

See Also

Continuous Integration (MATLAB)
Continuous Integration (Simulink Test)

Contact Us

If you have any questions or suggestions, please contact MathWorks® at continuous-integration@mathworks.com.

About

README for adding MATLAB language to Travis CI