Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.08 KiB
Newer Older
  • Learn to ignore specific revisions
  • # NOTE #1: Our GitLab CI runs jobs inside Alpine Linux container by default.
    #
    # NOTE #2: Keep in mind that each job (e.g. test-gcc) is executed in a separate
    # isolated environment (it may be even on different machine). There are no
    # files implicitly passed between jobs or stages, only artifacts and maybe
    # cache (depends on configuration).
    
    
    image: alpine:3.8
    
    stages:
     - build
     - test
    
    
    #==========  Stage build  ==========
    
    
    .build: &build_template
      stage: build
      before_script:
        - apk add --no-cache bash build-base cmake python3 libexecinfo-dev cppunit-dev libxml2-dev tclap-dev readline-dev qt5-qtbase-dev graphviz-dev jsoncpp-dev ${EXTRA_PKGS}
    
        - export CXX=${CXX}
        - CMake/generate.py -wm
    
        - mkdir release
        - cd release
        - cmake -DCMAKE_BUILD_TYPE=Release ..
    
        - make -j $(grep -c processor /proc/cpuinfo)
    
      artifacts:
        paths:
    
        expire_in: 1 day
    
    build:gcc:
      <<: *build_template
      variables:
        CXX: g++
    
    build:clang:
      <<: *build_template
    
      variables:
    
        CXX: clang++
        EXTRA_PKGS: clang
    
    build:doc:
      stage: build
      before_script:
        - apk add --no-cache doxygen graphviz
    
      script:
    
        - doxygen
    
      allow_failure: true
      artifacts:
        name: docs
        paths:
    
        expire_in: 1 day
    
    
    
    #==========  Stage test  ==========
    
    
    .test: &test_template
      stage: test
      before_script:
        - apk add --no-cache bash bc coreutils python3 cmake make libexecinfo cppunit libxml2 tclap readline qt5-qtbase qt5-qtbase-x11 graphviz jsoncpp
    
        - make test
          # temporary until make tests manages all tests
        - mkdir bin
        - cd bin
        - find .. -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \) -exec test -x {} \; -print | grep -v 'CMakeFiles' | while read line; do ln -s $line $(basename $line); done
        - cd ../..
        - for test in $(ls tests.*.sh); do ./${test} release/bin $(grep -c processor /proc/cpuinfo) || exit 1; touch release/bin/log_tests.txt; cat release/bin/log_tests.txt; done
    
    test:gcc:
      <<: *test_template
    
      dependencies:
    
        - build:gcc
    
    test:clang:
      <<: *test_template
    
      dependencies:
    
        - build:clang