From 3eea42d4bf7d56dbc6aed3391fd2e8838d157b20 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 27 Dec 2018 11:41:22 +0100 Subject: [PATCH 01/12] improve gitlab/build infrastructure --- .gitlab-ci.yml | 18 +++++++++++++++++ CMakeLists.txt | 1 + Documentation/Examples/CMakeLists.txt | 8 ++++---- README.md | 28 +++++++++++++++++++++------ Tools/CMakeLists.txt | 6 ++++++ 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 Tools/CMakeLists.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad2746000..5d437eecb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,7 @@ variables: before_script: - apt-get update --yes - apt-get install --yes cmake libboost-dev libeigen3-dev python3 gfortran + - apt-get install --yes doxygen graphviz build: stage: build @@ -18,6 +19,23 @@ build: - cmake --build . - ctest +pages: + stage: documentation + script: + - make doxygen + - mkdir .public + - cp -r Documentation/Doxygen/html .public/ + - mv .public public + artifacts: + paths: + - public + only: + - master + - tags + - triggers + - schedules + + # code_quality: # image: docker:stable # variables: diff --git a/CMakeLists.txt b/CMakeLists.txt index d2d4df9b1..f0a9f0898 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,3 +70,4 @@ add_subdirectory (Setup) add_subdirectory (Processes) add_subdirectory (Documentation) add_subdirectory (Main) +add_subdirectory (Tools) diff --git a/Documentation/Examples/CMakeLists.txt b/Documentation/Examples/CMakeLists.txt index cd7e52513..47a7a495c 100644 --- a/Documentation/Examples/CMakeLists.txt +++ b/Documentation/Examples/CMakeLists.txt @@ -7,13 +7,13 @@ add_test(helix_example helix_example) add_executable (geometry_example geometry_example.cc) target_compile_options(geometry_example PRIVATE -g) # do not skip asserts target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits) -#install (TARGETS geometry_example DESTINATION share/examples) +install (TARGETS geometry_example DESTINATION share/examples) add_test(geometry_example geometry_example) add_executable (logger_example logger_example.cc) target_compile_options(logger_example PRIVATE -g) # do not skip asserts target_link_libraries (logger_example CORSIKAunits CORSIKAlogging) -#install (TARGETS logger_example DESTINATION share/examples) +install (TARGETS logger_example DESTINATION share/examples) add_test(logger_example logger_example) add_executable (stack_example stack_example.cc) @@ -35,7 +35,7 @@ target_link_libraries (cascade_example SuperStupidStack CORSIKAunits CORSIKAlogg CORSIKAenvironment CORSIKAprocesssequence ) -#install (TARGETS cascade_example DESTINATION share/examples) +install (TARGETS cascade_example DESTINATION share/examples) add_test(cascade_example cascade_example) add_executable (staticsequence_example staticsequence_example.cc) @@ -45,5 +45,5 @@ target_link_libraries (staticsequence_example CORSIKAunits CORSIKAgeometry CORSIKAlogging) -#install (TARGETS staticsequence_example DESTINATION share/examples) +install (TARGETS staticsequence_example DESTINATION share/examples) add_test(staticsequence_example staticsequence_example) diff --git a/README.md b/README.md index 421dc0860..d072278b2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Documentation and reference guide for the CORSIKA8 software framework for air shower simulations. We aim that CORSIKA remains the most comprehensive framework for simulating particle cascades with stochastic and continuous processes. The purpose of CORSIKA is to -simulate any particle cascades in astroparticle physics or astrophysical context. A lot of emphasis is put on modularity, completeness, validation and correctness. To boost computational efficiency different techniques are +simulate any particle cascades in astroparticle physics or astrophysical context. A lot of emphasis is put on modularity, flexibility, completeness, validation and correctness. To boost computational efficiency different techniques are provided, like thinning or cascade equations. The software makes extensive use of static design patterns and @@ -14,9 +14,9 @@ only specific model parameters can still be changed. CORSIKA8 is released under the GPL3 license. See [license file](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/LICENSE) which is part of every release and the source code. When you contribute to CORSIKA check the guidelines outlined here: -[coding guidelines](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/CONTRIBUTING.md). Code that fail the review by the CORSIKA author group must be improved before it can be merged in the official code base. After your code has been accepted and merged you become a contributor of the CORSIKA project and you should include yourself in the [AUTHORS](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/AUTHORS) file. +[coding guidelines](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/CONTRIBUTING.md). Code that fails the review by the CORSIKA author group must be improved before it can be merged in the official code base. After your code has been accepted and merged you become a contributor of the CORSIKA project and you should include yourself in the [AUTHORS](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/AUTHORS) file. -You need to read and agree to the [collaboration agreement](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/COLLABORATION_AGREEMENT.md). The agreement can be discussed, and eventually improved. +IMPORTANT: Before your contribute, you need to read and agree to the [collaboration agreement](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/COLLABORATION_AGREEMENT.md). The agreement can be discussed, and eventually improved. We also want to point you to the [MCnet guidelines](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika/blob/master/MCNET_GUIDELINES), which are very useful also for us. @@ -27,11 +27,11 @@ Prerequisites: eigen3, boost, cmake, g++, git. On Ubuntu 18.04, just do: sudo apt-get install libeigen3-dev libboost-dev cmake g++ git ``` -Follow these steps to download and install CORSIKA8-milestone1 +Follow these steps to download and install CORSIKA8-milestone2 ``` git clone git@gitlab.ikp.kit.edu:AirShowerPhysics/corsika.git cd corsika -git checkout milestone1 +git checkout milestone2 mkdir ../corsika-build cd ../corsika-build cmake ../corsika -DCMAKE_INSTALL_PREFIX=../corsika-install @@ -39,7 +39,19 @@ make -j8 make install make test ``` -and if you want to see how the Heitler model works and is implemented, see `Framework/Cascade/testCascade.cc` for a starting point. +and if you want to see how the first simple hadron cascade develops, see `Documentation/Examples/cascade_example.cc` for a starting point. + +Run the cascade_example with: +``` +cd ../corsika-install +share/examples/cascade_example +``` + +Visualize output: +``` +bash share/tools/plot_tracks.sh tracks.dat +firefox tracks.dat.gif +``` ### Generating doxygen documentation @@ -51,3 +63,7 @@ Switch to the corsika build directory and do ``` make doxygen ``` +browse with firefox: +``` +firefox ../corsika-install/share/doc/html/index.html +``` diff --git a/Tools/CMakeLists.txt b/Tools/CMakeLists.txt new file mode 100644 index 000000000..c0e4c12b9 --- /dev/null +++ b/Tools/CMakeLists.txt @@ -0,0 +1,6 @@ +set (TOOLS_FILES plot_tracks.sh) + +install ( + FILES ${TOOLS_FILES} + DESTINATION share/tools + ) -- GitLab From 40f3531c3b63cfeae83c0f26a91d89aacf27abbb Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 27 Dec 2018 11:43:40 +0100 Subject: [PATCH 02/12] fix stage --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d437eecb..10dd60609 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,7 @@ build: - ctest pages: - stage: documentation + stage: build script: - make doxygen - mkdir .public -- GitLab From cc676a8809c7380ab82020fb8885424a56f7ecdc Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 27 Dec 2018 11:49:43 +0100 Subject: [PATCH 03/12] added right tag to build --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 10dd60609..787fd016c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ before_script: build: stage: build tags: - - run1 + - corsika script: - mkdir build - cd build @@ -21,6 +21,8 @@ build: pages: stage: build + tags: + - corsika script: - make doxygen - mkdir .public -- GitLab From c488a437bf5657be892f6ae5fa0c7be666dcd05e Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 27 Dec 2018 12:05:16 +0100 Subject: [PATCH 04/12] fixed doxygen build --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 787fd016c..e6d260a19 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,6 +24,9 @@ pages: tags: - corsika script: + - mkdir build + - cd build + - cmake .. - make doxygen - mkdir .public - cp -r Documentation/Doxygen/html .public/ -- GitLab From 3102805b5095a39f8bb5ff656064f86e9d271b39 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 27 Dec 2018 12:13:57 +0100 Subject: [PATCH 05/12] fixed public dir location --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e6d260a19..5fd94c1f9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,7 @@ pages: - make doxygen - mkdir .public - cp -r Documentation/Doxygen/html .public/ - - mv .public public + - mv .public ../public artifacts: paths: - public -- GitLab From 4a0536e06f1b494fb80940fe7126f625be9b9349 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 27 Dec 2018 13:42:55 +0100 Subject: [PATCH 06/12] update the docs --- COLLABORATION_AGREEMENT.md | 25 +++++++++--------- CONTRIBUTING.md | 54 ++++++++++++++++++++++---------------- 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/COLLABORATION_AGREEMENT.md b/COLLABORATION_AGREEMENT.md index 3c7a93398..d977d84a8 100644 --- a/COLLABORATION_AGREEMENT.md +++ b/COLLABORATION_AGREEMENT.md @@ -16,7 +16,7 @@ community and individuals in a best effort to deliver the best possible computing performance and physics output. The MCnet guidelines developed by [www.montecarlonet.org](www.montecarlonet.org) are copied in [MCNET_GUIDELINES](MCNET_GUIDELINES) -- they provide a very good -additional scope that contributors should read and follow. +additional scope that contributors should read and consider. All possible liability and licensing question are only handled by the adopted @@ -29,9 +29,9 @@ license GPLv3, as copied in full in the file short statement of the copyright and this license. Each binary or source code release of CORSIKA must contain the file LICENSE. The code, documentation and content in the folder [ThirdParty](ThirdParty) -is not integral part of the CORSIKA project and can be based on or -include other licenses, which must be compatible with GPLv3. Check the -content of this folder for details. It depends on the configuration of +is not integral part of the CORSIKA project and can be based on, or +include, other licenses, which must be compatible with GPLv3. Check the +content of this folder for details and additional license information. It depends on the configuration of the build system to what extend this code is used to build CORSIKA. ## Who is the "copyright holder" @@ -65,11 +65,11 @@ If you want to contribute, you need to read improve them. -## Definition and working mode of the CORSIKA Project panel +## The CORSIKA Project panel The CORSIKA Project panel makes all decisions for the CORSIKA Project. It can also change the [COLLABORATION\_AGREEMENT](COLLABORATION\_AGREEMENT.md), the -[the GUIDELINES](CONTRIBUTING.md) or any other structure or document relevant for the CORSIKA Project. +[GUIDELINES](CONTRIBUTING.md) or any other structure or document relevant for the CORSIKA Project. The CORSIKA Project *panel* consists (October 2018) of @@ -77,27 +77,26 @@ The CORSIKA Project *panel* consists (October 2018) of * Dieter Heck (KIT) * Tanguy Pierog (KIT) * Maximilian Reininghaus (KIT) - * Markus Roth (KIT) * Ralf Ulrich (KIT) * Michael Unger (KIT) * Darko Veberic (KIT) and can be contacted via corsika-project@lists.kit.edu. The chair person of the CORSIKA Project is Ralf Ulrich (KIT). Members of the -CORSIKA Project *panel* are *Maintainer* of the CORSIKA Project in +CORSIKA Project *panel* can be *Maintainer* of the CORSIKA Project in gitlab at [https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika](https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika), -and have special responsibilities for this reason. +and have special responsibilities also for this reason. -## Changing to a different license, for parts, or the complete project +### Changing to a different license, for parts, or the complete project -The CORSIKA Project panel can change the license for parts or the entire project. +The CORSIKA Project panel can change the license for parts or the entire project in general or for individual releases. -## Planning and performing releases +### Planning and performing releases The CORSIKA Project panel decides on releases of the software, and about the content of it. -## Changes to the Collaboration Agreement +### Changes to the Collaboration Agreement The CORSIKA Project panel decides on changes to the Collaboration agreement. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 02ad53fbd..4f0401016 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,23 +2,23 @@ The CORSIKA Project very much welcomes contributions. Here we outlined how you can find the right place to contribute, and how to do that. -Connect to http://gitlab.ikp.kit.edu and corsika-devel@lists.kit.edu -or corsika-project@lists.kit.edu to get in touch with the project. -The CORSIKA Project decides on the [GUIDELINES](CONTRIBUTING.md), and can -change them. +Connect to https://gitlab.ikp.kit.edu and corsika-devel@lists.kit.edu (self-register at https://www.lists.kit.edu/sympa/subscribe/corsika-devel) +or write to corsika-project@lists.kit.edu to get in touch with the project. +The CORSIKA Project decides on the [GUIDELINES](CONTRIBUTING.md) and can decide to +change/improve them. # How to contribute - We organize all development via `Issues` that may be feature requests, - ideas, or bugs fix requests. + ideas, discussions, or bugs fix requests. - New issues can be created, or existing issues - picked up. + picked up or contributed to. - Issues are discussed in meetings or via corsika-devel@lists.kit.edu within the CORSIKA Project. - Issues are assigned to milestones. - The work on issues is performed in `branches` that can be best created directly via the gitlab web interface. - Proposed code to close one issue (located in a specific git - branch) is reviewed and eventually discussed, and finally merged + branch) is reviewed, discussed, and eventually merged into the master branch to close the issue. @@ -31,7 +31,9 @@ formatting. We provide a script `do-clang-format.sh`, which can be very useful. But we urge everybody to integrate `clang-format` already on the level of your source code editor. See [the official page](https://clang.llvm.org/docs/ClangFormat.html) for information -about `clang-format` and its editor integration. +about `clang-format` and its editor integration. At least: run +`do-clang-format.sh` prior to any `git add` command. Code with +improper formatting will not be accepted for merging. The definition of source code format is written down in the file [.clang-format](.clang-format) and can be changed, if the CORSIKA @@ -39,6 +41,7 @@ Project agrees on it. To see what is possible, check e.g. [link1](https://clangformat.com/) or [link2](https://zed0.co.uk/clang-format-configurator/). + ## Naming conventions While `clang-format` does the structural formatting, we still need to agree on naming conventions: @@ -47,8 +50,9 @@ While `clang-format` does the structural formatting, we still need to agree on n - Class member variables start with "f" - Any static variable has a "g" prefix. A static member variable starts with "fg" - Class member functions start with capital letters - - Any class getter begins with "Get", and setter with "Set" + - Any class getter begins with "Get", and setter with "Set". Logical getters start with "Is" or "Has". - enums should be "enum class", and start with a capital "E", enum entries start with "e" + - Function parameter names start with "v" - We use namespaces to avoid clashes and to structure code - *Everything* is part of the corsika namespace @@ -62,12 +66,12 @@ While `clang-format` does the structural formatting, we still need to agree on n files. - Each header file uses an include protection that includes at least the namespace name, and header file name, thus, `#ifndef - __include_geometry_Point_h__` or `#ifnedf __geometry_Point_h__`, + __include_geometry_Point_h__` or `#ifndef __geometry_Point_h__`, or similar are acceptable. - Header files should always be included with `<..>`, thus, `#include <corsika/geometry/Point.h>` since the build system will always provide the correct include directives (and files - anyway cannot be found in file-system paths that typically do + anyway cannot be found in file-system paths, which generally do not follow the namespace naming conventions outlined here). @@ -79,7 +83,7 @@ While `clang-format` does the structural formatting, we still need to agree on n ## Coding rules - Code may not introduce any compiler errors, or warnings - - All unit tests must succeed at all times + - All unit tests must succeed at all times. If tests fail, code is not merged. - We use C++17 concepts wherever useful and helpful - On any major error or malfunction we throw an exception. This is needed and required for complex physics and shower debugging. - We never catch exceptions for error handling, there might be very few special exceptions from this. We need to discuss such cases. @@ -90,17 +94,23 @@ While `clang-format` does the structural formatting, we still need to agree on n exposed to outside users, there might be pointers for very special cases inside of classes. - When you contribute new code, or extend existing code, at the same time provide unit-tests for all functionality. + - When you contribute new physics algorithms, in addition you also need to provide a validation module - Code must be documented with `doxygen` commands ## Release versioning scheme -Releases of CORSIKA are thought to be the baseline for larger scale testing, and full production. -The releases are numbered as x.y.z, starting with x=8 form the gitlab c++ version. X will only be incremented -for major design or physics changes. The y index is updated for new official releases that normally contain improved or enhanced physics -performance, and may also contain normal interface changes to accomodate improvements. The z index can be updated frequently for -bug fixes or new features. Changes in z will not contain interface changes, thus, code will remain fully compatible. -Special releases of CORSIKA can also have a tag name from git, e.g. as in the "milestone1" release. +Releases of CORSIKA are thought to be the baseline for larger scale +testing, and full production. The releases are numbered as x.y.z, +starting with x=8 form the gitlab c++ version. X will only be +incremented for major design or physics changes. The y index is +updated for new official releases that normally contain improved or +enhanced physics performance, and may also contain normal interface +changes to accomodate improvements. The z index can be updated more +frequently for bug fixes or new features. Changes in z will not +contain (major) interface changes, thus, production code will remain +fully compatible within changes of z. Special releases of CORSIKA can +also have a tag name from git, e.g. as in the "milestone1" release. # How to become scientific author of the CORSIKA Project @@ -108,10 +118,10 @@ Special releases of CORSIKA can also have a tag name from git, e.g. as in the "m The CORSIKA Project decides on who becomes scientific author. The following conditions are clearly sufficient, but not all of them are required all the time: - - responsibility for a particular functionality or part - - follows these [GUIDELINES](GUIDELINES.md) - - agrees to the [COLLABORATION_AGREEMENT](COLLABORATION_AGREEMENT.md) + - responsibility for a particular functionality or software/management part + - have read and follow these [GUIDELINES](CONTRIBUTING.md) - active in the CORSIKA Project, that means responsive to - discussions and problems in corsika-devel@list.kit.edu or on https//gitlab.ikp.kit.edu, of relevant *issues*, + discussions and problems in corsika-devel@list.kit.edu or on https//gitlab.ikp.kit.edu, of relevant *Issues*, or in (phone) meetings + - agreement to the [COLLABORATION_AGREEMENT](COLLABORATION_AGREEMENT.md) is strictly required - the members of the CORSIKA Project panel agree -- GitLab From e12497d0b568af40b7e3f36a9c71158a590835f3 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 27 Dec 2018 13:50:19 +0100 Subject: [PATCH 07/12] no automatic buld of doxygen, only if requested --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fd94c1f9..877225617 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,7 +35,6 @@ pages: paths: - public only: - - master - tags - triggers - schedules -- GitLab From 7b79e092cc72ef9d08756c731721ef86dd95f6e1 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Thu, 27 Dec 2018 13:56:02 +0100 Subject: [PATCH 08/12] adjust docs --- COLLABORATION_AGREEMENT.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/COLLABORATION_AGREEMENT.md b/COLLABORATION_AGREEMENT.md index d977d84a8..816cbd9ca 100644 --- a/COLLABORATION_AGREEMENT.md +++ b/COLLABORATION_AGREEMENT.md @@ -73,12 +73,13 @@ Project. It can also change the The CORSIKA Project *panel* consists (October 2018) of + * Hans Dembinski (MPG) * Ralph Engel (KIT) * Dieter Heck (KIT) * Tanguy Pierog (KIT) * Maximilian Reininghaus (KIT) + * Felix Riehn (LIP) * Ralf Ulrich (KIT) - * Michael Unger (KIT) * Darko Veberic (KIT) and can be contacted via corsika-project@lists.kit.edu. The chair -- GitLab From 61c96a0808f7c7ba1beeb5db8cf4115acc1a1c25 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Fri, 28 Dec 2018 11:39:02 +0100 Subject: [PATCH 09/12] added central macro for adding and configuring unit tests --- #.gitlab-ci.yml# | 37 ------------------------ .gitlab-ci.yml | 8 ++++- CMakeModules/CorsikaUtilities.cmake | 10 +++++++ Environment/CMakeLists.txt | 4 +-- Framework/Cascade/CMakeLists.txt | 6 +--- Framework/Geometry/CMakeLists.txt | 3 +- Framework/Logging/CMakeLists.txt | 6 +--- Framework/Particles/CMakeLists.txt | 9 +----- Framework/ProcessSequence/CMakeLists.txt | 6 +--- Framework/Random/CMakeLists.txt | 4 +-- Framework/StackInterface/CMakeLists.txt | 2 +- Framework/Units/CMakeLists.txt | 3 +- Framework/Utilities/CMakeLists.txt | 3 +- Processes/NullModel/CMakeLists.txt | 4 +-- Processes/Sibyll/CMakeLists.txt | 4 +-- Processes/StackInspector/CMakeLists.txt | 4 +-- Processes/TrackWriter/CMakeLists.txt | 3 +- Processes/TrackingLine/CMakeLists.txt | 3 +- Stack/SuperStupidStack/CMakeLists.txt | 6 +--- 19 files changed, 33 insertions(+), 92 deletions(-) delete mode 100644 #.gitlab-ci.yml# diff --git a/#.gitlab-ci.yml# b/#.gitlab-ci.yml# deleted file mode 100644 index fb8f6a95b..000000000 --- a/#.gitlab-ci.yml# +++ /dev/null @@ -1,37 +0,0 @@ -image: ubuntu:bionic - -variables: - GIT_SSL_NO_VERIFY: "1" - -before_script: - - apt-get update --yes - - apt-get install --yes cmake libboost-dev libeigen3-dev python3 gfortran - -build: - stage: build - tags: - - run1 - script: - - mkdir build - - cd build - - cmake .. - - cmake --build . - - ctest -V - -# code_quality: -# image: docker:stable -# variables: -# DOCKER_DRIVER: overlay2 -# allow_failure: true -# services: -# - docker:stable-dind -# script: -# - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') -# - docker run -# --env SOURCE_CODE="$PWD" -# --volume "$PWD":/code -# --volume /var/run/docker.sock:/var/run/docker.sock -# "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code -# artifacts: -# reports: -# codequality: gl-code-quality-report.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7d470049a..5cf0a7816 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,13 @@ build: paths: - build/test.log.gz when: on_failure - + reports: + junit: + - */junit*.xml + - */*/junit*.xml + - */*/*/junit*.xml + - */*/*/*/junit*.xml + - */*/*/*/*/junit*.xml # code_quality: # image: docker:stable diff --git a/CMakeModules/CorsikaUtilities.cmake b/CMakeModules/CorsikaUtilities.cmake index 0ba70d8ff..abcebea9f 100644 --- a/CMakeModules/CorsikaUtilities.cmake +++ b/CMakeModules/CorsikaUtilities.cmake @@ -78,3 +78,13 @@ macro (CORSIKA_ADD_FILES_ABSOLUTE varname) set ("${varname}" "${${varname}}" PARENT_SCOPE) endif() endmacro(CORSIKA_ADD_FILES_ABSOLUTE) + + + +# +# central macro to activate unit tests in cmake +# + +function (CORSIKA_ADD_TEST name) + add_test (NAME ${name} COMMAND ${name} -o junit-${name}.xml -r junit) +endfunction (CORSIKA_ADD_TEST) diff --git a/Environment/CMakeLists.txt b/Environment/CMakeLists.txt index ca93c81cd..c4083f6f3 100644 --- a/Environment/CMakeLists.txt +++ b/Environment/CMakeLists.txt @@ -48,6 +48,4 @@ target_link_libraries ( CORSIKAenvironment CORSIKAthirdparty # for catch2 ) - -add_test (NAME testGeometry COMMAND testGeometry) - +CORSIKA_ADD_TEST(testGeometry) diff --git a/Framework/Cascade/CMakeLists.txt b/Framework/Cascade/CMakeLists.txt index 8b832d21b..3e51de618 100644 --- a/Framework/Cascade/CMakeLists.txt +++ b/Framework/Cascade/CMakeLists.txt @@ -59,8 +59,4 @@ target_link_libraries ( CORSIKAunits CORSIKAthirdparty # for catch2 ) - -add_test ( - NAME testCascade - COMMAND testCascade - ) +CORSIKA_ADD_TEST(testStackInterface) diff --git a/Framework/Geometry/CMakeLists.txt b/Framework/Geometry/CMakeLists.txt index 3e2a8e1d4..4d708ff10 100644 --- a/Framework/Geometry/CMakeLists.txt +++ b/Framework/Geometry/CMakeLists.txt @@ -69,5 +69,4 @@ target_link_libraries ( CORSIKAthirdparty # for catch2 ) -add_test (NAME testGeometry COMMAND testGeometry) - +CORSIKA_ADD_TEST(testGeometry) diff --git a/Framework/Logging/CMakeLists.txt b/Framework/Logging/CMakeLists.txt index d7af35a8f..f8b150353 100644 --- a/Framework/Logging/CMakeLists.txt +++ b/Framework/Logging/CMakeLists.txt @@ -47,9 +47,5 @@ target_link_libraries ( CORSIKAlogging CORSIKAthirdparty # for catch2 ) - -add_test ( - NAME testLogging - COMMAND testLogging - ) +CORSIKA_ADD_TEST (testLogging) diff --git a/Framework/Particles/CMakeLists.txt b/Framework/Particles/CMakeLists.txt index 3301139d5..7798d2226 100644 --- a/Framework/Particles/CMakeLists.txt +++ b/Framework/Particles/CMakeLists.txt @@ -92,11 +92,4 @@ target_link_libraries ( CORSIKAunits CORSIKAthirdparty # for catch2 ) - -add_test ( - NAME - testParticles - COMMAND - testParticles - ) - +CORSIKA_ADD_TEST(testParticles) diff --git a/Framework/ProcessSequence/CMakeLists.txt b/Framework/ProcessSequence/CMakeLists.txt index 6c3e5ff8c..d45d28d6c 100644 --- a/Framework/ProcessSequence/CMakeLists.txt +++ b/Framework/ProcessSequence/CMakeLists.txt @@ -48,8 +48,4 @@ target_link_libraries ( CORSIKAprocesssequence CORSIKAthirdparty # for catch2 ) - -add_test ( - NAME testProcessSequence - COMMAND testProcessSequence - ) +CORSIKA_ADD_TEST(testProcessSequence) diff --git a/Framework/Random/CMakeLists.txt b/Framework/Random/CMakeLists.txt index 230f84f67..3607b585a 100644 --- a/Framework/Random/CMakeLists.txt +++ b/Framework/Random/CMakeLists.txt @@ -45,6 +45,4 @@ target_link_libraries ( CORSIKArandom CORSIKAthirdparty # for catch2 ) - -add_test (NAME testRandom COMMAND testRandom) - +CORSIKA_ADD_TEST(testRandom) diff --git a/Framework/StackInterface/CMakeLists.txt b/Framework/StackInterface/CMakeLists.txt index 42c52ceab..c6106121b 100644 --- a/Framework/StackInterface/CMakeLists.txt +++ b/Framework/StackInterface/CMakeLists.txt @@ -33,5 +33,5 @@ install ( #code testing add_executable (testStackInterface testStackInterface.cc) -add_test(NAME testStackInterface COMMAND testStackInterface) target_link_libraries (testStackInterface CORSIKAstackinterface CORSIKAthirdparty) # for catch2 +CORSIKA_ADD_TEST(testStackInterface) diff --git a/Framework/Units/CMakeLists.txt b/Framework/Units/CMakeLists.txt index 7948859e2..639c5cbd8 100644 --- a/Framework/Units/CMakeLists.txt +++ b/Framework/Units/CMakeLists.txt @@ -22,5 +22,4 @@ install (FILES ${CORSIKAunits_HEADERS} DESTINATION include/${CORSIKAunits_NAMESP # code testing add_executable (testUnits testUnits.cc) target_link_libraries (testUnits CORSIKAunits CORSIKAthirdparty) # for catch2 -add_test(NAME testUnits COMMAND testUnits) - +CORSIKA_ADD_TEST(testUnits) diff --git a/Framework/Utilities/CMakeLists.txt b/Framework/Utilities/CMakeLists.txt index 5ba7827be..5b21e9270 100644 --- a/Framework/Utilities/CMakeLists.txt +++ b/Framework/Utilities/CMakeLists.txt @@ -58,6 +58,5 @@ target_link_libraries ( CORSIKAutilities CORSIKAthirdparty # for catch2 ) - -add_test (NAME testCOMBoost COMMAND testCOMBoost) +CORSIKA_ADD_TEST(testCOMBoost) diff --git a/Processes/NullModel/CMakeLists.txt b/Processes/NullModel/CMakeLists.txt index 300e3b571..c3355c77c 100644 --- a/Processes/NullModel/CMakeLists.txt +++ b/Processes/NullModel/CMakeLists.txt @@ -60,6 +60,4 @@ target_link_libraries ( CORSIKAunits CORSIKAthirdparty # for catch2 ) - -add_test (NAME testNullModel COMMAND testNullModel) - +CORSIKA_ADD_TEST(testNullModel) diff --git a/Processes/Sibyll/CMakeLists.txt b/Processes/Sibyll/CMakeLists.txt index 9224d9fe5..ee28a30b2 100644 --- a/Processes/Sibyll/CMakeLists.txt +++ b/Processes/Sibyll/CMakeLists.txt @@ -101,6 +101,4 @@ target_link_libraries ( CORSIKAunits CORSIKAthirdparty # for catch2 ) - -add_test (NAME testSibyll COMMAND testSibyll) - +CORSIKA_ADD_TEST(testSibyll) diff --git a/Processes/StackInspector/CMakeLists.txt b/Processes/StackInspector/CMakeLists.txt index f87cc1374..9711c4227 100644 --- a/Processes/StackInspector/CMakeLists.txt +++ b/Processes/StackInspector/CMakeLists.txt @@ -60,6 +60,4 @@ target_link_libraries ( CORSIKAunits CORSIKAthirdparty # for catch2 ) - -add_test (NAME testStackInspector COMMAND testStackInspector) - +CORSIKA_ADD_TEST(testStackInspector) diff --git a/Processes/TrackWriter/CMakeLists.txt b/Processes/TrackWriter/CMakeLists.txt index e9c73d68b..67b99083f 100644 --- a/Processes/TrackWriter/CMakeLists.txt +++ b/Processes/TrackWriter/CMakeLists.txt @@ -60,6 +60,5 @@ install ( # CORSIKAunits # CORSIKAthirdparty # for catch2 # ) - -#add_test (NAME testNullModel COMMAND testNullModel) +# CORSIKA_ADD_TEST(testNullModel) diff --git a/Processes/TrackingLine/CMakeLists.txt b/Processes/TrackingLine/CMakeLists.txt index b68564bfa..ce19ed677 100644 --- a/Processes/TrackingLine/CMakeLists.txt +++ b/Processes/TrackingLine/CMakeLists.txt @@ -37,5 +37,4 @@ target_link_libraries ( CORSIKAgeometry CORSIKAthirdparty # for catch2 ) - -add_test (NAME testTrackingLine COMMAND testTrackingLine) +CORSIKA_ADD_TEST(testTrackingLine) diff --git a/Stack/SuperStupidStack/CMakeLists.txt b/Stack/SuperStupidStack/CMakeLists.txt index b9634f1d1..de96527d4 100644 --- a/Stack/SuperStupidStack/CMakeLists.txt +++ b/Stack/SuperStupidStack/CMakeLists.txt @@ -44,8 +44,4 @@ target_link_libraries ( CORSIKAunits CORSIKAthirdparty # for catch2 ) - -add_test ( - NAME testSuperStupidStack - COMMAND testSuperStupidStack - ) +CORSIKA_ADD_TEST(testSuperStupidStack) -- GitLab From 505046c97b0abcd63ca2c087ab43ea1854a3a5d1 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Fri, 28 Dec 2018 12:23:01 +0100 Subject: [PATCH 10/12] copy all test outputs into one directory --- .gitlab-ci.yml | 8 ++------ CMakeModules/CorsikaUtilities.cmake | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5cf0a7816..ab91b4a9c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ build: - cd build - cmake .. - cmake --build . - - ctest -V >& test.log + - ctest -j4 -V >& test.log - gzip -9 test.log artifacts: paths: @@ -24,11 +24,7 @@ build: when: on_failure reports: junit: - - */junit*.xml - - */*/junit*.xml - - */*/*/junit*.xml - - */*/*/*/junit*.xml - - */*/*/*/*/junit*.xml + - build/test_outputs/junit*.xml # code_quality: # image: docker:stable diff --git a/CMakeModules/CorsikaUtilities.cmake b/CMakeModules/CorsikaUtilities.cmake index abcebea9f..c2a7df5c9 100644 --- a/CMakeModules/CorsikaUtilities.cmake +++ b/CMakeModules/CorsikaUtilities.cmake @@ -86,5 +86,6 @@ endmacro(CORSIKA_ADD_FILES_ABSOLUTE) # function (CORSIKA_ADD_TEST name) - add_test (NAME ${name} COMMAND ${name} -o junit-${name}.xml -r junit) + file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test_outputs/) + add_test (NAME ${name} COMMAND ${name} -o ${PROJECT_BINARY_DIR}/test_outputs/junit-${name}.xml -r junit) endfunction (CORSIKA_ADD_TEST) -- GitLab From fddb3bccf5d3c65fca9c12e4b69110787ff33c0b Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Fri, 28 Dec 2018 12:32:39 +0100 Subject: [PATCH 11/12] store artefacts always --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ab91b4a9c..91a8e7c14 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ build: artifacts: paths: - build/test.log.gz - when: on_failure + when: always reports: junit: - build/test_outputs/junit*.xml -- GitLab From 42f023f38f8aeb6dc368781a9da520832493fefd Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Fri, 28 Dec 2018 13:07:21 +0100 Subject: [PATCH 12/12] include ALL unit tests --- .gitlab-ci.yml | 2 +- Documentation/Examples/CMakeLists.txt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 954615776..099368206 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,7 @@ build: artifacts: paths: - build/test.log.gz - when: always + when: on_failure reports: junit: - build/test_outputs/junit*.xml diff --git a/Documentation/Examples/CMakeLists.txt b/Documentation/Examples/CMakeLists.txt index 47a7a495c..00de097e7 100644 --- a/Documentation/Examples/CMakeLists.txt +++ b/Documentation/Examples/CMakeLists.txt @@ -2,24 +2,24 @@ add_executable (helix_example helix_example.cc) target_compile_options(helix_example PRIVATE -g) # do not skip asserts target_link_libraries(helix_example CORSIKAgeometry CORSIKAunits) install (TARGETS helix_example DESTINATION share/examples) -add_test(helix_example helix_example) +CORSIKA_ADD_TEST (helix_example) add_executable (geometry_example geometry_example.cc) target_compile_options(geometry_example PRIVATE -g) # do not skip asserts target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits) install (TARGETS geometry_example DESTINATION share/examples) -add_test(geometry_example geometry_example) +CORSIKA_ADD_TEST (geometry_example) add_executable (logger_example logger_example.cc) target_compile_options(logger_example PRIVATE -g) # do not skip asserts target_link_libraries (logger_example CORSIKAunits CORSIKAlogging) install (TARGETS logger_example DESTINATION share/examples) -add_test(logger_example logger_example) +CORSIKA_ADD_TEST (logger_example) add_executable (stack_example stack_example.cc) target_compile_options(stack_example PRIVATE -g) # do not skip asserts target_link_libraries (stack_example SuperStupidStack CORSIKAunits CORSIKAlogging) -add_test(stack_example stack_example) +CORSIKA_ADD_TEST (stack_example) add_executable (cascade_example cascade_example.cc) target_compile_options(cascade_example PRIVATE -g) # do not skip asserts @@ -36,7 +36,7 @@ target_link_libraries (cascade_example SuperStupidStack CORSIKAunits CORSIKAlogg CORSIKAprocesssequence ) install (TARGETS cascade_example DESTINATION share/examples) -add_test(cascade_example cascade_example) +CORSIKA_ADD_TEST (cascade_example) add_executable (staticsequence_example staticsequence_example.cc) target_compile_options(staticsequence_example PRIVATE -g) # do not skip asserts @@ -46,4 +46,4 @@ target_link_libraries (staticsequence_example CORSIKAgeometry CORSIKAlogging) install (TARGETS staticsequence_example DESTINATION share/examples) -add_test(staticsequence_example staticsequence_example) +CORSIKA_ADD_TEST (staticsequence_example) -- GitLab