💚 Build once on Java 8 and once on Java 17
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 30 Sep 2024 16:59:07 +0000 (18:59 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 1 Oct 2024 09:22:00 +0000 (11:22 +0200)
Jenkinsfile

index e058c32..8311a71 100644 (file)
@@ -6,7 +6,7 @@ pipeline {
     }
 
     stages {
-        stage('Build') {
+        stage('Build (Java 8)') {
             tools {
                 jdk 'OpenJDK 8'
             }
@@ -14,7 +14,7 @@ pipeline {
                 sh './gradlew clean classes testClasses'
             }
         }
-        stage('Test') {
+        stage('Test (Java 8)') {
             tools {
                 jdk 'OpenJDK 8'
             }
@@ -24,10 +24,11 @@ pipeline {
             post {
                 always {
                     junit 'build/test-results/*/*.xml'
+                    jacoco classPattern: 'build/classes/*/main', sourcePattern: '**/src/main/'
                 }
             }
         }
-        stage('Binary') {
+        stage('Binary (Java 8)') {
             tools {
                 jdk 'OpenJDK 8'
             }
@@ -36,13 +37,24 @@ pipeline {
                 archiveArtifacts artifacts: 'build/libs/sone*-jar-with-dependencies.jar', fingerprint: true
             }
         }
-        stage('Reports') {
+        stage('Build (Java 17)') {
             tools {
-                jdk 'OpenJDK 8'
+                jdk 'OpenJDK 17'
+            }
+            steps {
+                catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
+                    sh './gradlew clean classes testClasses'
+                }
+            }
+        }
+        stage('Test (Java 17)') {
+            tools {
+                jdk 'OpenJDK 17'
             }
             steps {
-                sh './gradlew jacocoTestReport'
-                jacoco classPattern: 'build/classes/*/main', sourcePattern: '**/src/main/'
+                catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
+                    sh './gradlew test'
+                }
             }
         }
     }