]> git.ipfire.org Git - pakfire.git/commitdiff
jenkins: Run build and tests before running coverage tests
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 28 Nov 2024 11:32:14 +0000 (11:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 28 Nov 2024 11:32:14 +0000 (11:32 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Jenkinsfile

index 1ddd4e387666cdb8b7ca0b4a05f138313bef1d03..2074de4cba5ca114d33ccf35b297da1ee164556e 100644 (file)
@@ -2,6 +2,117 @@ pipeline {
        agent none
 
        stages {
+               /*
+                       Run the build and test suite on various distributions...
+               */
+               stage("Run Tests on Multiple Distributions") {
+                       matrix {
+                               axes {
+                                       axis {
+                                               name "DISTRO"
+                                               values \
+                                                       "archlinux:base-devel", \
+                                                       "debian:trixie", \
+                                                       "debian:bookworm-backports", \
+                                                       "fedora:latest", \
+                                                       "fedora:rawhide", \
+                                                       "ubuntu:24.10", \
+                                                       "ubuntu:24.04"
+                                       }
+
+                                       axis {
+                                               name "COMPILER"
+                                               values "gcc", "clang"
+                                       }
+                               }
+
+                               agent {
+                                       docker {
+                                               image "${DISTRO}"
+
+                                               // Run as root inside the containers to install dependencies
+                                               args "--privileged -u root"
+
+                                               customWorkspace "${JOB_NAME}/${BUILD_ID}/${env.DISTRO.replace(":", "-")}/${env.COMPILER}"
+                                       }
+                               }
+
+                               stages {
+                                       stage("Install Dependencies") {
+                                               steps {
+                                                       script {
+                                                               // Arch Linux
+                                                               if (env.DISTRO.contains("archlinux")) {
+                                                                       installBuildDepsArchLinux(env.DISTRO, env.COMPILER)
+
+                                                               // Fedora, Alma Linux, etc.
+                                                               } else if (env.DISTRO.contains("fedora") || env.DISTRO.contains("almalinux")) {
+                                                                       installBuildDepsRedHat(env.DISTRO, env.COMPILER)
+
+                                                               // Debian & Ubuntu
+                                                               } else if (env.DISTRO.contains("debian") || env.DISTRO.contains("ubuntu")) {
+                                                                       installBuildDepsDebian(env.DISTRO, env.COMPILER)
+                                                               }
+                                                       }
+                                               }
+                                       }
+
+                                       stage("Configure") {
+                                               steps {
+                                                       // Run autogen
+                                                       sh "./autogen.sh"
+
+                                                       // Run ./configure...
+                                                       sh "CC=${env.COMPILER} ./configure --prefix=/usr --enable-debug"
+                                               }
+
+                                               post {
+                                                       failure {
+                                                               archiveArtifacts artifacts: "config.log",
+                                                                       allowEmptyArchive: true
+
+                                                               echo "config.log has been archived"
+                                                       }
+                                               }
+                                       }
+
+                                       stage("Build") {
+                                               steps {
+                                                       sh "make"
+                                               }
+                                       }
+
+                                       stage("Check") {
+                                               steps {
+                                                       script {
+                                                               try {
+                                                                       sh "make check"
+                                                               } catch (Exception e) {
+                                                                       unstable("Failed on ${env.DISTRO} with ${env.COMPILER}...")
+                                                               }
+                                                       }
+                                               }
+
+                                               post {
+                                                       always {
+                                                               // Copy test logs into a special directory
+                                                               sh """
+                                                                       mkdir -pv tests/${DISTRO}/${COMPILER}
+                                                                       find tests -name "*.log" | xargs --no-run-if-empty \
+                                                                               cp --verbose --parents --target-directory=tests/${DISTRO}/${COMPILER}/
+                                                               """
+
+                                                               // Archive the logs only if the stage fails
+                                                               archiveArtifacts artifacts: "tests/${DISTRO}/${COMPILER}/**/*"
+
+                                                               echo "The test logs have been archived"
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
                stage("Coverage Tests") {
                        parallel {
                                /*
@@ -128,117 +239,6 @@ pipeline {
                        }
                }
 
-               /*
-                       Run the build and test suite on various distributions...
-               */
-               stage("Run Tests on Multiple Distributions") {
-                       matrix {
-                               axes {
-                                       axis {
-                                               name "DISTRO"
-                                               values \
-                                                       "archlinux:base-devel", \
-                                                       "debian:trixie", \
-                                                       "debian:bookworm-backports", \
-                                                       "fedora:latest", \
-                                                       "fedora:rawhide", \
-                                                       "ubuntu:24.10", \
-                                                       "ubuntu:24.04"
-                                       }
-
-                                       axis {
-                                               name "COMPILER"
-                                               values "gcc", "clang"
-                                       }
-                               }
-
-                               agent {
-                                       docker {
-                                               image "${DISTRO}"
-
-                                               // Run as root inside the containers to install dependencies
-                                               args "--privileged -u root"
-
-                                               customWorkspace "${JOB_NAME}/${BUILD_ID}/${env.DISTRO.replace(":", "-")}/${env.COMPILER}"
-                                       }
-                               }
-
-                               stages {
-                                       stage("Install Dependencies") {
-                                               steps {
-                                                       script {
-                                                               // Arch Linux
-                                                               if (env.DISTRO.contains("archlinux")) {
-                                                                       installBuildDepsArchLinux(env.DISTRO, env.COMPILER)
-
-                                                               // Fedora, Alma Linux, etc.
-                                                               } else if (env.DISTRO.contains("fedora") || env.DISTRO.contains("almalinux")) {
-                                                                       installBuildDepsRedHat(env.DISTRO, env.COMPILER)
-
-                                                               // Debian & Ubuntu
-                                                               } else if (env.DISTRO.contains("debian") || env.DISTRO.contains("ubuntu")) {
-                                                                       installBuildDepsDebian(env.DISTRO, env.COMPILER)
-                                                               }
-                                                       }
-                                               }
-                                       }
-
-                                       stage("Configure") {
-                                               steps {
-                                                       // Run autogen
-                                                       sh "./autogen.sh"
-
-                                                       // Run ./configure...
-                                                       sh "CC=${env.COMPILER} ./configure --prefix=/usr --enable-debug"
-                                               }
-
-                                               post {
-                                                       failure {
-                                                               archiveArtifacts artifacts: "config.log",
-                                                                       allowEmptyArchive: true
-
-                                                               echo "config.log has been archived"
-                                                       }
-                                               }
-                                       }
-
-                                       stage("Build") {
-                                               steps {
-                                                       sh "make"
-                                               }
-                                       }
-
-                                       stage("Check") {
-                                               steps {
-                                                       script {
-                                                               try {
-                                                                       sh "make check"
-                                                               } catch (Exception e) {
-                                                                       unstable("Failed on ${env.DISTRO} with ${env.COMPILER}...")
-                                                               }
-                                                       }
-                                               }
-
-                                               post {
-                                                       always {
-                                                               // Copy test logs into a special directory
-                                                               sh """
-                                                                       mkdir -pv tests/${DISTRO}/${COMPILER}
-                                                                       find tests -name "*.log" | xargs --no-run-if-empty \
-                                                                               cp --verbose --parents --target-directory=tests/${DISTRO}/${COMPILER}/
-                                                               """
-
-                                                               // Archive the logs only if the stage fails
-                                                               archiveArtifacts artifacts: "tests/${DISTRO}/${COMPILER}/**/*"
-
-                                                               echo "The test logs have been archived"
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-
                stage("Debian Packages") {
                        stages {
                                stage("Build Debian Packages") {