Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.32 KiB
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

stages:
  - build
  - 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:
  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

tests:
  stage: test
  coverage: '/^TOTAL.*\s+(\d+\%)$/'
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  script:
    - cmake .
    - make tests -j4
    - ./tests --use-colour yes  # Run the tests
  after_script:
    - ./tests -r junit -o junit.xml
  artifacts:
    expire_in: 1 week
    reports:
      junit: junit.xml

cppcheck:
  stage: build
  before_script:
    - cppcheck --version
  script:
    - ci/cppcheck.sh

cppcheck-misra:
  stage: build
  before_script:
    - cppcheck --version
  script:
    - ci/cppcheck-misra.sh

vera:
  stage: build
  before_script: