775bc2ad17892d74a3029b0b761a24ad2e6d4119
wiki/ci.md
| ... | ... | @@ -1,59 +0,0 @@ |
| 1 | -# Continuous Integration with Hudson/Jenkins |
|
| 2 | - |
|
| 3 | -Our default Hudson runs on http://hudson.sapsailing.com. If you need access, please contact axel.uhl@sap.com or simon.marcel.pamies@sap.com. We have a build job running for the master branch which will automatically pick up any changes, run a build with tests and inform committers about flaws they introduced that broke the build. |
|
| 4 | - |
|
| 5 | -It is good practice to set up a new Hudson job for major branches that require solid testing before being merged into the master branch. The entry page at http://hudson.sapsailing.com explains how to do this. It basically comes down to copying a template job and adjusting the branch name. As easy as that :-) |
|
| 6 | - |
|
| 7 | -## Collecting measurements using Hudson/Jenkins |
|
| 8 | - |
|
| 9 | -If you have a test case that measures something, such as performance or level of fulfillment or any other numeric measure, you can have Hudson/Jenkins plot it. In your test case, use the class `com.sap.sailing.domain.test.measurements.MeasurementXMLFile` and add performance cases to which you add measurements, e.g., as follows: |
|
| 10 | -<pre> |
|
| 11 | - MeasurementXMLFile performanceReport = new MeasurementXMLFile(getClass()); |
|
| 12 | - MeasurementCase performanceReportCase = performanceReport.addCase(getClass().getSimpleName()); |
|
| 13 | - performanceReportCase.addMeasurement(new Measurement("My Measurement", theNumberIMeasured)); |
|
| 14 | - performanceReport.write(); |
|
| 15 | -</pre> |
|
| 16 | - |
|
| 17 | -## In case you'd like to set up your own Hudson/Jenkins |
|
| 18 | - |
|
| 19 | -Initially we had trouble with Jenkins and the GIT plug-in. However, https://issues.jenkins-ci.org/browse/JENKINS-13381?focusedCommentId=196689&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-196689 explains that installing the Credentials plugin into Jenkins may help. Basically, what is needed over and above a plain Jenkins installation are the following plug-ins: |
|
| 20 | - |
|
| 21 | -* Credentials |
|
| 22 | -* Jenkins GIT |
|
| 23 | -* Jenkins GIT Client |
|
| 24 | -* Measurement Plots |
|
| 25 | -* SSH Credentials |
|
| 26 | -* Xvnc |
|
| 27 | - |
|
| 28 | -Note, though that the Xvnc plug-in in version 1.16 seems to be causing some trouble (https://issues.jenkins-ci.org/browse/JENKINS-22105). Downgrading to 1.14 helps. The 1.14 .hpi file can be obtained, e.g., here: http://www.filewatcher.com/m/xvnc.hpi.21882-0.html. |
|
| 29 | - |
|
| 30 | -Make sure that the environment used to run Hudson/Jenkins uses a UTF-8 locale. Under Linux, it's a good idea to set the environment variables |
|
| 31 | -<pre> |
|
| 32 | - export LC_ALL=en_US.UTF-8 |
|
| 33 | - export LANG=us_US.UTF-8 |
|
| 34 | -</pre> |
|
| 35 | -which can, depending on how your Hudson/Jenkins is started, be included, e.g., in `/etc/init/jenkins` which then should have a section that looks like this: |
|
| 36 | -<pre> |
|
| 37 | -script |
|
| 38 | - [ -r /etc/default/jenkins ] && . /etc/default/jenkins |
|
| 39 | - export JENKINS_HOME |
|
| 40 | - export LC_ALL=en_US.UTF-8 |
|
| 41 | - export LANG=us_US.UTF-8 |
|
| 42 | - exec start-stop-daemon --start -c $JENKINS_USER --exec $JAVA --name jenkins \ |
|
| 43 | - -- $JAVA_ARGS -jar $JENKINS_WAR $JENKINS_ARGS --logfile=$JENKINS_LOG |
|
| 44 | -end script |
|
| 45 | -</pre> |
|
| 46 | -Other options for setting the locale include adding the LC_ALL and LANG variables to the `/etc/environment` file. |
|
| 47 | - |
|
| 48 | -The basic idea of setting up a build job is to create a so-called "free-style software project" which then executes our `configuration/buildAndUpdateProduct.sh` script using the `build` parameter. Top-down, the following adjustments to a default free-style job that are required for a successful build are these: |
|
| 49 | - |
|
| 50 | -* select "Git" |
|
| 51 | -* enter `ssh://trac@sapsailing.com/home/trac/git` as the Repository URL |
|
| 52 | -* create credentials using the `Add` button, e.g., pasting your private key and providing Jenkins with the password |
|
| 53 | -* enter `master` for "Branches to build" |
|
| 54 | -* under "Build Triggers" check "Poll SCM" and enter `H/1 * * * *` for the schedule which will check for updates in git every minute |
|
| 55 | -* under "Build Environment" check "Run Xvnc during build" |
|
| 56 | -* under "Build" select "Add build step" --> "Execute Shell" and paste as command something like this: `ANDROID_HOME=/usr/local/android-sdk-linux configuration/buildAndUpdateProduct.sh build`. Adjust the location of the Android SDK accordingly and install it if not already present. |
|
| 57 | -* as Post-build Action, select "Publish JUnit test result report" and as Test report XMLs provide `**/TEST-*.xml` as the file pattern for the test reports. |
|
| 58 | -* check the "Additional test reports features / Measurement Plots" box |
|
| 59 | -* provide e-mail notification settings as you see fit |
|
| ... | ... | \ No newline at end of file |
wiki/howto/development/ci.md
| ... | ... | @@ -0,0 +1,59 @@ |
| 1 | +# Continuous Integration with Hudson/Jenkins |
|
| 2 | + |
|
| 3 | +Our default Hudson runs on http://hudson.sapsailing.com. If you need access, please contact axel.uhl@sap.com or simon.marcel.pamies@sap.com. We have a build job running for the master branch which will automatically pick up any changes, run a build with tests and inform committers about flaws they introduced that broke the build. |
|
| 4 | + |
|
| 5 | +It is good practice to set up a new Hudson job for major branches that require solid testing before being merged into the master branch. The entry page at http://hudson.sapsailing.com explains how to do this. It basically comes down to copying a template job and adjusting the branch name. As easy as that :-) |
|
| 6 | + |
|
| 7 | +## Collecting measurements using Hudson/Jenkins |
|
| 8 | + |
|
| 9 | +If you have a test case that measures something, such as performance or level of fulfillment or any other numeric measure, you can have Hudson/Jenkins plot it. In your test case, use the class `com.sap.sailing.domain.test.measurements.MeasurementXMLFile` and add performance cases to which you add measurements, e.g., as follows: |
|
| 10 | +<pre> |
|
| 11 | + MeasurementXMLFile performanceReport = new MeasurementXMLFile(getClass()); |
|
| 12 | + MeasurementCase performanceReportCase = performanceReport.addCase(getClass().getSimpleName()); |
|
| 13 | + performanceReportCase.addMeasurement(new Measurement("My Measurement", theNumberIMeasured)); |
|
| 14 | + performanceReport.write(); |
|
| 15 | +</pre> |
|
| 16 | + |
|
| 17 | +## In case you'd like to set up your own Hudson/Jenkins |
|
| 18 | + |
|
| 19 | +Initially we had trouble with Jenkins and the GIT plug-in. However, https://issues.jenkins-ci.org/browse/JENKINS-13381?focusedCommentId=196689&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-196689 explains that installing the Credentials plugin into Jenkins may help. Basically, what is needed over and above a plain Jenkins installation are the following plug-ins: |
|
| 20 | + |
|
| 21 | +* Credentials |
|
| 22 | +* Jenkins GIT |
|
| 23 | +* Jenkins GIT Client |
|
| 24 | +* Measurement Plots |
|
| 25 | +* SSH Credentials |
|
| 26 | +* Xvnc |
|
| 27 | + |
|
| 28 | +Note, though that the Xvnc plug-in in version 1.16 seems to be causing some trouble (https://issues.jenkins-ci.org/browse/JENKINS-22105). Downgrading to 1.14 helps. The 1.14 .hpi file can be obtained, e.g., here: http://www.filewatcher.com/m/xvnc.hpi.21882-0.html. |
|
| 29 | + |
|
| 30 | +Make sure that the environment used to run Hudson/Jenkins uses a UTF-8 locale. Under Linux, it's a good idea to set the environment variables |
|
| 31 | +<pre> |
|
| 32 | + export LC_ALL=en_US.UTF-8 |
|
| 33 | + export LANG=us_US.UTF-8 |
|
| 34 | +</pre> |
|
| 35 | +which can, depending on how your Hudson/Jenkins is started, be included, e.g., in `/etc/init/jenkins` which then should have a section that looks like this: |
|
| 36 | +<pre> |
|
| 37 | +script |
|
| 38 | + [ -r /etc/default/jenkins ] && . /etc/default/jenkins |
|
| 39 | + export JENKINS_HOME |
|
| 40 | + export LC_ALL=en_US.UTF-8 |
|
| 41 | + export LANG=us_US.UTF-8 |
|
| 42 | + exec start-stop-daemon --start -c $JENKINS_USER --exec $JAVA --name jenkins \ |
|
| 43 | + -- $JAVA_ARGS -jar $JENKINS_WAR $JENKINS_ARGS --logfile=$JENKINS_LOG |
|
| 44 | +end script |
|
| 45 | +</pre> |
|
| 46 | +Other options for setting the locale include adding the LC_ALL and LANG variables to the `/etc/environment` file. |
|
| 47 | + |
|
| 48 | +The basic idea of setting up a build job is to create a so-called "free-style software project" which then executes our `configuration/buildAndUpdateProduct.sh` script using the `build` parameter. Top-down, the following adjustments to a default free-style job that are required for a successful build are these: |
|
| 49 | + |
|
| 50 | +* select "Git" |
|
| 51 | +* enter `ssh://trac@sapsailing.com/home/trac/git` as the Repository URL |
|
| 52 | +* create credentials using the `Add` button, e.g., pasting your private key and providing Jenkins with the password |
|
| 53 | +* enter `master` for "Branches to build" |
|
| 54 | +* under "Build Triggers" check "Poll SCM" and enter `H/1 * * * *` for the schedule which will check for updates in git every minute |
|
| 55 | +* under "Build Environment" check "Run Xvnc during build" |
|
| 56 | +* under "Build" select "Add build step" --> "Execute Shell" and paste as command something like this: `ANDROID_HOME=/usr/local/android-sdk-linux configuration/buildAndUpdateProduct.sh build`. Adjust the location of the Android SDK accordingly and install it if not already present. |
|
| 57 | +* as Post-build Action, select "Publish JUnit test result report" and as Test report XMLs provide `**/TEST-*.xml` as the file pattern for the test reports. |
|
| 58 | +* check the "Additional test reports features / Measurement Plots" box |
|
| 59 | +* provide e-mail notification settings as you see fit |
|
| ... | ... | \ No newline at end of file |