Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.18 KiB
Newer Older
  • Learn to ignore specific revisions
  • Grigoris Pavlakis's avatar
    Grigoris Pavlakis committed
    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
    
    
    kongr45gpen's avatar
    kongr45gpen committed
    stages:
      - build
      - test
    
    kongr45gpen's avatar
    kongr45gpen committed
    
    
    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
    
    
    kongr45gpen's avatar
    kongr45gpen committed
      stage: build
    
        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
    
    kongr45gpen's avatar
    kongr45gpen committed
      script:
    
        - cmake . -DCMAKE_CXX_FLAGS="-Werror -fdiagnostics-color=always"
        - make -j4
        - make clean
    
    Grigoris Pavlakis's avatar
    Grigoris Pavlakis committed
        - cmake . -DCMAKE_CXX_FLAGS="-Wall -Wextra -fdiagnostics-color=always" # Build again, but with more warnings
    
    kongr45gpen's avatar
    kongr45gpen committed
        - make -j4
    
    
    kongr45gpen's avatar
    kongr45gpen committed
      stage: test
    
      coverage: '/^TOTAL.*\s+(\d+\%)$/'
    
      variables:
        GIT_SUBMODULE_STRATEGY: normal
    
    kongr45gpen's avatar
    kongr45gpen committed
      script:
        - cmake .
    
        - ./tests --use-colour yes  # Run the tests
    
    kongr45gpen's avatar
    kongr45gpen committed
      after_script:
    
        - ./tests -r junit -o junit.xml
    
    kongr45gpen's avatar
    kongr45gpen committed
      artifacts:
    
    kongr45gpen's avatar
    kongr45gpen committed
        reports:
          junit: junit.xml
    
    kongr45gpen's avatar
    kongr45gpen committed
    
    
    kongr45gpen's avatar
    kongr45gpen committed
    cppcheck:
    
    kongr45gpen's avatar
    kongr45gpen committed
      stage: build
    
      before_script:
        - cppcheck --version
    
    kongr45gpen's avatar
    kongr45gpen committed
      script:
    
    kongr45gpen's avatar
    kongr45gpen committed
        - ci/cppcheck.sh
    
    cppcheck-misra:
      stage: build
      before_script:
        - cppcheck --version
      script:
        - ci/cppcheck-misra.sh
    
    
    clang-tidy:
      stage: build
      variables:
        GIT_SUBMODULE_STRATEGY: normal
        TERM: xterm-color
      script:
    
    kongr45gpen's avatar
    kongr45gpen committed
        - ci/clang-tidy.sh
    
    
    pages:
      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
    
    Grigoris Pavlakis's avatar
    Grigoris Pavlakis committed
      script:
    
        - ./ci/pages_deploy.sh
        - echo -e "\e[1;36mPublic directory contents\e[0m" && ls -l public/coverage  # Print directory contents for debugging
      artifacts:
        paths:
          - public # Upload the resulting website
      only:
        - branches # Deploy on all branches