|
1 | 1 | You can use the Jenkins™ plugin for MATLAB® in freestyle and multi-configuration projects. This guide demonstrates how to run MATLAB code on Jenkins, considering a Microsoft® Windows® platform. |
2 | 2 |
|
3 | | -- [Build Step Overview](#build-step-overview) |
| 3 | +- [Plugin Build Steps](#plugin-build-steps) |
4 | 4 | - [Freestyle Project Setup](#freestyle-project-setup) |
5 | 5 | - [Multi-Configuration Project Setup](#multi-configuration-project-setup) |
6 | 6 |
|
7 | 7 |
|
8 | | -## Build Step Overview |
9 | | -The plugin provides you with the **Run MATLAB Tests** and **Run MATLAB Command** build steps. With the Jenkins plugin for MATLAB, you have the option to run your tests in |
| 8 | +## Plugin Build Steps |
| 9 | +When you set up the Build **section** of the project configuration window, the plugin provides you with the **Run MATLAB Tests** and **Run MATLAB Command** build steps. |
10 | 10 |
|
11 | | -either *automatic* or *custom* mode. |
12 | 11 | ### Run MATLAB Tests |
13 | | -The automatic test mode uses a default setting to run tests written using the MATLAB Unit Testing Framework and/or Simulink Test. If your source code is organized as files and folders within a project, the plugin includes any test files in the project that have been tagged as **Test**. If your code does not leverage a project or uses a MATLAB release before R2019a, the plugin includes all tests in the current Jenkins workspace including the subfolders. |
| 12 | +This build step uses a default setting to run tests written using the MATLAB Unit Testing Framework and/or Simulink Test. If your source code is organized as files and folders within a MATLAB project, then the plugin includes any test files in the project that have been labeled as **Test**. If your code does not leverage a project or uses a MATLAB release before R2019a, the plugin includes all tests in the current Jenkins workspace including its subfolders. |
14 | 13 |
|
15 | | -If you use a source code management (SCM) system such as Git, then your job must include the appropriate SCM configuration to check out the code before it can invoke the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure that the code is available in the Jenkins workspace before the build starts **(What is this step?)**. |
| 14 | +If you use a source code management (SCM) system such as Git™, then your project must include the appropriate SCM configuration to check out the code before it can invoke the MATLAB plugin. If you do not use any SCM systems to manage your code, then an additional build step is required to ensure that the code is available in the Jenkins workspace before the build starts. |
16 | 15 |
|
17 | | -The automatic test execution feature of the plugin enables you to generate different types of test artifacts. To publish the test results, you can use these artifacts with other Jenkins plugins. |
18 | | - The selected artifacts will be saved in the **matlabTestArtifacts** folder of the Jenkins workspace. |
| 16 | +The automatic test execution enables you to generate different types of test artifacts. To publish the test results, you can use these artifacts with other Jenkins plugins. The selected artifacts are saved in the **matlabTestArtifacts** folder of the Jenkins workspace. If you do not select any of the test artifact check boxes, the folder is not created. However, the tests still run and test failures fail the build. |
19 | 17 |
|
20 | | - The automatic test mode results in a MATLAB script file named **runMatlabTests.m** in the Jenkins workspace. The plugin uses this file to run the tests and generate the test artifacts. You can review the contents of the script to understand the testing workflow. |
21 | | - **Note:** Producing a PDF test report is not currently supported on MacOS platforms. |
| 18 | + |
22 | 19 |
|
23 | | -  |
24 | | - |
25 | | - |
26 | | -If you do not select any of the test artifact check boxes, the **matlabTestArtifacts** folder is not created in the workspace. However, the tests still run and test failures fail the build. |
27 | | - |
| 20 | +The **Run MATLAB Tests** step produces a MATLAB script file named **runMatlabTests.m** in the Jenkins workspace. The plugin uses this file to run the tests and generate the test artifacts. You can review the contents of the script to understand the testing workflow. |
| 21 | + |
| 22 | +**Note:** Producing a PDF test report is not currently supported on MacOS platforms. |
28 | 23 |
|
29 | 24 | ### Run MATLAB Command |
30 | | -The custom test mode option enables you to develop custom MATLAB commands for running tests. |
31 | | - **Note:** If you need several MATLAB commands to run your tests, consider writing a MATLAB script or function as part of your repository and executing this script or function instead. Test artifacts are not autogenerated if you choose to run tests using custom MATLAB commands. You can generate your desired test artifacts by configuring the test runner in the script or function that you invoke from the **MATLAB command** box. |
| 25 | +The **Run MATLAB Command** build step enables you to specify custom MATLAB commands tailored to your specific needs. For example, you can use this build step to customize your test run. |
32 | 26 |
|
33 | 27 | If you specify more than one MATLAB command, use a comma or semicolon to separate the commands. The build fails if the execution of any command results in an error. |
34 | 28 |
|
35 | 29 |  |
36 | 30 |
|
37 | | - |
38 | | - |
| 31 | +If you need to specify several MATLAB commands, consider writing a MATLAB script or function as part of your repository and executing this script or function instead. |
| 32 | + |
| 33 | +Test artifacts are not autogenerated if you choose to run tests using this build step. You can generate your desired test artifacts by configuring the test runner in the script or function that you invoke from the **Command** box. |
| 34 | + |
39 | 35 | ## Freestyle Project Setup |
40 | | -To configure the plugin for a freestyle project, select **Use MATLAB Version** from the **Build Environment** section of the project configuration window. Then, enter the value returned by the **matlabroot** function in the **MATLAB root** box. To run |
| 36 | +To configure the plugin for a freestyle project, follow these steps: |
| 37 | + |
| 38 | +1) In the **Build Environment** section of the project configuration window, select **Use MATLAB Version**. Then, enter the value returned by the **matlabroot** function in the **MATLAB root** box. |
| 39 | + |
| 40 | + |
41 | 41 |
|
42 | 42 |  |
43 | 43 |
|
44 | | -### Run MATLAB Tests |
45 | | - To configure the Jenkins build so that MATLAB tests run automatically, follow these steps: |
46 | | - |
47 | | -1) From the **Test mode** drop-down list, select the **Automatic** option (**Automatic** is the default testing mode). |
48 | | - |
49 | | -2) Select your desired test artifacts. |
50 | | - |
51 | | -### Run MATLAB Command |
52 | | -To configure the Jenkins build so that you can customize the MATLAB test execution, follow these steps: |
53 | | - |
54 | | -1) From the **Test mode** drop-down list, select the **Custom** option. |
55 | | - |
56 | | -2) Enter your commands in the **MATLAB command** field. |
57 | | - |
| 44 | +2) Add the required build steps. |
| 45 | + * If you add the **Run MATLAB Tests** build step, select check boxes for the artifacts be generated in the project workspace. |
| 46 | + * If you add the **Run MATLAB Command** build step, enter your commands in the **Command** box. |
58 | 47 |
|
59 | 48 | ## Multi-Configuration Project Setup |
60 | 49 | In addition to freestyle projects, the Jenkins plugin for MATLAB supports [multi-configuration (matrix) projects](https://wiki.jenkins.io/display/JENKINS/Building+a+matrix+project). Multi-configuration projects are useful when builds include similar steps. For example: |
|
0 commit comments