diff --git a/1-gradle-build.sh b/1-gradle-build.sh new file mode 100755 index 000000000..a31855352 --- /dev/null +++ b/1-gradle-build.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +if [ -z "$JENKINS_URL" ]; then + # if not set in environment use default + JENKINS_URL=https://ci.eclipse.org/xtext/ +fi + +./gradlew \ + clean cleanGenerateXtext build createLocalMavenRepo \ + -PuseJenkinsSnapshots=true \ + -PJENKINS_URL=$JENKINS_URL \ + -PcompileXtend=true \ + -PignoreTestFailures=true \ + --refresh-dependencies \ + --continue \ + $@ diff --git a/2-maven-build.sh b/2-maven-build.sh new file mode 100755 index 000000000..8dabde412 --- /dev/null +++ b/2-maven-build.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +if [ -z "$JENKINS_URL" ]; then + # if not set in environment use default + JENKINS_URL=https://ci.eclipse.org/xtext/ +fi + +mvn \ + -f releng \ + --batch-mode \ + --update-snapshots \ + -Dmaven.repo.local=.m2/repository \ + -DJENKINS_URL=$JENKINS_URL \ + -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ + $@ + diff --git a/CBI.Jenkinsfile b/CBI.Jenkinsfile new file mode 100644 index 000000000..8de17b6b8 --- /dev/null +++ b/CBI.Jenkinsfile @@ -0,0 +1,71 @@ +pipeline { + agent any + + options { + buildDiscarder(logRotator(numToKeepStr:'15')) + disableConcurrentBuilds() + } + + tools { + // see https://wiki.eclipse.org/Jenkins#Jenkins_configuration_and_tools_.28clustered_infra.29 + maven 'apache-maven-latest' + jdk 'oracle-jdk8-latest' + } + + // https://jenkins.io/doc/book/pipeline/syntax/#triggers + triggers { + pollSCM('H/5 * * * *') + } + + // Build stages + stages { + stage('Checkout') { + steps { + checkout scm + } + } + + stage('Gradle Build') { + steps { + sh './1-gradle-build.sh' + step([$class: 'JUnitResultArchiver', testResults: '**/build/test-results/test/*.xml']) + } + } + + stage('Maven Build') { + steps { + sh './2-maven-build.sh' + } + } + } + + post { + success { + archiveArtifacts artifacts: 'build/**' + } + changed { + script { + def envName = '' + if (env.JENKINS_URL.contains('ci.eclipse.org/xtext')) { + envName = ' (JIPP)' + } else if (env.JENKINS_URL.contains('jenkins.eclipse.org/xtext')) { + envName = ' (CBI)' + } else if (env.JENKINS_URL.contains('typefox.io')) { + envName = ' (TF)' + } + + def curResult = currentBuild.currentResult + def color = '#00FF00' + if (curResult == 'SUCCESS' && currentBuild.previousBuild != null) { + curResult = 'FIXED' + } else if (curResult == 'UNSTABLE') { + color = '#FFFF00' + } else if (curResult == 'FAILURE') { + color = '#FF0000' + } + + slackSend message: "${curResult}: <${env.BUILD_URL}|${env.JOB_NAME}#${env.BUILD_NUMBER}${envName}>", botUser: true, channel: 'xtext-builds', color: "${color}" + } + } + } +} diff --git a/releng/pom.xml b/releng/pom.xml index c31969d7e..97f549064 100644 --- a/releng/pom.xml +++ b/releng/pom.xml @@ -160,6 +160,7 @@ + install org.eclipse.tycho