forked from eclipse/xtext-xtend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
89 lines (76 loc) · 3.23 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
node {
properties([
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '15']],
disableConcurrentBuilds(),
parameters([
choice(choices: 'oxygen\nphoton\nr201809\nlatest', description: 'Which Target Platform should be used?', name: 'target_platform')
])
])
stage('Checkout') {
sh '''
if [ -d ".git" ]; then
git reset --hard
fi
'''
checkout scm
if ("latest" == params.target_platform) {
currentBuild.displayName = "#${BUILD_NUMBER}(x)"
} else if ("r201809" == params.target_platform) {
currentBuild.displayName = "#${BUILD_NUMBER}(q)"
} else if ("photon" == params.target_platform) {
currentBuild.displayName = "#${BUILD_NUMBER}(p)"
} else {
currentBuild.displayName = "#${BUILD_NUMBER}(o)"
}
sh '''
branchname=${1:-master}
escaped() {
echo $branchname | sed 's/\\//%252F/g'
}
escapedBranch=$(escaped)
sed_inplace() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "$@"
else
sed -i "$@"
fi
}
targetfiles="$(find releng -type f -iname '*.target')"
for targetfile in $targetfiles
do
echo "Redirecting target platforms in $targetfile to $branchname"
sed_inplace "s?<repository location=\\".*/job/\\([^/]*\\)/job/[^/]*/?<repository location=\\"$JENKINS_URL/job/\\1/job/$escapedBranch/?" $targetfile
done
'''
}
stage('Gradle Build') {
sh "./gradlew clean cleanGenerateXtext build createLocalMavenRepo -PuseJenkinsSnapshots=true -PJENKINS_URL=$JENKINS_URL -PcompileXtend=true -PignoreTestFailures=true --refresh-dependencies --continue"
step([$class: 'JUnitResultArchiver', testResults: '**/build/test-results/test/*.xml'])
}
def mvnHome = tool 'M3'
env.M2_HOME = "${mvnHome}"
dir('.m2/repository/org/eclipse/xtext') { deleteDir() }
dir('.m2/repository/org/eclipse/xtend') { deleteDir() }
stage('Maven Plugin Build') {
sh "${mvnHome}/bin/mvn -f maven-pom.xml --batch-mode --update-snapshots -fae -PuseJenkinsSnapshots -DJENKINS_URL=$JENKINS_URL -Dmaven.test.failure.ignore=true -Dmaven.repo.local=${workspace}/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean deploy"
}
stage('Maven Tycho Build') {
def targetProfile = "-Poxygen"
if ("latest" == params.target_platform) {
targetProfile = "-Platest"
} else if ("r201809" == params.target_platform) {
targetProfile = "-Pr201809"
} else if ("photon" == params.target_platform) {
targetProfile = "-Pphoton"
}
wrap([$class:'Xvnc', useXauthority: true]) {
sh "${mvnHome}/bin/mvn -f tycho-pom.xml --batch-mode -fae -Dmaven.test.failure.ignore=true -DJENKINS_URL=$JENKINS_URL -Dmaven.repo.local=${workspace}/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn ${targetProfile} clean install"
}
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/*.xml'])
}
stage('Gradle Longrunning Tests') {
sh "./gradlew longrunningTest -PuseJenkinsSnapshots=true -PJENKINS_URL=$JENKINS_URL -PignoreTestFailures=true --continue"
step([$class: 'JUnitResultArchiver', testResults: '**/build/test-results/longrunningTest/*.xml'])
}
archive 'build/**, **/target/work/data/.metadata/.log, **/hs_err_pid*.log'
}