Commit c9836703 authored by Jens Kroeger's avatar Jens Kroeger
Browse files

Merge branch 'move_ci_lcg' into 'master'

CI: Move to CERN-EP-SFT's LCG view

See merge request !250
parents d2868de3 b60e8a89
Pipeline #1407572 failed with stages
in 9 minutes and 42 seconds
......@@ -21,26 +21,34 @@ if [ ! -d "/cvmfs" ]; then
exit 1
fi
if [ ! -d "/cvmfs/clicdp.cern.ch" ]; then
echo "No clicdp CVMFS repository detected, please add it."
if [ ! -d "/cvmfs/sft.cern.ch" ]; then
echo "No SFT CVMFS repository detected, please make sure it is available."
exit 1
fi
if [ ! -d "/cvmfs/sft.cern.ch" ]; then
echo "No sft CVMFS repository detected, please add it."
if [ ! -d "/cvmfs/geant4.cern.ch" ]; then
echo "No Geant4 CVMFS repository detected, please make sure it is available."
exit 1
fi
# Determine which LCG version to use
if [ -z ${LCG_VERSION} ]; then
echo "No explicit LCG version set, using LCG_96b."
LCG_VERSION="LCG_96b"
fi
# Determine which compiler to use
if [ -z ${COMPILER_TYPE} ]; then
echo "No compiler type set, falling back to GCC."
COMPILER_TYPE="gcc"
fi
if [ ${COMPILER_TYPE} == "gcc" ]; then
COMPILER_VERSION="gcc7"
echo "Compiler type set to GCC."
COMPILER_VERSION="gcc8"
fi
if [ ${COMPILER_TYPE} == "llvm" ]; then
COMPILER_VERSION="llvm40"
echo "Compiler type set to LLVM."
COMPILER_VERSION="clang8"
fi
# Choose build type
......@@ -49,70 +57,14 @@ if [ -z ${BUILD_TYPE} ]; then
fi
# General variables
CLICREPO=/cvmfs/clicdp.cern.ch
SFTREPO=/cvmfs/sft.cern.ch
export BUILD_FLAVOUR=x86_64-${OS}-${COMPILER_VERSION}-${BUILD_TYPE}
#--------------------------------------------------------------------------------
# Compiler
#--------------------------------------------------------------------------------
if [ ${COMPILER_TYPE} == "gcc" ]; then
source ${CLICREPO}/compilers/gcc/7.1.0/x86_64-${OS}/setup.sh
fi
if [ ${COMPILER_TYPE} == "llvm" ]; then
source ${CLICREPO}/compilers/llvm/4.0.0/x86_64-${OS}/setup.sh
fi
#--------------------------------------------------------------------------------
# Python
# Source full LCG view
#--------------------------------------------------------------------------------
export PYTHONDIR=${CLICREPO}/software/Python/2.7.13/${BUILD_FLAVOUR}
export PATH=${PYTHONDIR}/bin:$PATH
export LD_LIBRARY_PATH=${PYTHONDIR}/lib:${LD_LIBRARY_PATH}
#--------------------------------------------------------------------------------
# CMake
#--------------------------------------------------------------------------------
export CMAKE_HOME=${CLICREPO}/software/CMake/3.8.1/${BUILD_FLAVOUR}
export PATH=${CMAKE_HOME}/bin:$PATH
#--------------------------------------------------------------------------------
# ROOT
#--------------------------------------------------------------------------------
export ROOTSYS=${CLICREPO}/software/ROOT/6.08.06/${BUILD_FLAVOUR}
export PYTHONPATH="$ROOTSYS/lib:$PYTHONPATH"
export PATH="$ROOTSYS/bin:$PATH"
export LD_LIBRARY_PATH="$ROOTSYS/lib:$LD_LIBRARY_PATH"
export CMAKE_PREFIX_PATH="$ROOTSYS:$CMAKE_PREFIX_PATH"
#--------------------------------------------------------------------------------
# Ninja
#--------------------------------------------------------------------------------
export Ninja_HOME=${CLICREPO}/software/Ninja/1.7.2/${BUILD_FLAVOUR}
export PATH="$Ninja_HOME:$PATH"
#--------------------------------------------------------------------------------
# Eigen
#--------------------------------------------------------------------------------
export Eigen_HOME=${CLICREPO}/software/Eigen/3.3.3/${BUILD_FLAVOUR}/
export Eigen3_DIR=${Eigen_HOME}/share/eigen3/cmake/
export CMAKE_PREFIX_PATH="$Eigen3_DIR:$CMAKE_PREFIX_PATH"
#--------------------------------------------------------------------------------
# Doxygen
#--------------------------------------------------------------------------------
export Doxygen_HOME=${SFTREPO}/lcg/releases/doxygen/1.8.11-ae1d3/${BUILD_FLAVOUR}/bin/
export PATH="$Doxygen_HOME:$PATH"
#--------------------------------------------------------------------------------
# Git
#--------------------------------------------------------------------------------
source ${SFTREPO}/lcg/views/${LCG_VERSION}/${BUILD_FLAVOUR}/setup.sh
export Git_HOME=${CLICREPO}/software/git/2.13.2/${BUILD_FLAVOUR}
export PATH=${Git_HOME}/bin:${PATH}
# Fix LCIO path for LCG_96, cmake configs are not properly placed:
export LCIO_DIR=$(dirname $(dirname $(readlink $(which lcio_event_counter))))
......@@ -18,34 +18,14 @@ cmp:slc6-gcc:
stage: compilation
tags:
- docker
image: clicdp/slc6-base
image: gitlab-registry.cern.ch/sft/docker/slc6:latest
script:
- export COMPILER_TYPE="gcc"
- source .gitlab-ci.d/init_x86_64.sh
- source .gitlab-ci.d/load_deps.sh
- mkdir build
- cd build
- cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- ninja
- ninja install
artifacts:
paths:
- build
- bin
- lib
expire_in: 3 hour
cmp:slc6-llvm:
stage: compilation
tags:
- docker
image: clicdp/slc6-base
script:
- export COMPILER_TYPE="llvm"
- source .gitlab-ci.d/init_x86_64.sh
- mkdir build
- cd build
- cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- cmake -GNinja -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- ninja
- ninja install
artifacts:
......@@ -59,14 +39,14 @@ cmp:cc7-gcc:
stage: compilation
tags:
- docker
image: clicdp/cc7-base
image: gitlab-registry.cern.ch/sft/docker/centos7:latest
script:
- export COMPILER_TYPE="gcc"
- source .gitlab-ci.d/init_x86_64.sh
- source .gitlab-ci.d/load_deps.sh
- mkdir build
- cd build
- cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- cmake -GNinja -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- ninja
- ninja install
artifacts:
......@@ -88,7 +68,7 @@ cmp:cc7-docker:
script:
- mkdir build
- cd build
- cmake3 -DBUILD_EventLoaderEUDAQ2=ON -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- cmake3 -DCMAKE_CXX_FLAGS="-Werror" -DBUILD_EventLoaderEUDAQ2=ON -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- make
- make install
artifacts:
......@@ -102,13 +82,13 @@ cmp:cc7-llvm:
stage: compilation
tags:
- docker
image: clicdp/cc7-base
image: gitlab-registry.cern.ch/sft/docker/centos7:latest
script:
- export COMPILER_TYPE="llvm"
- source .gitlab-ci.d/init_x86_64.sh
- mkdir build
- cd build
- cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- cmake -GNinja -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- ninja
- ninja install
artifacts:
......@@ -127,7 +107,7 @@ cmp:mac1014-clang:
- source .gitlab-ci.d/load_deps.sh
- mkdir build
- cd build
- cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DCMAKE_USE_RELATIVE_PATHS=TRUE -DEigen3_DIR=$Eigen3_DIR ..
- cmake -GNinja -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DCMAKE_USE_RELATIVE_PATHS=TRUE -DEigen3_DIR=$Eigen3_DIR ..
- ninja
- ninja install
artifacts:
......@@ -164,43 +144,13 @@ tst:telescope:
# Format and Lint Checking #
############################
# SLC 6
fmt:slc6-llvm-format:
stage: formatting
tags:
- docker
dependencies:
- cmp:slc6-llvm
image: clicdp/slc6-base
script:
- export COMPILER_TYPE="llvm"
- source .gitlab-ci.d/init_x86_64.sh
- cd build/
- ninja check-format
fmt:slc6-llvm-lint:
stage: formatting
tags:
- docker
dependencies:
- cmp:slc6-llvm
image: clicdp/slc6-base
script:
- export COMPILER_TYPE="llvm"
- source .gitlab-ci.d/init_x86_64.sh
- cd build/
- ninja check-lint
# CentOS 7
fmt:centos7-llvm-format:
stage: formatting
tags:
- docker
dependencies:
- cmp:cc7-llvm
image: clicdp/cc7-base
image: gitlab-registry.cern.ch/sft/docker/centos7:latest
script:
- export COMPILER_TYPE="llvm"
- source .gitlab-ci.d/init_x86_64.sh
......@@ -213,7 +163,7 @@ fmt:cc7-llvm-lint:
- docker
dependencies:
- cmp:cc7-llvm
image: clicdp/cc7-base
image: gitlab-registry.cern.ch/sft/docker/centos7:latest
script:
- export COMPILER_TYPE="llvm"
- source .gitlab-ci.d/init_x86_64.sh
......@@ -230,7 +180,7 @@ cmp:doxygen:
stage: documentation
tags:
- docker
image: clicdp/cc7-base
image: gitlab-registry.cern.ch/sft/docker/centos7:latest
dependencies: []
script:
- source .gitlab-ci.d/init_x86_64.sh
......@@ -273,7 +223,7 @@ pkg:slc6-gcc:
stage: packaging
tags:
- docker
image: clicdp/slc6-base
image: gitlab-registry.cern.ch/sft/docker/slc6:latest
only:
- tags
- schedules
......@@ -297,7 +247,7 @@ pkg:cc7-gcc:
stage: packaging
tags:
- docker
image: clicdp/cc7-base
image: gitlab-registry.cern.ch/sft/docker/centos7:latest
only:
- tags
- schedules
......
......@@ -84,7 +84,7 @@ INCLUDE("cmake/corryvreckan.cmake")
#########################################
# Set standard build flags
SET(COMPILER_FLAGS -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wconversion -Wuseless-cast -Wctor-dtor-privacy -Wzero-as-null-pointer-constant -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wswitch-default -Wundef -Werror -Wshadow -Wformat-security -Wdeprecated -fdiagnostics-color=auto -Wheader-hygiene)
SET(COMPILER_FLAGS -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wconversion -Wuseless-cast -Wctor-dtor-privacy -Wzero-as-null-pointer-constant -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wswitch-default -Wundef -Wshadow -Wformat-security -Wdeprecated -fdiagnostics-color=auto -Wheader-hygiene)
INCLUDE("cmake/compiler-flag-checks.cmake")
......@@ -160,6 +160,9 @@ ADD_RUNTIME_DEP(thisroot.sh)
# Load cpp format and check tools #
###################################
# Set the clang-format version required by the CI for correct formatting:
SET(CLANG_FORMAT_VERSION "8")
# Set the source files to clang-format (FIXME: determine this better)
FILE(GLOB_RECURSE
CHECK_CXX_SOURCE_FILES
......
......@@ -21,34 +21,47 @@ IF(NOT CHECK_CXX_SOURCE_FILES)
ENDIF()
# Adding clang-format check and formatter if found
FIND_PROGRAM(CLANG_FORMAT NAMES "clang-format-6.0" "clang-format-5.0" "clang-format-4.0" "clang-format" "clang-format-7")
FIND_PROGRAM(CLANG_FORMAT NAMES "clang-format-8" "clang-format")
IF(CLANG_FORMAT)
MESSAGE(STATUS "Found ${CLANG_FORMAT}, adding formatting targets")
ADD_CUSTOM_TARGET(
format
COMMAND
${CLANG_FORMAT}
-i
-style=file
${CHECK_CXX_SOURCE_FILES}
COMMENT "Auto formatting of all source files"
)
EXEC_PROGRAM(${CLANG_FORMAT} ${CMAKE_CURRENT_SOURCE_DIR} ARGS --version OUTPUT_VARIABLE CLANG_VERSION)
STRING(REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" CLANG_MAJOR_VERSION ${CLANG_VERSION})
ADD_CUSTOM_TARGET(
check-format
COMMAND
${CLANG_FORMAT}
-style=file
-output-replacements-xml
${CHECK_CXX_SOURCE_FILES}
# print output
| tee ${CMAKE_BINARY_DIR}/check_format_file.txt | grep -c "replacement " |
tr -d "[:cntrl:]" && echo " replacements necessary"
# WARNING: fix to stop with error if there are problems
COMMAND ! grep -c "replacement "
${CMAKE_BINARY_DIR}/check_format_file.txt > /dev/null
COMMENT "Checking format compliance"
)
# We currently require version 8 - which is not available on OSX...
IF(${CLANG_MAJOR_VERSION} EQUAL ${CLANG_FORMAT_VERSION} OR DEFINED ${APPLE})
IF(DEFINED ${APPLE})
MESSAGE(WARNING "Found ${CLANG_FORMAT} version ${CLANG_MAJOR_VERSION}, this might lead to incompatible formatting")
ELSE()
MESSAGE(STATUS "Found ${CLANG_FORMAT} version ${CLANG_FORMAT_VERSION}, adding formatting targets")
ENDIF()
ADD_CUSTOM_TARGET(
format
COMMAND
${CLANG_FORMAT}
-i
-style=file
${CHECK_CXX_SOURCE_FILES}
COMMENT "Auto formatting of all source files"
)
ADD_CUSTOM_TARGET(
check-format
COMMAND
${CLANG_FORMAT}
-style=file
-output-replacements-xml
${CHECK_CXX_SOURCE_FILES}
# print output
| tee ${CMAKE_BINARY_DIR}/check_format_file.txt | grep -c "replacement " |
tr -d "[:cntrl:]" && echo " replacements necessary"
# WARNING: fix to stop with error if there are problems
COMMAND ! grep -c "replacement "
${CMAKE_BINARY_DIR}/check_format_file.txt > /dev/null
COMMENT "Checking format compliance"
)
ELSE()
MESSAGE(STATUS "Could only find version ${CLANG_MAJOR_VERSION} of clang-format, but version ${CLANG_FORMAT_VERSION} is required.")
ENDIF()
ELSE()
MESSAGE(STATUS "Could NOT find clang-format")
ENDIF()
......@@ -59,7 +72,7 @@ IF(${CMAKE_CXX_STANDARD})
SET(CXX_STD ${CMAKE_CXX_STANDARD})
ENDIF()
FIND_PROGRAM(CLANG_TIDY NAMES "clang-tidy-6.0" "clang-tidy-5.0" "clang-tidy-4.0" "clang-tidy")
FIND_PROGRAM(CLANG_TIDY NAMES "clang-tidy-8" "clang-tidy")
# Enable clang tidy only if using a clang compiler
IF(CLANG_TIDY AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# If debug build enabled do automatic clang tidy
......
......@@ -9,7 +9,7 @@ This chapter contains details on the standard installation process and informati
\section{Supported Operating Systems}
\label{sec:os}
\corry is designed to run without issues on either a recent Linux distribution or Mac OS\,X.
Furthermore, the continuous integration of the project ensures correct building and functioning of the software framework on CentOS\,7 (with GCC and LLVM), SLC\,6 (with GCC and LLVM) and Mac OS Mojave (OS X 10.14, with AppleClang).
Furthermore, the continuous integration of the project ensures correct building and functioning of the software framework on CentOS\,7 (with GCC and LLVM), SLC\,6 (with GCC only) and Mac OS Mojave (OS X 10.14, with AppleClang).
\section{CMVFS}
\label{sec:cvmfs_install}
......
......@@ -8,7 +8,7 @@
##################################################################
# SETTINGS
# set path to clang-format binary
for bin in "clang-format-6.0" "clang-format-5.0" "clang-format-4.0" "clang-format-7" "clang-format";
for bin in "clang-format-8" "clang-format";
do
CLANG_FORMAT=$(which "$bin")
[ -n "$CLANG_FORMAT" ] && break
......@@ -60,26 +60,37 @@ if [ ! -x "$CLANG_FORMAT" ] ; then
exit 1
fi
if ! "$CLANG_FORMAT" --version | grep 'clang-format version 8\.0' >/dev/null 2>/dev/null; then
# Be indulgent with OSX users, no 4.0 seems to be available...
if [[ "$OSTYPE" != "darwin"* ]]; then
printf "Error: clang-format version 8.0 is required (exactly), cannot check format!\n"
exit 1
else
printf "Warning: clang-format version 8.0 is required, formatting might be incompatible!\n"
fi
fi
# create one patch containing all changes to the files
git diff-index --cached --diff-filter=ACMR --name-only $against -- src/ | while read file;
git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file;
do
# ignore file if we do check for file extensions and the file
# does not match any of the extensions specified in $FILE_EXTS
if ! matches_extension "$file"; then
continue;
fi
# temporary save the staged file to work with this instead of the real file
git show :$file > $staged_file
# clang-format our sourcefile, create a patch and append it to our $patch
cat "$staged_file" | "$CLANG_FORMAT" -assume-filename=$file -style=file | \
git diff --no-index -- "$staged_file" - | \
sed -e "s|--- a$staged_file|--- a/$file|" | \
sed -e "s|+++ b/-|+++ b/$file|" >> "$patch"
# also make a colored patch for displaying if needed
if [ "$VERBOSE" -ne 0 ] ; then
sed -e "s|+++ b/-|+++ b/$file|" >> "$patch"
# also make a colored patch for displaying if needed
if [ "$VERBOSE" -ne 0 ] ; then
cat "$staged_file" | "$CLANG_FORMAT" -assume-filename=$file -style=file | \
git diff --color --no-index -- "$staged_file" - | \
sed -e "s|--- a$staged_file|--- a/$file|" | \
......@@ -89,7 +100,7 @@ done
# if no patch has been generated all is ok, clean up the file stub and exit
if [ ! -s "$patch" ] ; then
if [ "$VERBOSE" -ne 0 ] ; then
if [ "$VERBOSE" -ne 0 ] ; then
printf "Changes in this commit comply with the clang-format rules.\n"
fi
rm -f "$patch"
......@@ -108,7 +119,7 @@ if [ $? -ne 0 ] ; then
rm -f "$patch";
rm -f "$patch_color";
rm -f "$staged_file"
exit 1;
exit 1;
fi
# a patch has been created, let the user know about it
......@@ -118,24 +129,24 @@ if [ "$VERBOSE" -ne 0 ] ; then
printf "The following differences were found between the code to commit "
printf "and the clang-format rules:\n"
cat "$patch_color"
printf "\n"
printf "\n"
fi
# assign stdin back to keyboard
# assign stdin back to keyboard
exec < /dev/tty
# ask what we want to do with the patch
while true; do
read -p "Do you want to install the patch (yes - commit with patch, no - do not commit)? [y/n] " yn
case $yn in
[Yy] )
git apply --index $patch;
[Yy] )
git apply --index $patch;
rm -f "$patch";
rm -f "$patch_color";
rm -f "$staged_file"
exit 0
;;
[Nn] )
[Nn] )
printf "Changes are not applied! You can apply these changes manually with:\n";
printf " git apply --index $patch\n";
printf " (needs to be called from the root directory of your repository)\n";
......
......@@ -158,10 +158,11 @@ namespace corryvreckan {
* All the required directories are deleted recursively from the top-directory (use this with caution).
*/
inline void remove_path(const std::string& path) {
int status = nftw(path.c_str(),
[](const char* remove_path, const struct stat*, int, struct FTW*) { return remove(remove_path); },
64,
FTW_DEPTH);
int status = nftw(
path.c_str(),
[](const char* remove_path, const struct stat*, int, struct FTW*) { return remove(remove_path); },
64,
FTW_DEPTH);
if(status != 0) {
throw std::invalid_argument("path cannot be completely deleted");
......
......@@ -59,7 +59,6 @@ void GblTrack::fit() {
scatterWidth(0) = 1 / (scatteringTheta(material, total_material) * scatteringTheta(material, total_material));
scatterWidth(1) = scatterWidth(0);
point.addScatterer(Eigen::Vector2d::Zero(), scatterWidth);
};
auto JacToNext = [](double val) {
Matrix5d Jac;
......@@ -81,7 +80,7 @@ void GblTrack::fit() {
};
// lambda to add plane (not the first one) and air scatterers //FIXME: Where to put them?
auto addPlane = [&JacToNext, &prevPos, &addMeasurementtoGblPoint, &addScattertoGblPoint, &points, this](
std::vector<Plane>::iterator& plane) {
std::vector<Plane>::iterator& plane) {
double dist = plane->postion() - prevPos;
double frac1 = 0.21, frac2 = 0.58;
// Current layout
......
......@@ -8,9 +8,10 @@
#pragma link off all functions;
// Missing ROOT objects
#pragma link C++ class ROOT::Math::Cartesian2D < unsigned int > +;
#pragma link C++ class ROOT::Math::DisplacementVector2D < ROOT::Math::Cartesian2D < unsigned int >, \
ROOT::Math::DefaultCoordinateSystemTag > +;
#pragma link C++ class ROOT::Math::Cartesian2D < unsigned int> + ;
#pragma link C++ class ROOT::Math::DisplacementVector2D < ROOT::Math::Cartesian2D < unsigned int>, \
ROOT::Math::DefaultCoordinateSystemTag> + \
;
// Corryvreckan objects
#pragma link C++ class corryvreckan::Object + ;
......@@ -26,4 +27,4 @@
#pragma link C++ class corryvreckan::Event + ;
// Vector of Object for internal storage
#pragma link C++ class std::vector < corryvreckan::Object* > +;
#pragma link C++ class std::vector < corryvreckan::Object*> + ;
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