Commit 21caf214 authored by Mathieu Faverge's avatar Mathieu Faverge

Add scripts to enable CI

parent 1e7bad3a
image: hpclib/hiepacs
stages:
- build
- test
- sonar
# - doc
before_script:
- git submodule update --init --recursive
- mkdir -p build
build:
stage: build
artifacts:
name: hqr_build
expire_in: 42 minutes
untracked: true
script:
- cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=${PWD}/../install -DBUILD_SHARED_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_C_FLAGS="-O0 -g -fPIC --coverage -Wall -fdiagnostics-show-option -fno-inline" -DCMAKE_EXE_LINKER_FLAGS="--coverage" | tee ../hqr-build.log
- ctest --no-compress-output -V -j 5
-D ExperimentalBuild
-D ExperimentalSubmit | tee -a hqr_build.log
- make install | tee -a ../hqr-build.log
test:
stage: test
dependencies:
- build_hqr
artifacts:
name: hqr_analysis
expire_in: 42 minutes
paths:
- hqr.lcov
- hqr-tests.log
script:
- source install/bin/hqr_env.sh
- cd build
- ctest -D ExperimentalTest
-D ExperimentalCoverage
-D ExperimentalSubmit | tee hqr-tests.log
- lcov --directory . --capture --output-file hqr.lcov
sonar:
stage: sonar
dependencies:
- build_hqr
- test_hqr
artifacts:
name: hqr_sonar
expire_in: 1 week
paths:
- hqr-coverage.xml
- hqr-cppcheck.xml
- hqr-rats.xml
- sonar.log
script:
- lcov_cobertura.py hqr.lcov --output hqr-coverage.xml
- ./analysis.sh
# pages:
# stage: doc
# script:
# - cmake . -DBUILD_DOCUMENTATION=ON
# - make
# - mv docs/out/html ../public/
# artifacts:
# paths:
# - public
# only:
# - master
......@@ -85,6 +85,7 @@ install(TARGETS hqr
LIBRARY DESTINATION lib)
generate_hqr_pkgconfig_file()
generate_env_file()
#-- Add a custom target to generate tags
add_custom_target (tags
......
#!/bin/bash
# Performs an analysis of HQR source code:
# - we consider to be in HQR's source code root
# - we consider having the coverage file hqr-coverage.xml in the root directory
# - we consider having cppcheck, rats, sonar-scanner programs available in the environment
# List source files:
rm -f filelist.txt
git ls-files | grep "\.[ch]$" > filelist.txt
# Undefine this because not relevant in our configuration
export UNDEFINITIONS="-UWIN32 -UWIN64 -U_MSC_EXTENSIONS -U_MSC_VER -U__SUNPRO_C -U__SUNPRO_CC -U__sun -Usun -U__cplusplus"
# run cppcheck analysis
cppcheck -v -f --language=c --platform=unix64 --enable=all --xml --xml-version=2 --suppress=missingIncludeSystem ${UNDEFINITIONS} --file-list=./filelist.txt 2> hqr-cppcheck.xml
# run rats analysis
rats -w 3 --xml `cat filelist.txt` > hqr-rats.xml
# create the sonarqube config file
cat > sonar-project.properties << EOF
sonar.host.url=https://hpclib-sed.bordeaux.inria.fr/sonarqube-dev
sonar.links.homepage=https://gitlab.inria.fr/solverstack/hqr
sonar.links.ci=https://gitlab.inria.fr/solverstack/hqr/pipelines
sonar.links.scm=https://gitlab.inria.fr/solverstack/hqr/
sonar.projectKey=hqr
sonar.projectName=hqr
sonar.projectDescription=Dense linear algebra subroutines for heterogeneous and distributed architectures
sonar.projectVersion=master
sonar.language=c++
sonar.sources=build, compute, control, coreblas, example, include, runtime, testing, timing
sonar.inclusions=`cat filelist.txt | xargs echo | sed 's/ /, /g'`
sonar.sourceEncoding=UTF-8
sonar.cxx.compiler.charset=UTF-8
sonar.cxx.compiler.parser=GCC
sonar.cxx.compiler.regex=^(.*):(\\d+):\\d+: warning: (.*)\\[(.*)\\]$
sonar.cxx.compiler.reportPath=hqr-build.log
sonar.cxx.coverage.reportPath=hqr-coverage.xml
sonar.cxx.cppcheck.reportPath=hqr-cppcheck.xml
sonar.cxx.rats.reportPath=hqr-rats.xml
EOF
# run sonar analysis + publish on sonarqube-dev
sonar-scanner -X -Dsonar.login=077ef775a8b4fe9ba722497ef0511ca6dcfb3fcd > sonar.log
......@@ -100,6 +100,26 @@ macro(GENERATE_HQR_PKGCONFIG_FILE)
endmacro(GENERATE_HQR_PKGCONFIG_FILE)
###
#
# generate_env_file: generate files pastix.pc
#
###
macro(generate_env_file)
# Create .sh file
# ---------------
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/hqr_env.sh.in"
"${CMAKE_BINARY_DIR}/bin/hqr_env.sh" @ONLY)
# installation
# ------------
install(FILES "${CMAKE_BINARY_DIR}/bin/hqr_env.sh"
DESTINATION bin)
endmacro(generate_env_file)
##
## @end file GenPkgConfig.cmake
##
#
# @file hqr_env.sh
#
# @copyright 2016-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
# @version 6.0.0
# @author Mathieu Faverge
# @date 2017-06-24
#
#!/bin/sh
LIB=hqr
export HQR_DIR=@CMAKE_INSTALL_PREFIX@
for i in PATH DYLD_LIBRARY_PATH LD_LIBRARY_PATH LIBRARY_PATH LD_RUN_PATH INCLUDE INCLUDE_PATH PKG_CONFIG_PATH PYTHONPATH
do
for j in /hqr
do
cmd1="echo \\\"\$$i\\\" | sed -E 's+^(\(.*:|\))[^:]*${j}[^:]*(\(|:.*\))$+\1\2+' | sed 's/::/:/' | sed 's/^://' | sed 's/:$//' "
temp=`eval $cmd1`;
eval "$i=$temp";
done
done
export PATH=$PATH:$HQR_DIR/bin
export LD_RUN_PATH=$LD_RUN_PATH:$HQR_DIR/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HQR_DIR/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$HQR_DIR/lib
export LIBRARY_PATH=$LIBRARY_PATH:$HQR_DIR/lib
export PYTHONPATH=$PYTHONPATH:$HQR_DIR/lib/python
export INCLUDE=$INCLUDE:$HQR_DIR/include
export INCLUDE_PATH=$INCLUDE_PATH:$HQR_DIR/include
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HQR_DIR/lib/pkgconfig
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