🏗️ Add Jenkinsfile
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 4 Oct 2024 18:39:52 +0000 (20:39 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 4 Oct 2024 18:39:52 +0000 (20:39 +0200)
Also, configuration JaCoCo to build the correct reports.

Jenkinsfile [new file with mode: 0644]
build.gradle

diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644 (file)
index 0000000..096a33d
--- /dev/null
@@ -0,0 +1,63 @@
+pipeline {
+    agent any
+
+    options {
+        timestamps()
+    }
+
+    stages {
+        stage('Build (Java 8)') {
+            tools {
+                jdk 'OpenJDK 8'
+            }
+            steps {
+                sh './gradlew --no-daemon clean classes testClasses'
+            }
+        }
+        stage('Test (Java 8)') {
+            tools {
+                jdk 'OpenJDK 8'
+            }
+            steps {
+                sh './gradlew --no-daemon test jacocoTestReport'
+            }
+            post {
+                always {
+                    junit 'build/test-results/*/*.xml'
+                    recordCoverage(tools: [[parser: 'JACOCO', pattern: '**/jacocoTestReport.xml']])
+                }
+            }
+        }
+        stage('Binary (Java 8)') {
+            tools {
+                jdk 'OpenJDK 8'
+            }
+            steps {
+                sh './gradlew --no-daemon fatJar'
+                archiveArtifacts artifacts: 'build/libs/rhynodge-*-jar-with-dependencies.jar', fingerprint: true
+            }
+        }
+        stage('Compatibility (Java 17)') {
+            tools {
+                jdk 'OpenJDK 17'
+            }
+            steps {
+                catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
+                    sh './gradlew --no-daemon clean test'
+                }
+            }
+        }
+        stage('Compatibility (Java 21)') {
+            tools {
+                jdk 'OpenJDK 21'
+            }
+            steps {
+                catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
+                    sh './gradlew --no-daemon clean test'
+                }
+            }
+        }
+    }
+}
+
+// vi: ts=4 sw=4 et si
index 9e286ff..73f1df8 100644 (file)
@@ -108,4 +108,10 @@ jacoco {
     toolVersion = "0.8.11"
 }
 
+jacocoTestReport {
+    reports {
+        xml.required = true
+    }
+}
+
 /* vim: set ts=4 sw=4 et: */