agent none
stages {
- /*
- Run Pakfire through Clang's Static Analyzer...
- */
- stage("Clang Static Analyzer") {
- agent {
- docker {
- image "debian:bookworm-backports"
+ stage("Coverage Tests") {
+ parallel {
+ /*
+ Run Pakfire through Clang's Static Analyzer...
+ */
+ stage("Clang Static Analyzer") {
+ agent {
+ docker {
+ image "debian:bookworm-backports"
- // Run as root inside the containers to install dependencies
- args "-u root"
+ // Run as root inside the containers to install dependencies
+ args "-u root"
- customWorkspace "${JOB_NAME}/${BUILD_ID}/clang-static-analyzer"
- }
- }
+ customWorkspace "${JOB_NAME}/${BUILD_ID}/clang-static-analyzer"
+ }
+ }
- stages {
- stage("Install Dependencies") {
- steps {
- script {
- installBuildDepsDebian("bookworm", "clang")
+ stages {
+ stage("Install Dependencies") {
+ steps {
+ script {
+ installBuildDepsDebian("bookworm", "clang")
- // Install Clang Tools
- sh "apt-get install -y clang-tools"
+ // Install Clang Tools
+ sh "apt-get install -y clang-tools"
+ }
+ }
+ }
+
+ stage("Configure") {
+ steps {
+ sh "./autogen.sh"
+ sh "scan-build ./configure --prefix=/usr --enable-debug"
+ }
+ }
+
+ stage("Build") {
+ steps {
+ sh "scan-build -o scan-build-output make"
+ }
}
- }
- }
- stage("Configure") {
- steps {
- sh "./autogen.sh"
- sh "scan-build ./configure --prefix=/usr --enable-debug"
+ stage("Publish Report") {
+ steps {
+ archiveArtifacts artifacts: "scan-build-output/**/*"
+ }
+ }
}
}
- stage("Build") {
- steps {
- sh "scan-build -o scan-build-output make"
+ stage("LCOV") {
+ agent {
+ docker {
+ image "debian:trixie"
+
+ // Run as root inside the containers to install dependencies
+ args "-u root"
+
+ customWorkspace "${JOB_NAME}/${BUILD_ID}/lcov"
+ }
}
- }
- stage("Publish Report") {
- steps {
- archiveArtifacts artifacts: "scan-build-output/**/*",
- allowEmptyArchive: true
+ stages {
+ stage("Install Dependencies") {
+ steps {
+ script {
+ installBuildDepsDebian("trixie", "gcc")
+
+ // Install lcov
+ sh "apt-get install -y lcov"
+ }
+ }
+ }
+
+ stage("Configure") {
+ steps {
+ sh "./autogen.sh"
+ sh """
+ CFLAGS="-O2 -g --coverage" \
+ ./configure \
+ --prefix=/usr \
+ --enable-debug
+ """
+ }
+ }
+
+ stage("Build") {
+ steps {
+ sh "make"
+ }
+ }
+
+ stage("Check") {
+ steps {
+ sh "make check || true"
+ }
+ }
+
+ stage("Publish Report") {
+ steps {
+ // Capture coverage data
+ sh """
+ lcov \
+ --capture \
+ --directory . \
+ --output-file coverage.info \
+ --ignore-errors range,range
+ """
+
+ // Generate HTML report
+ sh """
+ genhtml \
+ coverage.info \
+ --output-directory lcov \
+ --ignore-errors range,range
+ """
+
+ // Upload the report
+ archiveArtifacts artifacts: "lcov/**/*"
+ }
+ }
}
}
}
}
}
}
+
+ /*
+ Debian Packages
+ */
+ stage("Build Debian Packages") {
+ // Only build packages for the master branch
+ when {
+ expression { env.BRANCH_NAME == "master" }
+ }
+
+ matrix {
+ axes {
+ axis {
+ name "IMAGE"
+ values "debian:trixie", "debian:bookworm-backports"
+ }
+
+ axis {
+ name "ARCH"
+ values "amd64", "arm64"
+ }
+ }
+
+ agent {
+ docker {
+ image "${IMAGE}"
+
+ // Run as root inside the containers to install dependencies
+ args "-u root"
+
+ customWorkspace "${JOB_NAME}/${BUILD_ID}/${IMAGE.replace(":", "-")}/${ARCH}"
+ }
+ }
+
+ stages {
+ stage("Setup Build Environment") {
+ steps {
+ // Add the architecture
+ sh "dpkg --add-architecture ${env.ARCH}"
+ sh "apt-get update"
+
+ // Install required packages
+ sh """
+ apt-get install -y \
+ build-essential \
+ crossbuild-essential-${env.ARCH} \
+ devscripts \
+ qemu-user-static
+ """
+ }
+ }
+
+ stage("Install Build Dependencies") {
+ steps {
+ // Install all build dependencies
+ sh "apt-get build-dep -y -a${env.ARCH} ."
+ }
+ }
+
+ stage("Tag") {
+ steps {
+ sh "dch -m \"Jenkins Build ${BUILD_ID}\" -l .build-${BUILD_ID}."
+ }
+ }
+
+ stage("Build") {
+ steps {
+ sh """
+ dpkg-buildpackage \
+ --host-arch ${env.ARCH} \
+ --build=any
+
+ # Move the packages
+ mkdir -pv uploads
+ mv -v ../*.deb uploads/
+ """
+ }
+ }
+
+ stage("Upload Packages") {
+ steps {
+ archiveArtifacts artifacts: "uploads/**"
+ }
+ }
+
+ stage("Create Repository") {
+ environment {
+ DISTRO = "${IMAGE.replace("debian:", "").replace("-backports", "")}"
+ }
+
+ steps {
+ // Create a repository and generate Packages
+ sh """
+ mkdir -pv \
+ dists/${DISTRO}/main/binary-${ARCH} \
+ pool/${DISTRO}/main/${ARCH}
+
+ # Copy all packages
+ cp -v uploads/*.deb pool/${DISTRO}/main/${ARCH}
+
+ # Generate Packages.gz
+ dpkg-scanpackages pool/${DISTRO}/main/${ARCH} \
+ | gzip -9 > dists/${DISTRO}/main/binary-${ARCH}/Packages.gz
+ """
+
+ // Stash the packages
+ stash includes: "dists/**/*, pool/**/*",
+ name: "${DISTRO}-${ARCH}"
+ }
+ }
+ }
+ }
+ }
+
+ stage("Update Debian Repository") {
+ agent {
+ docker {
+ image "debian:trixie"
+
+ // Run as root inside the containers to install dependencies
+ args "-u root"
+
+ customWorkspace "${JOB_NAME}/${BUILD_ID}/update-debian-repo"
+ }
+ }
+
+ steps {
+ // Unstash all stashed packages from the matrix build
+ script {
+ for (distro in ["trixie", "bookworm"]) {
+ for (arch in ["amd64", "arm64"]) {
+ unstash "${distro}-${arch}"
+ }
+ }
+ }
+
+ // Upload everything again
+ archiveArtifacts artifacts: "dists/**/*, pool/**/*"
+
+ // XXX This needs to be published on a mirror server somewhere
+ }
+ }
}
}