Commit ac35f5a0 authored by Dominik Charousset's avatar Dominik Charousset

Port Jenkinsfile to latest CI scaffold

parent 8b0c4fbd
#!/bin/sh
set -x
set -e
# This script expects the CAF source tree under 'sources', builds in 'build' and
# installs to 'bundle'. Additionally, the script expects the CMake pre-load
# script 'cmake-init.txt' in the current working directorys.
InitFile="$PWD/cmake-init.txt"
SourceDir="$PWD/sources"
BuildDir="$PWD/build"
cat "$InitFile"
# Prefer cmake3 over "regular" cmake (cmake == cmake2 on RHEL).
if command -v cmake3 >/dev/null 2>&1 ; then
CMakeCommand="cmake3"
CTestCommand="ctest3"
elif command -v cmake >/dev/null 2>&1 ; then
CMakeCommand="cmake"
CTestCommand="ctest"
else
echo "No CMake found."
exit 1
fi
# Make sure all directories exist, then enter build directory.
mkdir -p "$BuildDir"
cd "$BuildDir"
# Run CMake and CTest.
$CMakeCommand -C "$InitFile" "$SourceDir"
if [ -z "$CAF_NUM_CORES" ]; then
$CMakeCommand --build . --target install
else
$CMakeCommand --build . --target install -- -j $CAF_NUM_CORES
fi
$CTestCommand
FROM fedora:32
RUN dnf update -y && \
dnf clean all
RUN dnf install -y \
git \
make \
cmake \
gcc-c++ \
openssl-devel \
libasan \
libubsan \
&& dnf clean all
#!/bin/sh
WorkingDir="$PWD"
UsageString="
$0 build CMAKE_INIT_FILE SOURCE_DIR BUILD_DIR
OR $0 test BUILD_DIR
OR $0 assert WHAT
"
usage() {
echo "$UsageString"
exit 1
}
set -e
if [ $# = 4 ]; then
if [ "$1" = 'build' ] && [ -f "$2" ] && [ -d "$3" ]; then
Mode='build'
InitFile="$2"
SourceDir="$3"
BuildDir="$4"
mkdir -p "$BuildDir"
else
usage
fi
elif [ $# = 2 ]; then
if [ "$1" = 'test' ] && [ -d "$2" ]; then
Mode='test'
BuildDir="$2"
elif [ "$1" = 'assert' ]; then
Mode='assert'
What="$2"
else
usage
fi
else
usage
fi
set -x
# Prefer cmake3 over "regular" cmake (cmake == cmake2 on RHEL).
if command -v cmake3 >/dev/null 2>&1 ; then
CMakeCommand="cmake3"
CTestCommand="ctest3"
elif command -v cmake >/dev/null 2>&1 ; then
CMakeCommand="cmake"
CTestCommand="ctest"
else
echo "No CMake found."
exit 1
fi
runBuild() {
cat "$InitFile"
cd "$BuildDir"
$CMakeCommand -C "$InitFile" "$SourceDir"
if [ -z "$CAF_NUM_CORES" ]; then
$CMakeCommand --build . --target install
else
$CMakeCommand --build . --target install -- -j $CAF_NUM_CORES
fi
cd "$WorkingDir"
}
runTest() {
cd "$BuildDir"
$CTestCommand --output-on-failure
cd "$WorkingDir"
}
runLeakSanitizerCheck() {
LeakSanCheckStr="
int main() {
int* ptr = new int(0);
return *ptr;
}
"
echo "${LeakSanCheckStr}" > LeakSanCheck.cpp
c++ LeakSanCheck.cpp -o LeakSanCheck -fsanitize=address -fno-omit-frame-pointer
out=`./LeakSanCheck 2>&1 | grep -o 'detected memory leaks'`
if [ -z "$out" ]; then
echo "unable to detected memory leaks on this platform!"
return 1
fi
}
runUBSanitizerCheck() {
UBSanCheckStr="
int main(int argc, char**) {
int k = 0x7fffffff;
k += argc;
return 0;
}
"
echo "${UBSanCheckStr}" > UBSanCheck.cpp
c++ UBSanCheck.cpp -o UBSanCheck -fsanitize=undefined -fno-omit-frame-pointer
out=`./UBSanCheck 2>&1 | grep -o 'signed integer overflow'`
if [ -z "$out" ]; then
echo "unable to detected undefined behavior on this platform!"
return 1
fi
}
if [ "$Mode" = 'build' ]; then
runBuild
elif [ "$Mode" = 'test' ]; then
runTest
else
case "$What" in
LeakSanitizer)
runLeakSanitizerCheck
;;
UBSanitizer)
runUBSanitizerCheck
;;
*)
echo "unrecognized tag: $What!"
return 1
esac
fi
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update -y && \
apt-get upgrade -y
RUN apt update -y && \
apt upgrade -y
RUN apt-get install -y \
RUN apt install -y \
cmake \
g++-9 \
g++ \
git \
libssl-dev \
make \
&& apt-get autoclean
ENV CXX=/usr/bin/g++-9
......@@ -2,21 +2,10 @@
@Library('caf-continuous-integration') _
// Default CMake flags for release builds.
defaultReleaseBuildFlags = [
'CAF_INC_ENABLE_STANDALONE_BUILD:BOOL=ON',
'CAF_ENABLE_RUNTIME_CHECKS:BOOL=ON',
]
// Default CMake flags for debug builds.
defaultDebugBuildFlags = defaultReleaseBuildFlags + [
'CAF_INC_ENABLE_STANDALONE_BUILD:BOOL=ON',
'CAF_INC_SANITIZERS:STRING=address,undefined',
'CAF_LOG_LEVEL:STRING=TRACE',
]
// Configures the behavior of our stages.
config = [
// Version dependency for the caf-continuous-integration library.
ciLibVersion: 1.0,
// GitHub path to repository.
repository: 'actor-framework/incubator',
// List of enabled checks for email notifications.
......@@ -26,54 +15,92 @@ config = [
'tests',
// 'coverage', TODO: fix kcov setup
],
// Default CMake flags by build type.
buildFlags: [
'CAF_INC_ENABLE_STANDALONE_BUILD:BOOL=ON',
'CAF_ENABLE_RUNTIME_CHECKS:BOOL=ON',
'CAF_ENABLE_ACTOR_PROFILER:BOOL=ON',
],
extraDebugFlags: [
'CAF_LOG_LEVEL:STRING=TRACE',
],
// Our build matrix. Keys are the operating system labels and values are build configurations.
buildMatrix: [
// Various Linux builds for debug and release.
// Various Linux builds.
['centos-7', [
numCores: 4,
tags: ['docker'],
builds: ['debug', 'release'],
extraDebugFlags: ['CAF_SANITIZERS:STRING=address,undefined'],
builds: ['release'],
]],
['ubuntu-20.04', [
numCores: 4,
tags: ['docker'],
builds: ['debug', 'release'],
builds: ['release'],
]],
['fedora-30', [
['fedora-31', [
numCores: 4,
tags: ['docker'],
builds: ['debug', 'release'],
builds: ['release'],
]],
['fedora-31', [
['fedora-32', [
numCores: 4,
tags: ['docker'],
builds: ['debug', 'release'],
builds: ['release'],
]],
// One extra debug build with exceptions disabled.
['centos-7', [
numCores: 4,
tags: ['docker'],
builds: ['debug'],
extraDebugFlags: [
extraBuildFlags: [
'CAF_ENABLE_EXCEPTIONS:BOOL=OFF',
'CMAKE_CXX_FLAGS:STRING=-fno-exceptions',
],
]],
// One extra debug build for leak checking.
['fedora-32', [
numCores: 4,
tags: ['docker', 'LeakSanitizer'],
builds: ['debug'],
extraBuildFlags: [
'CAF_INC_SANITIZERS:STRING=address',
],
extraBuildEnv: [
'ASAN_OPTIONS=detect_leaks=1',
],
]],
// One extra debug build with static libraries and UBSanitizer.
['fedora-32', [
numCores: 4,
tags: ['docker', 'UBSanitizer'],
builds: ['debug'],
extraBuildFlags: [
'BUILD_SHARED_LIBS:BOOL=OFF',
'CAF_INC_SANITIZERS:STRING=address,undefined',
],
extraBuildEnv: [
'CXXFLAGS=-fno-sanitize-recover=undefined',
'LDFLAGS=-fno-sanitize-recover=undefined',
],
]],
// Other UNIX systems.
['macOS', [
numCores: 4,
builds: ['debug', 'release'],
extraFlags: [
'OPENSSL_ROOT_DIR=/usr/local/opt/openssl',
'OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include',
extraBuildFlags: [
'OPENSSL_ROOT_DIR:PATH=/usr/local/opt/openssl',
'OPENSSL_INCLUDE_DIR:PATH=/usr/local/opt/openssl/include',
],
extraDebugBuildFlags: [
'CAF_INC_SANITIZERS:STRING=address',
],
extraDebugFlags: ['CAF_SANITIZERS:STRING=address,undefined'],
]],
['FreeBSD', [
numCores: 4,
builds: ['debug', 'release'],
extraDebugFlags: ['CAF_SANITIZERS:STRING=address,undefined'],
extraBuildFlags: [
'CAF_INC_SANITIZERS:STRING=address',
],
]],
// Non-UNIX systems.
['Windows', [
......@@ -81,32 +108,11 @@ config = [
// TODO: debug build currently broken
//builds: ['debug', 'release'],
builds: ['release'],
extraFlags: ['CAF_ENABLE_OPENSSL_MODULE:BOOL=OFF'],
extraBuildFlags: [
'CAF_ENABLE_OPENSSL_MODULE:BOOL=OFF'
],
]],
],
// Platform-specific environment settings.
buildEnvironments: [
nop: [], // Dummy value for getting the proper types.
],
// Default CMake flags by build type.
defaultBuildFlags: [
debug: defaultDebugBuildFlags,
release: defaultReleaseBuildFlags,
],
// CMake flags by OS and build type to override defaults for individual builds.
buildFlags: [
nop: [],
],
// Configures what binary the coverage report uses and what paths to exclude.
coverage: [
binaries: [
'build/libcaf_net/caf-net-test',
'build/libcaf_bb/caf-bb-test',
],
relativeExcludePaths: [
'libcaf_net/test'
],
],
]
// Declarative pipeline for triggering all stages.
......@@ -119,8 +125,7 @@ pipeline {
}
environment {
PrettyJobBaseName = env.JOB_BASE_NAME.replace('%2F', '/')
PrettyJobName = "Incubator/$PrettyJobBaseName #${env.BUILD_NUMBER}"
ASAN_OPTIONS = 'detect_leaks=0'
PrettyJobName = "CAF/$PrettyJobBaseName #${env.BUILD_NUMBER}"
}
stages {
stage('Checkout') {
......@@ -156,7 +161,7 @@ pipeline {
}
stage('Build') {
steps {
buildParallel(config, PrettyJobBaseName)
buildParallel(config)
}
}
stage('Notify') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment