Create Jenkins Project - nthakur34/JenkinsGithub GitHub Wiki

Create Jenkins Project

Create a New Item from the side bar and give it a name. Now select "Freestyle project". Afterwords, configure your project.

  1. Select "Github Project" under Description box, and enter the Github project URL, e.g. https://github.com/user/project
  1. Select Git as the Source Code Management with the repository URL (https://github.com/user/project.git). Add the branch you want to build to. In our case we use the "test" branch, so type "*/test".

  2. Under that same section, add an additional behavior, "Merge before build". Set the name of the repository (usually 'origin'), and the branch to merge to (in this case 'master'). Leave the rest with the default settings.

  1. next add the Build Trigger. In our case we would build periodically. Select the question mark next to the schedule box to properly understand scheduling syntax. To set as 12:00am daily, type "0 0 * * *" into the box.(1) (<<< Click for more info)

  2. Now add a Post-build action. Select "Git Publisher" and the options, "Publish Only if build Succeeds" and "Merge Results". Then add "master" as the "Branch to Push". Then "origin" as the "Target remote name"

  1. the Build step is explained below in its own section.

  2. Add any other actions you want! Add xunit steps to the Build or TAP settings in the Pos-Build. It may also be wise to add E-mail notifications for failed builds

Build Step

First off, make sure that your project is under the main MATLAB directory where projects tend to be created. Then it would be wise to test if matlab works properly from the command prompt.

Windows

Issues are likely to arise since your machine is different from mine but here is an example of what a command on mine looks like after selecting "Execute Windows Batch command":

start /wait matlab -nodesktop -nosplash -minimize -wait -r "addpath(genpath('C:\Users\username\Documents\Matlab\Test')); test2" -logfile unittestlog.txt

set output=%errorlevel%

MORE unittestlog.txt

EXIT %output%

I set a starting command which opens matlab without the entire IDE, waits for it to load, then performs the function in parenthesis. In this case I add a folder with its sub-directories to the path. My example has it named as "Test" but it should be replaced by "CERR". after the semi-colon, the script name can be run directly (in this case, test2). The logfile is used to obtain Matlab output because Jenkins on windows makes this difficult , while the output is set as the error level. an error level of zero means the testing scripts ended without an error, while any number greater signifies a failure. The Matlab function is expected to return the proper value however, so tests should be thorough and correct.(2)

Linux

To be added


Next: Additional Info

⚠️ **GitHub.com Fallback** ⚠️