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 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 && \ RUN apt update -y && \
apt-get upgrade -y apt upgrade -y
RUN apt-get install -y \ RUN apt install -y \
cmake \ cmake \
g++-9 \ g++ \
git \ git \
libssl-dev \ libssl-dev \
make \ make \
&& apt-get autoclean && apt-get autoclean
ENV CXX=/usr/bin/g++-9
...@@ -2,21 +2,10 @@ ...@@ -2,21 +2,10 @@
@Library('caf-continuous-integration') _ @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. // Configures the behavior of our stages.
config = [ config = [
// Version dependency for the caf-continuous-integration library.
ciLibVersion: 1.0,
// GitHub path to repository. // GitHub path to repository.
repository: 'actor-framework/incubator', repository: 'actor-framework/incubator',
// List of enabled checks for email notifications. // List of enabled checks for email notifications.
...@@ -26,54 +15,92 @@ config = [ ...@@ -26,54 +15,92 @@ config = [
'tests', 'tests',
// 'coverage', TODO: fix kcov setup // '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. // Our build matrix. Keys are the operating system labels and values are build configurations.
buildMatrix: [ buildMatrix: [
// Various Linux builds for debug and release. // Various Linux builds.
['centos-7', [ ['centos-7', [
numCores: 4, numCores: 4,
tags: ['docker'], tags: ['docker'],
builds: ['debug', 'release'], builds: ['release'],
extraDebugFlags: ['CAF_SANITIZERS:STRING=address,undefined'],
]], ]],
['ubuntu-20.04', [ ['ubuntu-20.04', [
numCores: 4, numCores: 4,
tags: ['docker'], tags: ['docker'],
builds: ['debug', 'release'], builds: ['release'],
]], ]],
['fedora-30', [ ['fedora-31', [
numCores: 4, numCores: 4,
tags: ['docker'], tags: ['docker'],
builds: ['debug', 'release'], builds: ['release'],
]], ]],
['fedora-31', [ ['fedora-32', [
numCores: 4, numCores: 4,
tags: ['docker'], tags: ['docker'],
builds: ['debug', 'release'], builds: ['release'],
]], ]],
// One extra debug build with exceptions disabled. // One extra debug build with exceptions disabled.
['centos-7', [ ['centos-7', [
numCores: 4, numCores: 4,
tags: ['docker'], tags: ['docker'],
builds: ['debug'], builds: ['debug'],
extraDebugFlags: [ extraBuildFlags: [
'CAF_ENABLE_EXCEPTIONS:BOOL=OFF', 'CAF_ENABLE_EXCEPTIONS:BOOL=OFF',
'CMAKE_CXX_FLAGS:STRING=-fno-exceptions', '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. // Other UNIX systems.
['macOS', [ ['macOS', [
numCores: 4, numCores: 4,
builds: ['debug', 'release'], builds: ['debug', 'release'],
extraFlags: [ extraBuildFlags: [
'OPENSSL_ROOT_DIR=/usr/local/opt/openssl', 'OPENSSL_ROOT_DIR:PATH=/usr/local/opt/openssl',
'OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include', 'OPENSSL_INCLUDE_DIR:PATH=/usr/local/opt/openssl/include',
],
extraDebugBuildFlags: [
'CAF_INC_SANITIZERS:STRING=address',
], ],
extraDebugFlags: ['CAF_SANITIZERS:STRING=address,undefined'],
]], ]],
['FreeBSD', [ ['FreeBSD', [
numCores: 4, numCores: 4,
builds: ['debug', 'release'], builds: ['debug', 'release'],
extraDebugFlags: ['CAF_SANITIZERS:STRING=address,undefined'], extraBuildFlags: [
'CAF_INC_SANITIZERS:STRING=address',
],
]], ]],
// Non-UNIX systems. // Non-UNIX systems.
['Windows', [ ['Windows', [
...@@ -81,31 +108,10 @@ config = [ ...@@ -81,31 +108,10 @@ config = [
// TODO: debug build currently broken // TODO: debug build currently broken
//builds: ['debug', 'release'], //builds: ['debug', 'release'],
builds: ['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'
], ],
]],
], ],
] ]
...@@ -119,8 +125,7 @@ pipeline { ...@@ -119,8 +125,7 @@ pipeline {
} }
environment { environment {
PrettyJobBaseName = env.JOB_BASE_NAME.replace('%2F', '/') PrettyJobBaseName = env.JOB_BASE_NAME.replace('%2F', '/')
PrettyJobName = "Incubator/$PrettyJobBaseName #${env.BUILD_NUMBER}" PrettyJobName = "CAF/$PrettyJobBaseName #${env.BUILD_NUMBER}"
ASAN_OPTIONS = 'detect_leaks=0'
} }
stages { stages {
stage('Checkout') { stage('Checkout') {
...@@ -156,7 +161,7 @@ pipeline { ...@@ -156,7 +161,7 @@ pipeline {
} }
stage('Build') { stage('Build') {
steps { steps {
buildParallel(config, PrettyJobBaseName) buildParallel(config)
} }
} }
stage('Notify') { 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