From bd0ac33bb44a5a4c520d4624d9e8e629f4e53f5f Mon Sep 17 00:00:00 2001 From: Johannes Lenzen Date: Tue, 5 Jan 2021 11:09:54 +0100 Subject: [PATCH 1/6] Added iwyu jobs --- .gitignore | 2 ++ .gitlab-ci.yml | 16 ++++++++++++++++ CI/ci-linux-build.sh | 22 ++++++++++++++++++++-- CI/ci-linux-prepare.sh | 9 ++++++++- CI/gitlab-ci/linux-iwyu-job.yml | 15 +++++++++++++++ CI/gitlab-ci/linux.yml | 2 ++ 6 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 CI/gitlab-ci/linux-iwyu-job.yml diff --git a/.gitignore b/.gitignore index de469da2..1d14c766 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ build* .settings # ignore mac temporal files .DS_Store +.idea +cmake-build*/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d60107c..98d10a02 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -321,6 +321,22 @@ test-release-clang-cpp14: +#----------- Job Informations: +# Type: Build: release +# OS: Linux +# Compiler: clang +# Language: cpp14 + +build-release-clang-cpp14: + stage: build + script: "CI/ci-linux-build.sh clang cpp14 release IWYU" + image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container + tags: [Docker] + artifacts: + paths: + - build-clang-cpp14-release-Vector-Checks/compile_commands.json + - build-clang-cpp14-release-Vector-Checks/iwyu.dump + # ----------------- # MAC tasks # ----------------- diff --git a/CI/ci-linux-build.sh b/CI/ci-linux-build.sh index db28ab29..d4cd9572 100755 --- a/CI/ci-linux-build.sh +++ b/CI/ci-linux-build.sh @@ -31,7 +31,25 @@ cd build-$BUILDPATH-Vector-Checks cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DOPENMESH_BUILD_UNIT_TESTS=TRUE -DSTL_VECTOR_CHECKS=ON $OPTIONS ../ -#build it -make $MAKE_OPTIONS +if [ "$IWYU" == "IWYU" ]; then + # do iwyu check + if echo $(iwyu --version) | grep -q "0.11" + then + # support older tool version + iwyu_tool -j 4 -p . -- \ + --mapping_file=/usr/share/include-what-you-use/gcc.libc.imp \ + --mapping_file=/usr/share/include-what-you-use/clang-6.intrinsics.imp \ + | tee iwyu.dump + else + # current tool version + iwyu_tool -j 4 -p . -- \ + -Xiwyu --mapping_file=/usr/share/include-what-you-use/gcc.libc.imp \ + -Xiwyu --mapping_file=/usr/share/include-what-you-use/clang-6.intrinsics.imp \ + | tee iwyu.dump + fi +else + # build it + make $MAKE_OPTIONS +fi cd .. \ No newline at end of file diff --git a/CI/ci-linux-prepare.sh b/CI/ci-linux-prepare.sh index 9153abea..ce6ef2c6 100755 --- a/CI/ci-linux-prepare.sh +++ b/CI/ci-linux-prepare.sh @@ -3,6 +3,7 @@ COMPILER=$1 LANGUAGE=$2 BUILD_TYPE=$3 +IWYU=$4 # Exit script on any error set -e @@ -56,4 +57,10 @@ if [ "$BUILD_TYPE" == "release" ]; then else export BUILD_TYPE=debug BUILDPATH="$BUILDPATH-debug" -fi \ No newline at end of file +fi + +if [ "$IWYU" == "IWYU" ]; then + echo "Include what you use enabled."; + BUILDPATH="$BUILDPATH-iwyu" + OPTIONS="$OPTIONS -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" +fi diff --git a/CI/gitlab-ci/linux-iwyu-job.yml b/CI/gitlab-ci/linux-iwyu-job.yml new file mode 100644 index 00000000..f6be9e48 --- /dev/null +++ b/CI/gitlab-ci/linux-iwyu-job.yml @@ -0,0 +1,15 @@ +#----------- Job Informations: +# Type: Build: {{BUILDTYPE}} +# OS: Linux +# Compiler: {{COMPILER}} +# Language: {{LANGUAGE}} + +build-{{BUILDTYPE}}-{{COMPILER}}-{{LANGUAGE}}: + stage: build + script: "CI/ci-linux-build.sh {{COMPILER}} {{LANGUAGE}} {{BUILDTYPE}} IWYU" + image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container + tags: [Docker] + artifacts: + paths: + - build-{{COMPILER}}-{{LANGUAGE}}-{{BUILDTYPE}}-Vector-Checks/compile_commands.json + - build-{{COMPILER}}-{{LANGUAGE}}-{{BUILDTYPE}}-Vector-Checks/iwyu.dump diff --git a/CI/gitlab-ci/linux.yml b/CI/gitlab-ci/linux.yml index 1ce9de13..fdc85ffe 100644 --- a/CI/gitlab-ci/linux.yml +++ b/CI/gitlab-ci/linux.yml @@ -16,3 +16,5 @@ cppcheck: {linux-template-job.yml, COMPILER=clang, LANGUAGE=cpp11} {linux-template-job.yml, COMPILER=gcc, LANGUAGE=cpp14} {linux-template-job.yml, COMPILER=clang, LANGUAGE=cpp14} + +{linux-iwyu-job.yml, BUILDTYPE=release, COMPILER=clang, LANGUAGE=cpp14} From 1ff404230f3c7db448ceeb133d6664dfe5c6cbe2 Mon Sep 17 00:00:00 2001 From: Johannes Lenzen Date: Tue, 5 Jan 2021 11:11:02 +0100 Subject: [PATCH 2/6] Renamed iwyu job --- .gitlab-ci.yml | 16 ++++++++-------- CI/gitlab-ci/linux-template-build-job.yml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 98d10a02..62b3bdb0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,7 @@ cppcheck: # Compiler: gcc # Language: cpp11 -build-debug-gcc-cpp11: +iwyu-debug-gcc-cpp11: stage: build script: "CI/ci-linux-build.sh gcc cpp11 debug" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -74,7 +74,7 @@ test-debug-gcc-cpp11: # Compiler: gcc # Language: cpp11 -build-release-gcc-cpp11: +iwyu-release-gcc-cpp11: stage: build script: "CI/ci-linux-build.sh gcc cpp11 release" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -110,7 +110,7 @@ test-release-gcc-cpp11: # Compiler: clang # Language: cpp11 -build-debug-clang-cpp11: +iwyu-debug-clang-cpp11: stage: build script: "CI/ci-linux-build.sh clang cpp11 debug" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -146,7 +146,7 @@ test-debug-clang-cpp11: # Compiler: clang # Language: cpp11 -build-release-clang-cpp11: +iwyu-release-clang-cpp11: stage: build script: "CI/ci-linux-build.sh clang cpp11 release" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -182,7 +182,7 @@ test-release-clang-cpp11: # Compiler: gcc # Language: cpp14 -build-debug-gcc-cpp14: +iwyu-debug-gcc-cpp14: stage: build script: "CI/ci-linux-build.sh gcc cpp14 debug" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -218,7 +218,7 @@ test-debug-gcc-cpp14: # Compiler: gcc # Language: cpp14 -build-release-gcc-cpp14: +iwyu-release-gcc-cpp14: stage: build script: "CI/ci-linux-build.sh gcc cpp14 release" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -254,7 +254,7 @@ test-release-gcc-cpp14: # Compiler: clang # Language: cpp14 -build-debug-clang-cpp14: +iwyu-debug-clang-cpp14: stage: build script: "CI/ci-linux-build.sh clang cpp14 debug" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -290,7 +290,7 @@ test-debug-clang-cpp14: # Compiler: clang # Language: cpp14 -build-release-clang-cpp14: +iwyu-release-clang-cpp14: stage: build script: "CI/ci-linux-build.sh clang cpp14 release" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container diff --git a/CI/gitlab-ci/linux-template-build-job.yml b/CI/gitlab-ci/linux-template-build-job.yml index 4dce86a3..876a1fd2 100644 --- a/CI/gitlab-ci/linux-template-build-job.yml +++ b/CI/gitlab-ci/linux-template-build-job.yml @@ -4,7 +4,7 @@ # Compiler: {{COMPILER}} # Language: {{LANGUAGE}} -build-{{BUILDTYPE}}-{{COMPILER}}-{{LANGUAGE}}: +iwyu-{{BUILDTYPE}}-{{COMPILER}}-{{LANGUAGE}}: stage: build script: "CI/ci-linux-build.sh {{COMPILER}} {{LANGUAGE}} {{BUILDTYPE}}" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container From a4a50217d8d42c30d55f42afb36ef4e4ff56663a Mon Sep 17 00:00:00 2001 From: Johannes Lenzen Date: Tue, 5 Jan 2021 11:12:25 +0100 Subject: [PATCH 3/6] Fixed gitlab ci yaml config errors --- .gitlab-ci.yml | 18 +++++++++--------- CI/gitlab-ci/linux-iwyu-job.yml | 2 +- CI/gitlab-ci/linux-template-build-job.yml | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 62b3bdb0..e1cb3402 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,7 @@ cppcheck: # Compiler: gcc # Language: cpp11 -iwyu-debug-gcc-cpp11: +build-debug-gcc-cpp11: stage: build script: "CI/ci-linux-build.sh gcc cpp11 debug" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -74,7 +74,7 @@ test-debug-gcc-cpp11: # Compiler: gcc # Language: cpp11 -iwyu-release-gcc-cpp11: +build-release-gcc-cpp11: stage: build script: "CI/ci-linux-build.sh gcc cpp11 release" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -110,7 +110,7 @@ test-release-gcc-cpp11: # Compiler: clang # Language: cpp11 -iwyu-debug-clang-cpp11: +build-debug-clang-cpp11: stage: build script: "CI/ci-linux-build.sh clang cpp11 debug" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -146,7 +146,7 @@ test-debug-clang-cpp11: # Compiler: clang # Language: cpp11 -iwyu-release-clang-cpp11: +build-release-clang-cpp11: stage: build script: "CI/ci-linux-build.sh clang cpp11 release" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -182,7 +182,7 @@ test-release-clang-cpp11: # Compiler: gcc # Language: cpp14 -iwyu-debug-gcc-cpp14: +build-debug-gcc-cpp14: stage: build script: "CI/ci-linux-build.sh gcc cpp14 debug" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -218,7 +218,7 @@ test-debug-gcc-cpp14: # Compiler: gcc # Language: cpp14 -iwyu-release-gcc-cpp14: +build-release-gcc-cpp14: stage: build script: "CI/ci-linux-build.sh gcc cpp14 release" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -254,7 +254,7 @@ test-release-gcc-cpp14: # Compiler: clang # Language: cpp14 -iwyu-debug-clang-cpp14: +build-debug-clang-cpp14: stage: build script: "CI/ci-linux-build.sh clang cpp14 debug" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -290,7 +290,7 @@ test-debug-clang-cpp14: # Compiler: clang # Language: cpp14 -iwyu-release-clang-cpp14: +build-release-clang-cpp14: stage: build script: "CI/ci-linux-build.sh clang cpp14 release" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container @@ -327,7 +327,7 @@ test-release-clang-cpp14: # Compiler: clang # Language: cpp14 -build-release-clang-cpp14: +iwyu-release-clang-cpp14: stage: build script: "CI/ci-linux-build.sh clang cpp14 release IWYU" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container diff --git a/CI/gitlab-ci/linux-iwyu-job.yml b/CI/gitlab-ci/linux-iwyu-job.yml index f6be9e48..247d8f13 100644 --- a/CI/gitlab-ci/linux-iwyu-job.yml +++ b/CI/gitlab-ci/linux-iwyu-job.yml @@ -4,7 +4,7 @@ # Compiler: {{COMPILER}} # Language: {{LANGUAGE}} -build-{{BUILDTYPE}}-{{COMPILER}}-{{LANGUAGE}}: +iwyu-{{BUILDTYPE}}-{{COMPILER}}-{{LANGUAGE}}: stage: build script: "CI/ci-linux-build.sh {{COMPILER}} {{LANGUAGE}} {{BUILDTYPE}} IWYU" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container diff --git a/CI/gitlab-ci/linux-template-build-job.yml b/CI/gitlab-ci/linux-template-build-job.yml index 876a1fd2..4dce86a3 100644 --- a/CI/gitlab-ci/linux-template-build-job.yml +++ b/CI/gitlab-ci/linux-template-build-job.yml @@ -4,7 +4,7 @@ # Compiler: {{COMPILER}} # Language: {{LANGUAGE}} -iwyu-{{BUILDTYPE}}-{{COMPILER}}-{{LANGUAGE}}: +build-{{BUILDTYPE}}-{{COMPILER}}-{{LANGUAGE}}: stage: build script: "CI/ci-linux-build.sh {{COMPILER}} {{LANGUAGE}} {{BUILDTYPE}}" image: graphics.rwth-aachen.de:4567/docker/docker/docker-openmesh-container From 1b97306058cc97d2126310f83bfedfd2f61186f7 Mon Sep 17 00:00:00 2001 From: Johannes Lenzen Date: Tue, 5 Jan 2021 11:15:32 +0100 Subject: [PATCH 4/6] Enabled script error on error --- CI/ci-linux-build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CI/ci-linux-build.sh b/CI/ci-linux-build.sh index d4cd9572..42dca598 100755 --- a/CI/ci-linux-build.sh +++ b/CI/ci-linux-build.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -e +set -o pipefail source CI/ci-linux-prepare.sh echo -e "${OUTPUT}" From ad5865bc6b7786ec11f9a87a48621d3246ca078f Mon Sep 17 00:00:00 2001 From: Johannes Lenzen Date: Tue, 5 Jan 2021 15:33:22 +0100 Subject: [PATCH 5/6] Fixed wrong artifact path --- CI/gitlab-ci/linux-iwyu-job.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/gitlab-ci/linux-iwyu-job.yml b/CI/gitlab-ci/linux-iwyu-job.yml index 247d8f13..0e5838aa 100644 --- a/CI/gitlab-ci/linux-iwyu-job.yml +++ b/CI/gitlab-ci/linux-iwyu-job.yml @@ -11,5 +11,5 @@ iwyu-{{BUILDTYPE}}-{{COMPILER}}-{{LANGUAGE}}: tags: [Docker] artifacts: paths: - - build-{{COMPILER}}-{{LANGUAGE}}-{{BUILDTYPE}}-Vector-Checks/compile_commands.json - - build-{{COMPILER}}-{{LANGUAGE}}-{{BUILDTYPE}}-Vector-Checks/iwyu.dump + - build-{{COMPILER}}-{{LANGUAGE}}-{{BUILDTYPE}}-iwyu-Vector-Checks/compile_commands.json + - build-{{COMPILER}}-{{LANGUAGE}}-{{BUILDTYPE}}-iwyu-Vector-Checks/iwyu.dump From 5dd941b48da2c9ca721c9a89dcfe46841dadba2b Mon Sep 17 00:00:00 2001 From: Johannes Lenzen Date: Tue, 5 Jan 2021 16:42:52 +0100 Subject: [PATCH 6/6] Corrected artifacts path --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e1cb3402..90a0316c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -334,8 +334,8 @@ iwyu-release-clang-cpp14: tags: [Docker] artifacts: paths: - - build-clang-cpp14-release-Vector-Checks/compile_commands.json - - build-clang-cpp14-release-Vector-Checks/iwyu.dump + - build-clang-cpp14-release-iwyu-Vector-Checks/compile_commands.json + - build-clang-cpp14-release-iwyu-Vector-Checks/iwyu.dump # ----------------- # MAC tasks