Skip to content

Commit edaa063

Browse files
committed
Add Manual test job to jenkins
1 parent fe019a4 commit edaa063

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.jenkins/test.jenkins

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/************************************************************************************
2+
3+
Manual job used to test to build a branch on jenkins
4+
Take 1 parameters (BRANCH).
5+
6+
Checks out current ${BRANCH}'s HEAD
7+
8+
*************************************************************************************/
9+
pipeline {
10+
agent any
11+
parameters {
12+
string(
13+
name: 'BRANCH',
14+
defaultValue: 'master',
15+
description: 'The branch to build. Examples: master, 1.x')
16+
booleanParam(
17+
name: 'TEST_WITH_TOOLCHAIN',
18+
defaultValue: false,
19+
description: 'To execute tests using toolchain')
20+
string(
21+
name: 'JDK_TOOLCHAIN_VERSION',
22+
defaultValue: '',
23+
description: 'The jdk version used to execute tests when `TEST_WITH_TOOLCHAIN` is used. (e.g. 1.7 1.8 11 17 21 ...). By default, this is an empty string which means use minimal supported java version')
24+
}
25+
tools {
26+
maven 'apache-maven-latest'
27+
jdk 'temurin-jdk11-latest'
28+
}
29+
options {
30+
timeout (time: 30, unit: 'MINUTES')
31+
buildDiscarder(logRotator(numToKeepStr: '3'))
32+
disableConcurrentBuilds()
33+
skipDefaultCheckout()
34+
durabilityHint('PERFORMANCE_OPTIMIZED')
35+
}
36+
stages {
37+
stage('Build') {
38+
steps {
39+
// Checkout code
40+
git url: 'git@github.com:eclipse-leshan/leshan.git',
41+
credentialsId: 'github-bot-ssh',
42+
branch: '${BRANCH}'
43+
44+
// Build
45+
sh ''' mvn -B com.github.ekryd.sortpom:sortpom-maven-plugin:verify -PallPom '''
46+
// This ssh agent is needed to cache yarn/node to download.eclipse.org when using -PeclipseJenkins
47+
// see : https://github.com/eclipse-leshan/leshan/pull/1484
48+
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
49+
sh ''' mvn -B clean install javadoc:javadoc -PeclipseJenkins -DskipTests'''
50+
}
51+
52+
53+
// test with
54+
// - given toolchain version
55+
// - OR minimal version supported
56+
// - OR jvm used to build.
57+
sh '''
58+
if [[ $TEST_WITH_TOOLCHAIN == true ]]; then
59+
if [[ -n $JDK_TOOLCHAIN_VERSION ]]; then
60+
mvn -B test -PuseToolchain -Dskip.yarn -Dtoolchain.version="${JDK_TOOLCHAIN_VERSION}"
61+
else
62+
mvn -B test -PuseToolchain -Dskip.yarn
63+
fi
64+
else
65+
mvn -B test -Dskip.yarn
66+
fi
67+
'''
68+
69+
// Copy artifacts
70+
sh ''' cp leshan-server-demo/target/leshan-server-demo-*-jar-with-dependencies.jar leshan-server-demo.jar
71+
cp leshan-bsserver-demo/target/leshan-bsserver-demo-*-jar-with-dependencies.jar leshan-bsserver-demo.jar
72+
cp leshan-client-demo/target/leshan-client-demo-*-jar-with-dependencies.jar leshan-client-demo.jar
73+
'''
74+
}
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)