-
Notifications
You must be signed in to change notification settings - Fork 0
/
IntegrationTests.groovy
113 lines (109 loc) · 4.79 KB
/
IntegrationTests.groovy
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@Library('payara') _l1
@Library('util') _l2
def mavenVersion = 4
final def profiles = optionalMavenProfiles mavenVersion, 'payara-server-local,coverage-remote,all-tests'
final def profiles_no_stress = optionalMavenProfiles mavenVersion, 'payara-server-local,coverage-remote,ui-test'
def payara_config = [ domain_name : 'test-domain', jacoco_profile : profiles ]
def mvnCommandLine
def jbake_maven_project = 'jbake-maven'
pipeline {
agent any
options {
disableConcurrentBuilds()
quietPeriod 0
}
triggers {
pollSCM('@daily')
}
stages {
stage('Maven Info') {
steps {
sh "mvn -V -B -ntp -C -N -P$profiles help:all-profiles"
script {
currentBuild.description = "Commit ${env.GIT_COMMIT[0..7]} Node $env.NODE_NAME"
}
}
}
stage ('Set up Payara and Maven') {
steps {
startPayara payara_config
withMaven {
script {
mvnCommandLine =
"""
export MAVEN_OPTS="\$(eval echo \$MAVEN_OPTS)"
maven_interceptor_opts="\$(eval echo \$JAVA_TOOL_OPTIONS)"
unset JAVA_TOOL_OPTIONS
mvn -B -ntp -C -fae \$(eval echo \$MAVEN_ADD_OPTIONS) \$maven_interceptor_opts \
-Ddrone.chrome.binary="\$(eval echo \$CHROME_BINARY)" \
-Dmaven.test.failure.ignore=true -DtrimStackTrace=false \
-Dmaven.install.skip=true -DadminPort=$payara_config.admin_port \
-Dpayara.https.port=$payara_config.ssl_port -DjacocoPort=$payara_config.jacoco_port \
"""
}
}
}
}
stage('Maven Verify - All Tests') {
steps {
withMaven(options: [ jacocoPublisher(disabled: true) ]) {
sh "$mvnCommandLine verify -P${profiles}"
}
}
}
stage('Maven Deploy Javadoc and Snapshots') {
when {
expression { currentBuild.currentResult == 'SUCCESS' }
}
steps {
sh """
mvn -B -C validate jar:jar jar:test-jar javadoc:jar source:jar-no-fork \
deploy:deploy -fae -Dmaven.install.skip=true -Dcheckstyle.skip=true
"""
}
}
stage('Maven Deploy documentation') {
when {
allOf {
anyOf {
branch "main"
branch "master"
}
expression { currentBuild.currentResult == 'SUCCESS' && fileExists("${env.WORKSPACE}/docs/") }
}
}
steps {
sh """
export MAVEN_OPTS="\$MAVEN_OPTS --add-opens java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens java.base/java.io=ALL-UNNAMED"
mvn -B -C -ntp process-resources -Dsass.skip=true -f ${env.WORKSPACE}/docs/${jbake_maven_project}/
ssh ${websiteHost()} mkdir -p /var/flowlogix/html/javadoc/jee-apidocs \
/var/flowlogix/html/javadoc/datamodel-apidocs
rsync -aH --delete-after ${env.WORKSPACE}/docs/$jbake_maven_project/target/output/ \
${websiteHost()}:/var/flowlogix/html/docs/
rsync -aH --delete-after ${env.WORKSPACE}/jakarta-ee/flowlogix-jee/target/reports/apidocs/ \
${websiteHost()}:/var/flowlogix/html/javadoc/jee-apidocs/
rsync -aH --delete-after ${env.WORKSPACE}/jakarta-ee/flowlogix-datamodel/target/reports/apidocs/ \
${websiteHost()}:/var/flowlogix/html/javadoc/datamodel-apidocs/
"""
}
}
}
post {
always {
stopPayara payara_config
archiveArtifacts artifacts: '**/logs/server.log*'
checkLogs payara_config.asadmin ? '**/logs/server.log*' : null
}
success {
githubNotify description: 'Deploy Snapshots', context: 'CI/Deploy', status: 'SUCCESS',
targetUrl: 'https://s01.oss.sonatype.org/content/repositories/snapshots/com/flowlogix/'
}
changed {
mail to: "[email protected]", subject: "Jenkins: Project name -> ${env.JOB_NAME}",
body: "<b>Jenkins Build Status Change [${currentBuild.currentResult}]</b><br>" +
"Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br>Build URL: ${env.BUILD_URL}",
charset: 'UTF-8', mimeType: 'text/html'
}
}
}