diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a23f059268899791574cc8ae43f573e7d129fbe..7c7becceea2926b617fdd2632e9fa20ce5d4cae4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,92 +1,131 @@ -image: lightspot21/acubesat-ci:latest - variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - -# Global caching directive for pip -cache: - key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" - paths: - - .cache/pip + GIT_SUBMODULE_STRATEGY: recursive stages: - build + - analyze - test - deploy -before_script: - - apt-get update -qq && apt-get -qq -y install libstdc++6 python3-pip && python3 -m pip install --upgrade pip - - python3 -V - - python3 -m pip --version - - g++ --version - - cat /etc/*-release - - python3 -m pip install gcovr -build: +check-build: + image: spacedot/build-base # TODO: push build-base stage: build variables: - GIT_SUBMODULE_STRATEGY: normal GCC_COLORS: "error=31;1:warning=35;1:note=36;1:range1=32:range2=34:locus=39;1:quote=39;1:fixit-insert=32:fixit-delete=31:diff-filename=39;1:diff-hunk=32:diff-delete=31:diff-insert=32:type-diff=32;1" CLICOLOR_FORCE: 1 # Necessary for cmake to output colours script: - - cmake . -DCMAKE_CXX_FLAGS="-Werror -fdiagnostics-color=always" - - make -j4 - - make clean - - cmake . -DCMAKE_CXX_FLAGS="-Wall -Wextra -fdiagnostics-color=always" # Build again, but with more warnings - - make -j4 + - cmake . -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -fdiagnostics-color=always" + - make -j$(nproc) -tests: - stage: test - coverage: '/^TOTAL.*\s+(\d+\%)$/' - variables: - GIT_SUBMODULE_STRATEGY: normal +cppcheck: + image: spacedot/cppcheck:2.5 + stage: analyze + before_script: + - cppcheck --version + allow_failure: true script: - - cmake . - - make tests -j4 - - ./tests --use-colour yes # Run the tests + - cd $CI_PROJECT_DIR + - cppcheck --enable=all --addon=misra --suppress=misra-c2012-3.1 --suppress=misra-c2012-5.1 --suppress=misra-c2012-5.2 \ + --suppress=misra-c2012-5.3 --suppress=misra-c2012-12.3 --suppress=misra-c2012-13.4 --suppress=misra-c2012-14.4 \ + --suppress=misra-c2012-15.5 --suppress=misra-c2012-16.3 --suppress=misra-c2012-18.4 --suppress=misra-c2012-18.8 \ + --suppress=unusedFunction --suppress=noExplicitConstructor --force --inline-suppr --error-exitcode=1 \ + --xml --xml-version=2 2>report.xml -I ./inc ./src after_script: - - ./tests -r junit -o junit.xml + - mkdir cppcheck-html-report + - cppcheck-htmlreport --source-dir=. --title=html-report --file=report.xml --report-dir=cppcheck-html-report artifacts: - expire_in: 1 week - reports: - junit: junit.xml + when: on_failure + paths: + - ./cppcheck-html-report -cppcheck: - stage: build - before_script: - - cppcheck --version +clang-tidy: + image: spacedot/clang-tools:13.0.0-html-1.3.7 + stage: analyze script: - - ci/cppcheck.sh + - cd $CI_PROJECT_DIR + - cmake -B ./build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - clang-tidy -p $CI_PROJECT_DIR/build/compile_commands.json --checks=* `find $CI_PROJECT_DIR/src -type f -regextype posix-egrep -regex '.*\.(cpp|hpp|c|h)'` >> clang-tidy-output.log + after_script: + - mkdir clang-tidy-html-report + - clang-tidy-html clang-tidy-output.log + - mv clang.html clang-tidy-html-report + artifacts: + paths: + - ./clang-tidy-html-report -cppcheck-misra: - stage: build +clang-analyzer: + image: spacedot/clang-tools:13.0.0-html-1.3.7 + stage: analyze before_script: - - cppcheck --version + - mkdir scan-build-html-report script: - - ci/cppcheck-misra.sh + - cd $CI_PROJECT_DIR + - scan-build cmake ./ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + - scan-build -o ./scan-build-html-report make + artifacts: + paths: + - ./scan-build-html-report -clang-tidy: - stage: build - variables: - GIT_SUBMODULE_STRATEGY: normal - TERM: xterm-color +doxygen: + image: spacedot/doxygen:1.9.2-awesomecss-1.6.0 + stage: analyze script: - - ci/clang-tidy.sh + - cd $CI_PROJECT_DIR + - doxygen doxygen.conf + artifacts: + paths: + - ./docs +ikos: + image: spacedot/ikos:3.0 + stage: analyze + before_script: + - mkdir ikos-report + script: + - cd $CI_PROJECT_DIR + - ikos-scan cmake . + - ikos-scan make + - ikos tests.bc + - ikos ecss_services.bc + - ikos-report -o=ikos-report.txt output.db + after_script: + - mv ikos-report.txt ikos-report + - mv output.db ikos-report + artifacts: + paths: + - ./ikos-report +tests: + image: spacedot/coverage:gcovr-5.0-lcov-1.15 + stage: test + when: always + before_script: + - mkdir gcovr + script: + - cd $CI_PROJECT_DIR + - cmake . -DCMAKE_CXX_FLAGS="-g -O0 --coverage" && make tests -j$(nproc) + - lcov -q --capture --initial --directory . -o coverage_base + - ./tests --use-colour yes + - lcov -q --capture --directory . -o coverage_tests + - lcov -q -a coverage_base -a coverage_tests -o coverage_total_unfiltered + - lcov -q --remove coverage_total_unfiltered "${PWD}/lib/*" "${PWD}/CMakeFiles/*" "${PWD}/test/*" "${PWD}/src/main.cpp" -o coverage_total_filtered + - gcovr -s -p -e "^.*(test|lib|main.cpp|CMakeFiles)" --html --html-details --html-title "Code coverage ${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}" -o ./gcovr/gcovr.html + - gcovr -e "^.*(test|lib|main.cpp|CMakeFiles)" + - genhtml --demangle-cpp -t "${CI_COMMIT_REF_NAME}" --html-epilog ci/page_style/epilog.html -o ./gcovr coverage_total_filtered + artifacts: + paths: + - ./gcovr pages: + image: spacedot/build-base:latest # TODO: Latest tag is temporary stage: deploy - when: always # Deploy always and on build or test failure, generate just the documentation - cache: - key: "$CI_JOB_NAME" - paths: - - public - variables: - GIT_SUBMODULE_STRATEGY: normal script: - - ./ci/pages_deploy.sh - - echo -e "\e[1;36mPublic directory contents\e[0m" && ls -l public/coverage # Print directory contents for debugging + - mkdir .public + - cp -r ./{docs,gcovr,ikos-report,scan-build-html-report,clang-tidy-html-report,cppcheck-html-report} ./.public/ + - ls ./.public + - find ./.public + - mv .public public artifacts: paths: - public # Upload the resulting website - only: - - branches # Deploy on all branches + # only: + # - branches # Deploy on all branches diff --git a/.idea/vcs.xml b/.idea/vcs.xml index b361e80b9ac2795e185ae4f8a0ebeac8becdd851..1e90c110e510f6fd972552052bac8106286a736d 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -3,6 +3,7 @@ <component name="VcsDirectoryMappings"> <mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$/ci/page_style/doxygen_dark_theme" vcs="Git" /> + <mapping directory="$PROJECT_DIR$/doxygen-awesome-css" vcs="Git" /> <mapping directory="$PROJECT_DIR$/lib/Catch2" vcs="Git" /> <mapping directory="$PROJECT_DIR$/lib/etl" vcs="Git" /> </component> diff --git a/doxygen.conf b/doxygen.conf index 2b765f310f7005b5624da8f82b60ba04dfe258c6..a723c79ce42474d250494a18605c120eefa4f235 100644 --- a/doxygen.conf +++ b/doxygen.conf @@ -1157,7 +1157,7 @@ HTML_FILE_EXTENSION = .html # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_HEADER = "ci/page_style/doxygen_dark_theme/html_header.html" +#HTML_HEADER = "ci/page_style/doxygen_dark_theme/html_header.html" # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard @@ -1167,7 +1167,7 @@ HTML_HEADER = "ci/page_style/doxygen_dark_theme/html_header.html" # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_FOOTER = "ci/page_style/doxygen_dark_theme/html_footer.html" +#HTML_FOOTER = "ci/page_style/doxygen_dark_theme/html_footer.html" # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of @@ -1192,8 +1192,7 @@ HTML_STYLESHEET = # list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_STYLESHEET = "ci/page_style/doxygen_dark_theme/custom.css" \ - "ci/page_style/doxygen_dark_theme/custom_dark_theme.css" +HTML_EXTRA_STYLESHEET = "/root/doxygen-awesome-css/doxygen-awesome.css" # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note