diff --git a/tools/analysis.sh b/tools/analysis.sh index 5faa9b8f1717ad7f908c8a688354a032dc97b9a3..a998b90ef9275f9d87c6889d59f3fb76fb463e8d 100755 --- a/tools/analysis.sh +++ b/tools/analysis.sh @@ -1,4 +1,16 @@ -#!/bin/bash +#!/usr/bin/env bash +### +# +# @file analysis.sh +# @copyright 2013-2021 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, +# Univ. Bordeaux. All rights reserved. +# +# @version 1.1.0 +# @author Florent Pruvost +# @author Mathieu Faverge +# @date 2021-01-07 +# +### # Performs an analysis of Chameleon source code: # - we consider to be in Chameleon's source code root @@ -6,10 +18,18 @@ # - we consider having cppcheck, rats, sonar-scanner programs available in the environment # filter sources: -# - consider generated files in build +# - consider generated files in ${BUILDDIR} # - exclude base *z* files to avoid duplication # - exclude cblas.h and lapacke-.h because not really part of chameleon and make cppcheck analysis too long -./tools/find_sources.sh + +if [ $# -gt 0 ] +then + BUILDDIR=$1 +fi +BUILDDIR=${BUILDDIR:-build} + +TOOLSDIR=$(dirname $0) +$TOOLSDIR/find_sources.sh # Generate coverage xml output INPUT_FILES="" @@ -19,6 +39,7 @@ do done lcov $INPUT_FILES -o chameleon.lcov lcov --summary chameleon.lcov + python3 /usr/local/lib/python3.8/dist-packages/lcov_cobertura.py chameleon.lcov --output chameleon_coverage.xml # Undefine this because not relevant in our configuration @@ -32,6 +53,9 @@ cppcheck $CPPCHECK_OPT -DPRECISION_d -UPRECISION_s -UPRECISION_c -UPRECISION_z - cppcheck $CPPCHECK_OPT -DPRECISION_c -UPRECISION_s -UPRECISION_d -UPRECISION_z --file-list=./filelist_c.txt 2>> chameleon_cppcheck.xml cppcheck $CPPCHECK_OPT -DPRECISION_z -UPRECISION_s -UPRECISION_d -UPRECISION_c --file-list=./filelist_z.txt 2>> chameleon_cppcheck.xml +# Set the default for the project key +SONARQUBE_PROJECTKEY=${SONARQUBE_PROJECTKEY:-hiepacs:chameleon:gitlab:$CI_PROJECT_NAMESPACE:$CI_COMMIT_REF_NAME} + # create the sonarqube config file cat > sonar-project.properties << EOF sonar.host.url=https://sonarqube.inria.fr/sonarqube @@ -42,11 +66,10 @@ sonar.links.scm=$CI_REPOSITORY_URL sonar.links.ci=$CI_PROJECT_URL/pipelines sonar.links.issue=$CI_PROJECT_URL/issues -sonar.projectKey=hiepacs:chameleon:gitlab:$CI_PROJECT_NAMESPACE:$CI_COMMIT_REF_NAME +sonar.projectKey=$SONARQUBE_PROJECTKEY sonar.projectDescription=Dense linear algebra subroutines for heterogeneous and distributed architectures -sonar.projectVersion=0.9 +sonar.projectVersion=master -sonar.lang.patterns.c++=**/*.cxx,**/*.cpp,**/*.cc,**/*.hxx,**/*.hpp,**/*.hh sonar.sources=build-openmp/runtime/openmp, build-parsec/runtime/parsec, build-quark/runtime/quark, build-starpu, compute, control, coreblas, example, include, runtime, testing sonar.inclusions=`cat filelist.txt | sed ':a;N;$!ba;s/\n/, /g'` sonar.c.includeDirectories=$(echo | gcc -E -Wp,-v - 2>&1 | grep "^ " | tr '\n' ',').,$(find . -type f -name '*.h' | sed -r 's|/[^/]+$||' |sort |uniq | xargs echo | sed -e 's/ /,/g'),$PARSEC_DIR/include,$QUARK_DIR/include,$STARPU_DIR/include/starpu/1.2,$SIMGRID_DIR/include @@ -59,6 +82,9 @@ sonar.c.coverage.reportPath=chameleon_coverage.xml sonar.c.cppcheck.reportPath=chameleon_cppcheck.xml sonar.c.clangsa.reportPath=build-openmp/analyzer_reports/*/*.plist, build-parsec/analyzer_reports/*/*.plist, build-quark/analyzer_reports/*/*.plist, build-starpu/analyzer_reports/*/*.plist, build-starpu_simgrid/analyzer_reports/*/*.plist sonar.c.jsonCompilationDatabase=build-openmp/compile_commands.json, build-parsec/compile_commands.json, build-quark/compile_commands.json, build-starpu/compile_commands.json, build-starpu_simgrid/compile_commands.json +sonar.lang.patterns.c++: **/*.cxx,**/*.cpp,**/*.cc,**/*.hxx,**/*.hpp,**/*.hh +sonar.lang.patterns.c: **/*.c,**/*.h +sonar.lang.patterns.python: **/*.py EOF # run sonar analysis + publish on sonarqube-dev diff --git a/tools/check_header.sh b/tools/check_header.sh index 8d0c21d2e9f0814a3a0c73aac084a61e21b95209..024feb67bb556787bf6ae2594a54b210320a1596 100755 --- a/tools/check_header.sh +++ b/tools/check_header.sh @@ -1,17 +1,18 @@ # # @file check_header.sh # -# @copyright 2016-2020 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, +# @copyright 2016-2021 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, # Univ. Bordeaux. All rights reserved. # # @version 1.0.0 +# @author Florent Pruvost # @author Mathieu Faverge # @date 2020-03-03 # # This script check that basic informations is present and correct in # headers of source files. # -#!/bin/sh +#!/usr/bin/env sh header=1 print_header() @@ -26,18 +27,18 @@ print_header() check_header_file() { filename=$1 - basename=`basename $filename .in` + basename=$( basename $filename .in ) if [ "$basename" != "CMakeLists.txt" ] then - toto=`grep " @file $basename" $filename` + toto=$( grep " @file $basename" $filename ) if [ $? -ne 0 ] then - toto=`grep " @file .*/$basename" $filename` + toto=$( grep " @file .*/$basename" $filename ) fi if [ $? -ne 0 ] then - toto=`grep " @file chameleon_$basename" $filename` + toto=$( grep " @file chameleon_$basename" $filename ) fi if [ $? -ne 0 ] @@ -51,13 +52,10 @@ check_header_file() check_header_copyright() { filename=$1 - basename=`basename $filename` + basename=$( basename $filename ) - toto=`grep -E " @copyright [0-9]{4}-2020 Bordeaux INP" $filename` - if [ $? -ne 0 ] - then - toto=`grep -E " @copyright 2020 Bordeaux INP" $filename` - fi + year=$( date +%Y ) + toto=$( grep -E " @copyright [0-9]{4}-$year Bordeaux INP" $filename ) if [ $? -ne 0 ] then @@ -69,9 +67,9 @@ check_header_copyright() check_header_version() { filename=$1 - basename=`basename $filename` + basename=$( basename $filename ) - toto=`grep -E " @version [0-9]\.[0-9]\.[0-9]" $filename` + toto=$( grep -E " @version [0-9]\.[0-9]\.[0-9]" $filename ) if [ $? -ne 0 ] then print_header $filename @@ -82,9 +80,9 @@ check_header_version() check_header_author() { filename=$1 - basename=`basename $filename` + basename=$( basename $filename ) - toto=`grep -E " @author " $filename` + toto=$( grep -E " @author " $filename ) if [ $? -ne 0 ] then print_header $filename @@ -95,9 +93,9 @@ check_header_author() check_header_date() { filename=$1 - basename=`basename $filename` + basename=$( basename $filename ) - toto=`grep -E " @date [0-9]{4}-[01][0-9]-[0-3][0-9]" $filename` + toto=$( grep -E " @date [0-9]{4}-[01][0-9]-[0-3][0-9]" $filename ) if [ $? -ne 0 ] then print_header $filename @@ -108,28 +106,28 @@ check_header_date() check_header_define() { filename=$1 - basename=`basename $filename` + basename=$( basename $filename ) case $basename in *.h) - n=`basename $basename .h | awk '{print tolower($0)}'` + n=$( basename $basename .h | awk '{print tolower($0)}' ) macro="_${n}_h_" err=0 - toto=`grep "#ifndef .*$macro" $filename` + toto=$( grep "#ifndef .*$macro" $filename ) ret=$? err=$((err + ret)) if [ $ret -eq 0 ] then - macro=`grep "#ifndef" $filename | sed 's/#ifndef //'` + macro=$( grep "#ifndef" $filename | sed 's/#ifndef //' ) fi - toto=`grep "#define $macro" $filename` + toto=$( grep "#define $macro" $filename ) ret=$? err=$((err + ret)) - toto=`grep "#endif /\* $macro \*/" $filename` + toto=$( grep "#endif /\* $macro \*/" $filename ) ret=$? err=$((err + ret)) @@ -160,16 +158,26 @@ check_header() check_header_file $1 check_header_copyright $1 check_header_version $1 -# check_header_author $1 -# check_header_date $1 + check_header_author $1 + check_header_date $1 check_header_define $1 } # # Check headers # -files=`git ls-files | grep -v "^\." | grep -v ".*\.md" | grep -v LICENSE | grep -v ".*\.cmake" | grep -v "testing/lin" | grep -v doc/ | grep -v CTest | grep -v cblas.h | grep -v lapacke.h | grep -v "simucore/perfmodels/\.starpu" | grep -v "\.org"` - +files=$( git ls-files | + grep -v "^\." | + grep -v ".*\.md" | + grep -v LICENSE | + grep -v ".*\.cmake" | + grep -v "testing/lin" | + grep -v doc/ | + grep -v CTest | + grep -v cblas.h | + grep -v lapacke.h | + grep -v "simucore/perfmodels/\.starpu" | + grep -v "\.org" ) if [ $# -gt 0 ] then files=$* diff --git a/tools/release.sh b/tools/release.sh index d226ca604465c8910fc3ff69a6957626535bd8b3..94b7a236e5380eff0e3f4739df23d0d0b53c1755 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,5 +1,27 @@ -#!/bin/bash +#!/usr/bin/env bash +### +# +# @file release.sh +# @copyright 2013-2021 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, +# Univ. Bordeaux. All rights reserved. +# +# @brief Script to generate the release when pushing a branch and tag of the same name +# +# @version 1.1.0 +# @author Florent Pruvost +# @author Mathieu Faverge +# @date 2021-04-07 +# +### +# +# Steps to do the release: +# - Update information in the code (see update_release.sh) +# - Update the ChangeLog +# - Push the hash on solverstack as: +# - a tag named vx.x.x +# - a branch named release-x.x.x (will trigger the CI to generate the release) +# changelog="" function gen_changelog() { @@ -18,7 +40,7 @@ function gen_changelog() #echo $line done - changelog="${changelog}\n__WARNING__: Download the source archive by clicking on the link __Download release__ above, please do not consider the link Source code to get all submodules.\n" + changelog="$changelog\nWARNING: Download the source archive by clicking on the link __Download release__ above, please do not consider the automatic Source code links as they are missing the submodules.\n" } release="" @@ -39,10 +61,6 @@ then exit 1 fi -# extract the change log from ChangeLog -gen_changelog -echo $changelog - # generate the archive wget https://raw.githubusercontent.com/Kentzo/git-archive-all/master/git_archive_all.py python3 git_archive_all.py --force-submodules chameleon-$RELEASE_NAME.tar.gz @@ -51,6 +69,10 @@ python3 git_archive_all.py --force-submodules chameleon-$RELEASE_NAME.tar.gz GETURL=`echo curl --request POST --header \"PRIVATE-TOKEN: $RELEASE_TOKEN\" --form \"file=\@chameleon-$RELEASE_NAME.tar.gz\" https://gitlab.inria.fr/api/v4/projects/$CI_PROJECT_ID/uploads` MYURL=`eval $GETURL | jq .url | sed "s#\"##g"` +# extract the change log from ChangeLog +gen_changelog +echo $changelog + # Try to remove the release if it already exists curl --request DELETE --header "PRIVATE-TOKEN: $RELEASE_TOKEN" https://gitlab.inria.fr/api/v4/projects/$CI_PROJECT_ID/releases/v$RELEASE_NAME