This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch feature/SLING-7597
in repository https://gitbox.apache.org/repos/asf/sling-ide-tooling.git


The following commit(s) were added to refs/heads/feature/SLING-7597 by this 
push:
     new 164ad93  SLING-7597 - Investigate setting up Windows testing
164ad93 is described below

commit 164ad938c78da033f0a35d5b68cdaaa4cc6f71f8
Author: Robert Munteanu <[email protected]>
AuthorDate: Wed Feb 27 09:45:16 2019 +0100

    SLING-7597 - Investigate setting up Windows testing
    
    Generalise step definitions
---
 Jenkinsfile | 107 ++++++++++++++++++++++++------------------------------------
 1 file changed, 42 insertions(+), 65 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 484c2b2..59a8fbe 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -4,85 +4,62 @@ def mvnVersion = 'Maven 3.3.9'
 def javaVersion = 'JDK 1.8 (latest)'
 
 node('ubuntu') {
-
     def helper = new SlingJenkinsHelper()
     helper.runWithErrorHandling({ jobConfig ->
-        parallel 'linux': {
-            stage('[linux] Build shared code') {
-                withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
-                    timeout(10) {
-                        sh "mvn -f shared/modules clean install"
-                    }
-                }
-            }
+        parallel 'linux': generateStages('linux'),
+            'windows': generateStages('windows')
+    })
+}
 
-            stage('[linux] Build CLI bundles') {
-                withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
-                    timeout(10) {
-                        sh "mvn -f cli clean install"
-                    }
-                }
-            }
+// generates os-specific stages
+def generateStages(String os) {
+    def prefix = os == "windows" ? "win" : "linux"
+    def shellStep = os == "windows" ? "bat" : "script"
 
-            stage ('[linux] Build shared code P2 repository') {
-                withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
-                    timeout(10) {
-                        sh 'mvn -f shared/p2 clean package'
-                    }
+    def stages = {
+        stage("[$prefix] Build shared code") {
+            withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
+                timeout(10) {
+                    $shellStep  "mvn -f shared/modules clean install"
                 }
             }
+        }
 
-            stage ('[linux] Build Eclipse plug-ins') {
-                withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
-                    timeout(20) {
-                        wrap([$class: 'Xvfb']) {
-                            sh 'mvn -f eclipse clean verify -Ddebug'
-                        }
-                        // workaround for 
https://issues.jenkins-ci.org/browse/JENKINS-55889
-                        junit 'eclipse/**/surefire-reports/*.xml' 
-                        archiveArtifacts artifacts: 'eclipse/**/logs/*.log'
-                    }
+        stage("[$prefix] Build CLI bundles") {
+            withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
+                timeout(10) {
+                    $shellStep "mvn -f cli clean install"
                 }
             }
-        }, 'windows': {
-            node('Windows') {
-                stage('[win] Build shared code') {
-                    withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
-                        timeout(10) {
-                            bat  "mvn -f shared/modules clean install"
-                        }
-                    }
-                }
-
-                stage('[win] Build CLI bundles') {
-                    withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
-                        timeout(10) {
-                            bat "mvn -f cli clean install"
-                        }
-                    }
-                }
+        }
 
-                stage ('[win] Build shared code P2 repository') {
-                    withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
-                        timeout(10) {
-                            bat 'mvn -f shared/p2 clean package'
-                        }
-                    }
+        stage ("[$prefix] Build shared code P2 repository") {
+            withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
+                timeout(10) {
+                    $shellStep 'mvn -f shared/p2 clean package'
                 }
+            }
+        }
 
-                stage ('[win] Build Eclipse plug-ins') {
-                    withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
-                        timeout(20) {
-                            wrap([$class: 'Xvfb']) {
-                                bat 'mvn -f eclipse clean verify -Ddebug'
-                            }
-                            // workaround for 
https://issues.jenkins-ci.org/browse/JENKINS-55889
-                            junit 'eclipse/**/surefire-reports/*.xml' 
-                            archiveArtifacts artifacts: 'eclipse/**/logs/*.log'
-                        }
+        stage ("[$prefix] Build Eclipse plug-ins") {
+            withMaven(maven: mvnVersion, jdk: javaVersion, options: 
[artifactsPublisher(disabled: true)]) {
+                timeout(20) {
+                    wrap([$class: 'Xvfb']) {
+                        $shellStep 'mvn -f eclipse clean verify -Ddebug'
                     }
+                    // workaround for 
https://issues.jenkins-ci.org/browse/JENKINS-55889
+                    junit 'eclipse/**/surefire-reports/*.xml' 
+                    archiveArtifacts artifacts: 'eclipse/**/logs/*.log'
                 }
             }
+        }        
+    }
+
+    if ( os == "windows") {
+        return node('Windows') {
+            stages
         }
-    })
+    }
+
+    return stages
 }
\ No newline at end of file

Reply via email to