As part of some side testing of my day job, I have developed a workflow
script to build and test Maven core... once I can get Workflow onto
builds.apache.org we can see to adapt this some more, but if anyone is
interested.
This flow will build on linux with JDK 7 and then run the integration tests
on JDK7 and 8 in parallel. I want to add in Windows builds, but I am
currently blocked by the excessive directory tree depth in the core
integration tests and I need to set up a custom workspace to be able to
check out the integration tests on windows...
A nice to have alternative might be to package up the integration tests
into a .jar and run from the .jar as that would make running the more
portable.
In any case here is the workflow script (if we wanted to turn this into a
Jenkinsfile so that we could get Pull Request validation we would only have
to change `dir('maven-core') { git 'https://github.com/apache/maven.git' }`
to `dir('maven-core') { checkout scm }` on line 3):
stage 'build'
node('linux') {
dir('maven-core') { git 'https://github.com/apache/maven.git' }
def jdk = tool name: '1.7.0_80', type: 'hudson.model.JDK'
def mvn = tool name: '3.3.9', type:
'hudson.tasks.Maven$MavenInstallation'
sh "export JAVA_HOME=${jdk} ; cd maven-core ; ${mvn}/bin/mvn -B clean
verify -Dmaven.repo.local=`pwd`/../repo"
step([$class: 'JUnitResultArchiver', testResults:
'**/target/surefire-reports/TEST-*.xml'])
stash includes: 'maven-core/apache-maven/target/apache-*.tar.gz', name:
'tars'
stash includes: 'maven-core/apache-maven/target/apache-*.zip', name:
'zips'
}
stage 'test'
parallel jdk7: {
node('linux') {
sh "mkdir -p maven-core; rm -rvf maven-core"
unstash 'zips'
dir('maven-its') { git '
https://github.com/apache/maven-integration-testing.git' }
def jdk = tool name: '1.7.0_80', type: 'hudson.model.JDK'
sh 'for dir in maven-core/apache-maven/target/apache-*-bin.zip ; do
unzip ${dir}; done;'
sh 'for dir in apache-maven-*; do rm -rf maven-dist; mv ${dir}
maven-dist; done'
sh 'cd maven-dist; export MAVEN_HOME="`pwd -P`"; export PATH="`pwd
-P`/bin":$PATH; cd ../maven-its; ' +
"export JAVA_HOME=${jdk}; " +
"mvn -B clean install -Prun-its,embedded
-Dmaven.repo.local=`pwd`/repo -Dmaven.test.failure.ignore=true"
step([$class: 'JUnitResultArchiver', testResults:
'**/core-it-suite/target/surefire-reports/TEST-*.xml'])
}
}, jdk8: {
node('linux') {
sh "mkdir -p maven-core; rm -rvf maven-core"
unstash 'zips'
dir('maven-its') { git '
https://github.com/apache/maven-integration-testing.git' }
def jdk = tool name: '1.8.0_65', type: 'hudson.model.JDK'
sh 'for dir in maven-core/apache-maven/target/apache-*-bin.zip ; do
unzip ${dir}; done;'
sh 'for dir in apache-maven-*; do rm -rf maven-dist; mv ${dir}
maven-dist; done'
sh 'cd maven-dist; export MAVEN_HOME="`pwd -P`"; export PATH="`pwd
-P`/bin":$PATH; cd ../maven-its; ' +
"export JAVA_HOME=${jdk}; " +
"mvn -B clean install -Prun-its,embedded
-Dmaven.repo.local=`pwd`/repo -Dmaven.test.failure.ignore=true"
step([$class: 'JUnitResultArchiver', testResults:
'**/core-it-suite/target/surefire-reports/TEST-*.xml'])
}
}
stage 'deploy'
node('linux') {
unstash 'zips'
unstash 'tars'
archive 'maven-core/apache-maven/target/apache-*.tar.gz
maven-core/apache-maven/target/apache-*.zip'
}