jjb: Add librseq jobs
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 23 Apr 2019 20:59:28 +0000 (16:59 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Tue, 23 Apr 2019 20:59:28 +0000 (16:59 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
jobs/librseq.yaml [new file with mode: 0644]
scripts/librseq/build.sh [new file with mode: 0755]

diff --git a/jobs/librseq.yaml b/jobs/librseq.yaml
new file mode 100644 (file)
index 0000000..392b0d2
--- /dev/null
@@ -0,0 +1,304 @@
+# {project}_{version}_{jobtype}
+# librseq_stable-0.8_build
+#
+# jobtypes:
+#   - build
+#   - portbuild
+#   - cppcheck
+#   - coverity
+#   - scan-build
+#   - pylint
+
+- defaults:
+    name: librseq
+    description: |
+
+      <p>Job is managed by Jenkins Job Builder.</p>
+
+    project-type: freestyle
+
+    wrappers:
+      - ansicolor
+      - timeout:
+          timeout: 10
+          fail: true
+          type: absolute
+      - timestamps
+      - workspace-cleanup:
+          clean-if:
+            - failure: false
+
+    scm:
+      - git:
+          url: git://github.com/{github_user}/{github_name}.git
+          browser: githubweb
+          browser-url: https://github.com/{github_user}/{github_name}
+          branches:
+            - origin/{version}
+          basedir: src/librseq
+          skip-tag: true
+
+    triggers:
+      - pollscm:
+          cron: "@hourly"
+
+    properties:
+      - inject:
+          properties-content: |
+            PROJECT_NAME=librseq
+      - build-discarder:
+          num-to-keep: 2
+      - github:
+          url: https://github.com/{github_user}/{github_name}
+
+
+## Anchors
+- librseq_build_axes_defaults: &librseq_build_axes_defaults
+    name: 'librseq_build_axes_defaults'
+    project-type: matrix
+    node: 'master' # Applies only to matrix flyweight task
+    axes:
+      - axis:
+         type: slave
+         name: arch
+         values: '{obj:arch}'
+      - axis:
+         type: user-defined
+         name: conf
+         values: '{obj:conf}'
+      - axis:
+         type: user-defined
+         name: build
+         values: '{obj:build}'
+
+- librseq_build_axes_cc: &librseq_build_axes_cc
+    name: 'librseq_build_axes_cc'
+    project-type: matrix
+    node: 'master' # Applies only to matrix flyweight task
+    axes:
+      - axis:
+         type: slave
+         name: arch
+         values: '{obj:arch}'
+      - axis:
+         type: user-defined
+         name: conf
+         values: '{obj:conf}'
+      - axis:
+         type: user-defined
+         name: build
+         values: '{obj:build}'
+      - axis:
+         type: user-defined
+         name: cc
+         values: '{obj:cc}'
+
+- librseq_build_builders_defaults: &librseq_build_builders_defaults
+    name: 'librseq_build_builders_defaults'
+    builders:
+      - shell:
+         !include-raw-escape: scripts/librseq/build.sh
+
+- librseq_build_publishers_defaults: &librseq_build_publishers_defaults
+    name: 'librseq_build_publishers_defaults'
+    publishers:
+      - 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
+      - archive:
+          artifacts: 'build/**'
+          allow-empty: false
+      - ircbot:
+          strategy: new-failure-and-fixed
+          matrix-notifier: only-parent
+          channels:
+            - name: '#lttng'
+      - email-ext:
+          recipients: '{obj:email_to}'
+          reply-to: ci-notification@lists.lttng.org
+          always: false
+          unstable: false
+          first-failure: true
+          first-unstable: true
+          not-built: false
+          aborted: false
+          regression: false
+          failure: false
+          second-failure: false
+          improvement: false
+          still-failing: false
+          success: false
+          fixed: false
+          fixed-unhealthy: true
+          still-unstable: false
+          pre-build: false
+          matrix-trigger: only-parent
+          send-to:
+            - recipients
+
+## Templates
+- job-template:
+    name: librseq_{version}_{buildtype}
+    defaults: librseq
+
+    <<: *librseq_build_axes_defaults
+    <<: *librseq_build_builders_defaults
+    <<: *librseq_build_publishers_defaults
+
+- job-template:
+    name: librseq_{version}_{cctype}
+    defaults: librseq
+
+    <<: *librseq_build_axes_cc
+    <<: *librseq_build_builders_defaults
+    <<: *librseq_build_publishers_defaults
+
+- job-template:
+    name: librseq_{version}_cppcheck
+    defaults: librseq
+
+    triggers:
+      - pollscm:
+          cron: "@daily"
+
+    builders:
+      - shell: |
+          rm -f cppcheck-result.xml
+          cppcheck --enable=all --xml --xml-version=2 $WORKSPACE/src/librseq 2> cppcheck-result.xml
+
+    publishers:
+      - archive:
+          artifacts: 'cppcheck-result.xml'
+          allow-empty: false
+      - cppcheck:
+          pattern: 'cppcheck-result.xml'
+      - email-ext:
+          recipients: '{obj:email_to}'
+          reply-to: ci-notification@lists.lttng.org
+          always: false
+          unstable: false
+          first-failure: true
+          first-unstable: false
+          not-built: false
+          aborted: false
+          regression: false
+          failure: false
+          second-failure: false
+          improvement: false
+          still-failing: false
+          success: false
+          fixed: false
+          fixed-unhealthy: true
+          still-unstable: true
+          pre-build: false
+          matrix-trigger: only-parent
+          send-to:
+            - recipients
+
+- job-template:
+    name: librseq_{version}_scan-build
+    defaults: librseq
+    node: 'amd64'
+
+    triggers:
+      - pollscm:
+          cron: "@daily"
+
+    builders:
+      - shell:
+          !include-raw-escape: scripts/common/scan-build.sh
+
+    publishers:
+      - html-publisher:
+          name: 'HTML Report'
+          dir: 'scan-build-archive/'
+          files: 'index.html'
+
+- job-template:
+    name: librseq_{version}_coverity
+    defaults: librseq
+    node: 'amd64'
+
+    triggers:
+      - pollscm:
+          cron: "@daily"
+
+    wrappers:
+      - ansicolor
+      - timeout:
+          timeout: 60
+          fail: true
+          type: absolute
+      - timestamps
+      - workspace-cleanup:
+          clean-if:
+            - failure: false
+      - credentials-binding:
+          - username-password-separated:
+              credential-id: librseq_coverity_token
+              username: COVERITY_SCAN_PROJECT_NAME
+              password: COVERITY_SCAN_TOKEN
+
+    builders:
+      - shell:
+          !include-raw-escape: scripts/common/coverity.sh
+
+    publishers:
+      - workspace-cleanup
+      - archive:
+          artifacts: 'analysis-results.tgz,cov-int/**'
+          allow-empty: false
+
+- view-template:
+    name: 'rseq'
+    description: 'Restartable sequences'
+    view-type: list
+    regex: 'librseq_.*|linux-rseq_.*'
+
+
+## Project
+- project:
+    name: librseq
+    github_user: compudj
+    github_name: librseq
+    email_to: 'ci-notification@lists.lttng.org, cc:mathieu.desnoyers@efficios.com'
+    version:
+      - master
+    jobs:
+      - 'librseq_{version}_{buildtype}':
+          buildtype: build
+          arch: !!python/tuple [amd64]
+          build: !!python/tuple [std, oot, dist]
+          conf: !!python/tuple [std, static]
+      - 'librseq_{version}_{cctype}':
+          cctype: gccbuild
+          arch: !!python/tuple [amd64]
+          build: !!python/tuple [std]
+          conf: !!python/tuple [std, static]
+          cc: !!python/tuple [gcc-4.8, gcc-5, gcc-6, gcc-7, gcc-8]
+      - 'librseq_{version}_{cctype}':
+          cctype: clangbuild
+          arch: !!python/tuple [amd64]
+          build: !!python/tuple [std]
+          conf: !!python/tuple [std, static]
+          cc: !!python/tuple [clang-3.9, clang-4.0, clang-6.0, clang-7]
+      - 'librseq_{version}_{buildtype}':
+          buildtype: portbuild
+          arch: !!python/tuple [armhf, arm64, powerpc, ppc64el, i386]
+          build: !!python/tuple [std]
+          conf: !!python/tuple [std, static]
+#      - 'librseq_{version}_cppcheck'
+#      - 'librseq_{version}_scan-build'
+#      - 'librseq_{version}_coverity':
+#          version: master
+
+- project:
+    name: librseq-views
+    views:
+      - rseq
diff --git a/scripts/librseq/build.sh b/scripts/librseq/build.sh
new file mode 100755 (executable)
index 0000000..e8a9863
--- /dev/null
@@ -0,0 +1,246 @@
+#!/bin/bash -exu
+#
+# Copyright (C) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+# Copyright (C) 2019 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 parameters
+arch=${arch:-}
+conf=${conf:-}
+build=${build:-}
+cc=${cc:-}
+
+
+SRCDIR="$WORKSPACE/src/librseq"
+TMPDIR="$WORKSPACE/tmp"
+PREFIX="$WORKSPACE/build"
+
+# Create build and tmp directories
+rm -rf "$PREFIX" "$TMPDIR"
+mkdir -p "$PREFIX" "$TMPDIR"
+
+export TMPDIR
+export CFLAGS="-g -O2"
+export CPPFLAGS="-I$SRCDIR/extra"
+
+# Set compiler variables
+case "$cc" in
+gcc)
+    export CC=gcc
+    export CXX=g++
+    ;;
+gcc-4.8)
+    export CC=gcc-4.8
+    export CXX=g++-4.8
+    ;;
+gcc-5)
+    export CC=gcc-5
+    export CXX=g++-5
+    ;;
+gcc-6)
+    export CC=gcc-6
+    export CXX=g++-6
+    ;;
+gcc-7)
+    export CC=gcc-7
+    export CXX=g++-7
+    ;;
+gcc-8)
+    export CC=gcc-8
+    export CXX=g++-8
+    ;;
+clang)
+    export CC=clang
+    export CXX=clang++
+    ;;
+clang-3.9)
+    export CC=clang-3.9
+    export CXX=clang++-3.9
+    ;;
+clang-4.0)
+    export CC=clang-4.0
+    export CXX=clang++-4.0
+    ;;
+clang-5.0)
+    export CC=clang-5.0
+    export CXX=clang++-5.0
+    ;;
+clang-6.0)
+    export CC=clang-6.0
+    export CXX=clang++-6.0
+    ;;
+clang-7)
+    export CC=clang-7
+    export CXX=clang++-7
+    ;;
+*)
+    if [ "x$cc" != "x" ]; then
+           export CC="$cc"
+    fi
+    ;;
+esac
+
+# Set platform variables
+case "$arch" in
+*)
+    export MAKE=make
+    export TAR=tar
+    export NPROC=nproc
+    ;;
+esac
+
+# 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)"
+
+TARBALL_FILE="librseq-$PACKAGE_VERSION.tar.bz2"
+
+# Set configure options and environment variables for each build
+# configuration.
+CONF_OPTS=""
+case "$conf" in
+static)
+    echo "Static build"
+    CONF_OPTS="--enable-static --disable-shared"
+    ;;
+
+*)
+    echo "Standard build"
+    CONF_OPTS=""
+    ;;
+esac
+
+# Build type
+# oot : out-of-tree build
+# dist: build via make dist
+# *   : normal tree build
+#
+# Make sure to move to the build_path and configure
+# before continuing
+BUILD_PATH=$SRCDIR
+case "$build" in
+oot)
+    echo "Out of tree build"
+    BUILD_PATH=$WORKSPACE/oot
+    mkdir -p "$BUILD_PATH"
+    cd "$BUILD_PATH"
+    "$SRCDIR/configure" --prefix="$PREFIX" $CONF_OPTS
+    ;;
+
+dist)
+    echo "Distribution out of tree build"
+    BUILD_PATH=$(mktemp -d)
+
+    # Initial configure and generate tarball
+    "$SRCDIR/configure"
+    $MAKE dist
+
+    mkdir -p "$BUILD_PATH"
+    cp "./$TARBALL_FILE" "$BUILD_PATH/"
+    cd "$BUILD_PATH"
+
+    # Ignore level 1 of tar
+    $TAR xvf "$TARBALL_FILE" --strip 1
+
+    "$BUILD_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
+    ;;
+
+*)
+    echo "Standard in-tree build"
+    "$BUILD_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
+    ;;
+esac
+
+# BUILD!
+$MAKE -j "$($NPROC)" V=1
+$MAKE install
+
+# Run tests
+$MAKE --keep-going check
+
+# Cleanup
+$MAKE clean
+
+# Cleanup rpath in executables and shared libraries
+find "$PREFIX/lib" -name "*.so" -exec chrpath --delete {} \;
+
+# Remove libtool .la files
+find "$PREFIX/lib" -name "*.la" -exec rm -f {} \;
+
+# Cleanup temp directory of dist build
+if [ "$build" = "dist" ]; then
+    cd "$SRCDIR"
+    rm -rf "$BUILD_PATH"
+fi
+
+# EOF
This page took 0.028627 seconds and 4 git commands to generate.