jjb: babeltrace: Add release jobs
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 22 May 2020 19:20:38 +0000 (15:20 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Fri, 22 May 2020 19:20:38 +0000 (15:20 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
jobs/babeltrace.yaml
scripts/babeltrace/release.sh [new file with mode: 0644]

index d37d4db98782724fc213c6fe237d9c25519753de..b694039148c70ee1951ff18819b4d7d382edff44 100644 (file)
     <<: *babeltrace_build_builders_win
     <<: *babeltrace_build_publishers_gerrit
 
+- job-template:
+    name: babeltrace_{version}_release
+    defaults: babeltrace
+    node: 'amd64'
+
+    triggers:
+      - pollscm:
+          cron: "@daily"
+
+    scm:
+      - git:
+          url: git://github.com/{github_user}/{github_name}.git
+          browser: githubweb
+          browser-url: https://github.com/{github_user}/{github_name}
+          refspec: '+refs/tags/*:refs/remotes/origin/tags/*'
+          branches:
+            - '*/tags/{version}.*'
+          basedir: src/babeltrace
+
+    builders:
+      - shell:
+          !include-raw-escape: scripts/babeltrace/release.sh
+
+    publishers:
+      - tap:
+          results: 'tap/**/*.log'
+          fail-if-no-results: true
+          failed-tests-mark-build-as-failure: true
+          todo-is-failure: false
+      - warnings:
+          console-log-parsers:
+            - 'GNU Make + GNU C Compiler (gcc)'
+          total-thresholds:
+            unstable:
+              total-all: 0
+              total-high: 0
+              total-normal: 0
+              total-low: 0
+      - workspace-cleanup:
+          clean-if:
+            - failure: false
+      - archive:
+          artifacts: 'out/**,tap/**'
+          allow-empty: false
+
 - job-template:
     name: dev_gerrit_babeltrace_pylint
     defaults: babeltrace
           arch: !!python/tuple [cygwin64]
           build: !!python/tuple [std]
           conf: !!python/tuple [std]
+      - 'babeltrace_{version}_release':
+          version: v1.5
       - 'babeltrace_{version}_cppcheck'
       - 'babeltrace_{version}_scan-build'
 
           arch: !!python/tuple [cygwin64, msys2-mingw32, msys2-mingw64]
           build: !!python/tuple [std]
           conf: !!python/tuple [std]
+      - 'babeltrace_{version}_release':
+          version: v2.0
       - 'babeltrace_{version}_cppcheck'
       - 'babeltrace_{version}_scan-build'
       - 'babeltrace_{version}_pylint'
diff --git a/scripts/babeltrace/release.sh b/scripts/babeltrace/release.sh
new file mode 100644 (file)
index 0000000..43db8db
--- /dev/null
@@ -0,0 +1,181 @@
+#!/bin/bash -exu
+#
+# Copyright (C) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+# Copyright (C) 2020 Michael Jeanson <mjeanson@efficios.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Version compare functions
+vercomp () {
+    set +u
+    if [[ "$1" == "$2" ]]; then
+        return 0
+    fi
+    local IFS=.
+    local i ver1=($1) ver2=($2)
+    # fill empty fields in ver1 with zeros
+    for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
+        ver1[i]=0
+    done
+    for ((i=0; i<${#ver1[@]}; i++)); do
+        if [[ -z ${ver2[i]} ]]; then
+            # fill empty fields in ver2 with zeros
+            ver2[i]=0
+        fi
+        if ((10#${ver1[i]} > 10#${ver2[i]})); then
+            return 1
+        fi
+        if ((10#${ver1[i]} < 10#${ver2[i]})); then
+            return 2
+        fi
+    done
+    set -u
+    return 0
+}
+
+verlte() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -eq "0" ] || [ "$res" -eq "2" ]
+}
+
+verlt() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -eq "2" ]
+}
+
+vergte() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -eq "0" ] || [ "$res" -eq "1" ]
+}
+
+vergt() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -eq "1" ]
+}
+
+verne() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -ne "0" ]
+}
+
+# Required variables
+WORKSPACE=${WORKSPACE:-}
+
+
+SRCDIR="$WORKSPACE/src/babeltrace"
+TMPDIR="$WORKSPACE/tmp"
+OUTDIR="$WORKSPACE/out"
+TAPDIR="$WORKSPACE/tap"
+
+failed_tests=0
+
+# Create build and tmp directories
+rm -rf "$OUTDIR" "$TMPDIR" "$TAPDIR"
+mkdir -p "$OUTDIR" "$TMPDIR" "$TAPDIR"
+
+export TMPDIR
+
+
+# Enter the source directory
+cd "$SRCDIR"
+
+# Run bootstrap in the source directory prior to configure
+./bootstrap
+
+# Get source version from configure script
+eval "$(grep '^PACKAGE_VERSION=' ./configure)"
+PACKAGE_VERSION=${PACKAGE_VERSION//\-pre*/}
+
+# Version specific configurations
+if vergte "$PACKAGE_VERSION" "2.0"; then
+  BASENAME="babeltrace2"
+  CONF_OPTS=("--enable-python-bindings" "--enable-python-bindings-doc" "--enable-python-plugins")
+
+  # Enable dev mode by default for BT 2.0 builds
+  #export BABELTRACE_DEBUG_MODE=1
+  #export BABELTRACE_DEV_MODE=1
+  #export BABELTRACE_MINIMAL_LOG_LEVEL=TRACE
+else
+  BASENAME="babeltrace"
+  CONF_OPTS=("--enable-python-bindings")
+fi
+
+
+TARBALL_FILE="$BASENAME-$PACKAGE_VERSION.tar.bz2"
+
+
+# Make sure the reported version matches the current git tag
+GIT_TAG="$(git describe --exact-match --tags $(git log -n1 --pretty='%h')|| echo 'undefined')"
+
+if [ "v$PACKAGE_VERSION" != "$GIT_TAG" ]; then
+  echo "Git checkout is not tagged or doesn't match the reported version."
+  exit 1
+fi
+
+# Generate release tarball
+./configure "${CONF_OPTS[@]}"
+make dist
+cp "./$TARBALL_FILE" "$OUTDIR/"
+
+## Do an in-tree test build
+mkdir "$WORKSPACE/intree"
+cd "$WORKSPACE/intree" || exit 1
+
+tar xvf "$OUTDIR/$TARBALL_FILE" --strip 1
+./configure --prefix="$(mktemp -d)" "${CONF_OPTS[@]}"
+
+# BUILD!
+make -j "$(nproc)" V=1
+
+make install
+
+# Run tests, don't fail now, we want to run the archiving steps
+make --keep-going check || failed_tests=1
+
+# Copy tap logs for the jenkins tap parser before cleaning the build dir
+rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$TAPDIR/intree"
+
+# Clean the build directory
+make clean
+
+
+## Do an out-of-tree test build
+mkdir "$WORKSPACE/oot"
+mkdir "$WORKSPACE/oot/src"
+mkdir "$WORKSPACE/oot/build"
+cd "$WORKSPACE/oot/src" || exit 1
+
+tar xvf "$OUTDIR/$TARBALL_FILE" --strip 1
+cd "$WORKSPACE/oot/build" || exit 1
+"$WORKSPACE/oot/src/configure" --prefix="$(mktemp -d)" "${CONF_OPTS[@]}"
+
+# BUILD!
+make -j "$(nproc)" V=1
+
+make install
+
+# Run tests, don't fail now, we want to run the archiving steps
+make --keep-going check || failed_tests=1
+
+# Copy tap logs for the jenkins tap parser before cleaning the build dir
+rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$TAPDIR/oot"
+
+# Clean the build directory
+make clean
+
+
+# Exit with failure if any of the tests failed
+exit $failed_tests
+
+# EOF
This page took 0.027821 seconds and 4 git commands to generate.