jetty.project/Jenkinsfile

108 lines
3.6 KiB
Plaintext
Raw Normal View History

#!groovy
2018-08-14 16:39:08 -04:00
def jdk = 'jdk7'
2018-08-14 16:37:39 -04:00
node("linux") {
2016-07-28 15:00:24 -04:00
// System Dependent Locations
2018-08-14 16:32:37 -04:00
def mvntool = tool name: 'maven3.5', type: 'hudson.tasks.Maven$MavenInstallation'
2018-08-14 16:39:08 -04:00
def jdktool = tool name: "$jdk", type: 'hudson.model.JDK'
2018-08-14 16:32:37 -04:00
def mvnName = 'maven3.5'
def localRepo = "${env.JENKINS_HOME}/${env.EXECUTOR_NUMBER}" // ".repository" //
def settingsName = 'oss-settings.xml'
def mavenOpts = '-Xms1g -Xmx4g -XX:MaxPermSize=512m -Djava.awt.headless=true -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2'
2016-07-28 15:00:24 -04:00
// Environment
List mvnEnv = ["PATH+MVN=${mvntool}/bin", "PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}/", "MAVEN_HOME=${mvntool}"]
2018-08-14 16:32:37 -04:00
mvnEnv.add("MAVEN_OPTS=$mavenOpts")
2016-07-28 15:00:24 -04:00
2018-08-14 16:35:52 -04:00
stage('Checkout') {
checkout scm
2016-08-15 16:37:38 -04:00
}
2016-07-28 15:00:24 -04:00
2018-08-14 16:35:52 -04:00
stage('Compile') {
withEnv(mvnEnv) {
timeout(time: 15, unit: 'MINUTES') {
2018-08-14 16:39:58 -04:00
withMaven(
2018-08-14 16:35:52 -04:00
maven: mvnName,
jdk: "$jdk",
publisherStrategy: 'EXPLICIT',
globalMavenSettingsConfig: settingsName,
mavenOpts: mavenOpts,
mavenLocalRepo: localRepo) {
sh "mvn -B clean install -Dtest=None"
}
2016-09-20 16:00:57 -04:00
}
2016-08-15 16:37:38 -04:00
}
}
2016-07-28 15:00:24 -04:00
2018-08-14 16:35:52 -04:00
stage('Javadoc') {
withEnv(mvnEnv) {
timeout(time: 15, unit: 'MINUTES') {
2018-08-14 16:39:58 -04:00
withMaven(
2018-08-14 16:35:52 -04:00
maven: mvnName,
jdk: "$jdk",
publisherStrategy: 'EXPLICIT',
globalMavenSettingsConfig: settingsName,
mavenOpts: mavenOpts,
mavenLocalRepo: localRepo) {
sh "mvn -B javadoc:javadoc"
}
2016-09-20 16:00:57 -04:00
}
2016-08-15 16:37:38 -04:00
}
}
2016-07-28 15:00:24 -04:00
2018-08-14 16:37:39 -04:00
stage('Test') {
withEnv(mvnEnv) {
timeout(time: 60, unit: 'MINUTES') {
2018-08-14 16:39:58 -04:00
withMaven(
2018-08-14 16:37:39 -04:00
maven: mvnName,
jdk: "$jdk",
publisherStrategy: 'EXPLICIT',
globalMavenSettingsConfig: settingsName,
mavenOpts: mavenOpts,
mavenLocalRepo: localRepo) {
// Run test phase / ignore test failures
sh "mvn -B install -Dmaven.test.failure.ignore=true"
// Report failures in the jenkins UI
step([$class : 'JUnitResultArchiver',
testResults: '**/target/surefire-reports/TEST-*.xml'])
// Collect up the jacoco execution results
def jacocoExcludes =
// build tools
"**/org/eclipse/jetty/ant/**" +
",**/org/eclipse/jetty/maven/**" +
",**/org/eclipse/jetty/jspc/**" +
// example code / documentation
",**/org/eclipse/jetty/embedded/**" +
",**/org/eclipse/jetty/asyncrest/**" +
",**/org/eclipse/jetty/demo/**" +
// special environments / late integrations
",**/org/eclipse/jetty/gcloud/**" +
",**/org/eclipse/jetty/infinispan/**" +
",**/org/eclipse/jetty/osgi/**" +
",**/org/eclipse/jetty/spring/**" +
",**/org/eclipse/jetty/http/spi/**" +
// test classes
",**/org/eclipse/jetty/tests/**" +
",**/org/eclipse/jetty/test/**";
step([$class: 'JacocoPublisher',
inclusionPattern: '**/org/eclipse/jetty/**/*.class',
exclusionPattern: jacocoExcludes,
execPattern: '**/target/jacoco.exec',
classPattern: '**/target/classes',
sourcePattern: '**/src/main/java'])
// Report on Maven and Javadoc warnings
step([$class: 'WarningsPublisher',
consoleParsers: [
[parserName: 'Maven'],
[parserName: 'JavaDoc'],
[parserName: 'JavaC']
]])
}
2016-08-15 16:37:38 -04:00
}
}
2018-08-14 16:37:39 -04:00
}
2016-08-15 16:37:38 -04:00
}
2016-07-28 15:00:24 -04:00
// vim: et:ts=2:sw=2:ft=groovy