This replaces the old and probably outdated work in progress documentation about Jenkins which can still be found here: JenkinsSetupOld.

This page is currently not up to date with respect to the changes related to Phabricator.

Installation

Basic installation

Additional plugins

  • xUnit plugin for unit tests

Configuration

I'm still testing different settings and configurations, but the settings listed at the end of this page should be a good base to get a working Jenkins setup. It basically polls SVN for changes, then does svn update, runs update-workspaces.sh and make. After that it executes the unit tests and checks if they all pass. This procedure is done for a debug and a release configuration.

Unit test configuration

You can configure Jenkins to run our unit tests and report the results on the web interface. The test executable can be configured and built to produce an xUnit compliant xml file with the test results.

  1. Install the xUnit plugin
  2. In the project configuration, make sure to pass the argument --jenkins-tests to update-workspaces.sh
  3. In the execute shell section, add this script for running the tests. It also contains a small fix for an incompatibility with the xUnit format used by Jenkins.
    #!/bin/bash
    cd 0ad/binaries/system
    echo "releasetype: $releasetype"
    if [ "$releasetype" == "debug" ]; then
        ./test_dbg > ../../../cxxtest_result_$releasetype.xml
    else
        ./test > ../../../cxxtest_result_$releasetype.xml
    fi
    sed -i 's/date/timestamp/g' ../../../cxxtest_result_$releasetype.xml
    
  4. Add a post-build action to "Publish xUnit test report" as described in the configuration section.

Jenkins config.xml

This is the config.xml from /var/lib/jenkins/jobs/0ad. It should contain all required information to configure Jenkins. This format should be sufficient as long as the whole setup and the configuration is not final yet.

<?xml version='1.0' encoding='UTF-8'?>
<matrix-project>
  <actions/>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties/>
  <scm class="hudson.scm.SubversionSCM" plugin="subversion@1.54">
    <locations>
      <hudson.scm.SubversionSCM_-ModuleLocation>
        <remote>http://svn.wildfiregames.com/public/ps/trunk</remote>
        <local>0ad</local>
        <depthOption>infinity</depthOption>
        <ignoreExternalsOption>false</ignoreExternalsOption>
      </hudson.scm.SubversionSCM_-ModuleLocation>
    </locations>
    <excludedRegions></excludedRegions>
    <includedRegions></includedRegions>
    <excludedUsers></excludedUsers>
    <excludedRevprop></excludedRevprop>
    <excludedCommitMessages></excludedCommitMessages>
    <workspaceUpdater class="hudson.scm.subversion.UpdateUpdater"/>
    <ignoreDirPropChanges>false</ignoreDirPropChanges>
    <filterChangelog>false</filterChangelog>
  </scm>
  <canRoam>true</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers>
    <hudson.triggers.SCMTrigger>
      <spec>*/10 * * * *</spec>
      <ignorePostCommitHooks>false</ignorePostCommitHooks>
    </hudson.triggers.SCMTrigger>
  </triggers>
  <concurrentBuild>false</concurrentBuild>
  <axes>
    <hudson.matrix.TextAxis>
      <name>releasetype</name>
      <values>
        <string>debug</string>
        <string>release</string>
      </values>
    </hudson.matrix.TextAxis>
  </axes>
  <builders>
    <hudson.tasks.Shell>
      <command>0ad/build/workspaces/update-workspaces.sh -j3 --jenkins-tests --with-system-enet --with-system-nvtt
</command>
    </hudson.tasks.Shell>
    <hudson.tasks.Shell>
      <command>cd 0ad/build/workspaces/gcc
make -j3 config=$releasetype</command>
    </hudson.tasks.Shell>
    <hudson.tasks.Shell>
      <command>#!/bin/bash
cd 0ad/binaries/system
echo &quot;releasetype: $releasetype&quot;
if [ &quot;$releasetype&quot; == &quot;debug&quot; ]; then
  ./test_dbg &gt; ../../../cxxtest_result_$releasetype.xml
else
  ./test &gt; ../../../cxxtest_result_$releasetype.xml
fi
sed -i &apos;s/date/timestamp/g&apos; ../../../cxxtest_result_$releasetype.xml</command>
    </hudson.tasks.Shell>
  </builders>
  <publishers>
    <xunit plugin="xunit@1.84">
      <types>
        <JUnitType>
          <pattern>cxxtest_result_$releasetype.xml</pattern>
          <skipNoTestFiles>false</skipNoTestFiles>
          <failIfNotNew>true</failIfNotNew>
          <deleteOutputFiles>false</deleteOutputFiles>
          <stopProcessingIfError>true</stopProcessingIfError>
        </JUnitType>
      </types>
      <thresholds>
        <org.jenkinsci.plugins.xunit.threshold.FailedThreshold>
          <unstableThreshold></unstableThreshold>
          <unstableNewThreshold></unstableNewThreshold>
          <failureThreshold></failureThreshold>
          <failureNewThreshold></failureNewThreshold>
        </org.jenkinsci.plugins.xunit.threshold.FailedThreshold>
        <org.jenkinsci.plugins.xunit.threshold.SkippedThreshold>
          <unstableThreshold></unstableThreshold>
          <unstableNewThreshold></unstableNewThreshold>
          <failureThreshold></failureThreshold>
          <failureNewThreshold></failureNewThreshold>
        </org.jenkinsci.plugins.xunit.threshold.SkippedThreshold>
      </thresholds>
      <thresholdMode>1</thresholdMode>
      <extraConfiguration>
        <testTimeMargin>3000</testTimeMargin>
      </extraConfiguration>
    </xunit>
  </publishers>
  <buildWrappers/>
  <executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
    <runSequentially>false</runSequentially>
  </executionStrategy>
</matrix-project>
Last modified 2 months ago Last modified on Jan 23, 2017 12:07:54 PM