gitlab-ci.yml 2.59 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
# https://rainboard.laas.fr/project/{{ project.slug }}/.gitlab-ci.yml
2

3
{% if project.ccache %}variables:
Guilhem Saurel's avatar
typo    
Guilhem Saurel committed
4
  CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
5
6
7

cache:
  paths:
8
    - ccache
9
{% endif %}
10

Guilhem Saurel's avatar
Guilhem Saurel committed
11
{% for robotpkg in project.ordered_robotpkg %}.robotpkg-{{ robotpkg }}: &robotpkg-{{ robotpkg }}
Guilhem Saurel's avatar
Guilhem Saurel committed
12
  retry:
Guilhem Saurel's avatar
Guilhem Saurel committed
13
14
    max: 2
    when: runner_system_failure
15
16
  except:
    - gh-pages
17
  script:
18
{% if project.ccache %}    - mkdir -p ccache
Guilhem Saurel's avatar
20.04    
Guilhem Saurel committed
19
    - echo "CCACHE_DIR=${CI_PROJECT_DIR}/ccache" >> /opt/openrobots/etc/robotpkg.conf
20
{% endif %}
21
    - cd /root/robotpkg/{{ robotpkg.category }}
22
    - git pull
23
{% if robotpkg.without_py %}    - cd {{ robotpkg.without_py }}
Guilhem Saurel's avatar
Guilhem Saurel committed
24
    - make checkout MASTER_REPOSITORY="git ${CI_PROJECT_DIR}/.git"
25
26
    - cd ..
{% endif %}    - cd {{ robotpkg }}
Guilhem Saurel's avatar
Guilhem Saurel committed
27
    - make checkout MASTER_REPOSITORY="git ${CI_PROJECT_DIR}/.git"
28
    - make install
Guilhem Saurel's avatar
Guilhem Saurel committed
29
    - build=$(make show-var VARNAME=CONFIGURE_DIRS); cd $(make show-var VARNAME=WRKSRC); cd $build
30
{% if project.tests %}    - make test
Guilhem Saurel's avatar
Guilhem Saurel committed
31
{% endif %}
32
{% for image in robotpkg.valid_images %}{{ image.get_job_name }}:
Guilhem Saurel's avatar
Guilhem Saurel committed
33
  <<: *robotpkg-{{ robotpkg }}
Guilhem Saurel's avatar
Guilhem Saurel committed
34
  image: {{ image.get_image_name }}
Guilhem Saurel's avatar
Guilhem Saurel committed
35
36
{% if image.allow_failure %}  allow_failure: true
{% endif %}{% if image.debug %}  before_script:
37
    - echo PKG_OPTIONS.{{ robotpkg }}=debug >> /opt/openrobots/etc/robotpkg.conf
Guilhem Saurel's avatar
Guilhem Saurel committed
38
39
40
41
42
43
44
45
{% endif %}
{% endfor %}{% endfor %}{% if project.tests or project.docs %}doc-coverage:
{% with image=project.doc_coverage_image %}  <<: *robotpkg-{{ image.robotpkg }}
  image: {{ image.get_image_name }}
  before_script:
    - echo -e 'CXXFLAGS+= --coverage\nLDFLAGS+= --coverage\nPKG_DEFAULT_OPTIONS= debug' >> /opt/openrobots/etc/robotpkg.conf
  after_script:
    - cd /root/robotpkg/{{ image.robotpkg.category }}/{{ image.robotpkg }}{% endwith %}
Guilhem Saurel's avatar
Guilhem Saurel committed
46
    - build=$(make show-var VARNAME=CONFIGURE_DIRS); cd $(make show-var VARNAME=WRKSRC); cd $build
Guilhem Saurel's avatar
Guilhem Saurel committed
47
48
49
{% if project.docs %}    - make doc
    - mv doc/doxygen-html ${CI_PROJECT_DIR}
{% endif %}{% if project.tests%}    - mkdir -p ${CI_PROJECT_DIR}/coverage/
Guilhem Saurel's avatar
Guilhem Saurel committed
50
51
    - gcovr -e CMakeFiles -r .
    - gcovr -e CMakeFiles -r . --html --html-details -o ${CI_PROJECT_DIR}/coverage/index.html
Guilhem Saurel's avatar
Guilhem Saurel committed
52
{% endif %}  artifacts:
53
54
    expire_in: 1 day
    paths:
Guilhem Saurel's avatar
Guilhem Saurel committed
55
      - doxygen-html/
Guilhem Saurel's avatar
Guilhem Saurel committed
56
      - coverage/
Guilhem Saurel's avatar
Guilhem Saurel committed
57
58
{% endif %}
format:
Guilhem Saurel's avatar
Guilhem Saurel committed
59
{% if project.allow_format_failure %}  allow_failure: true
Guilhem Saurel's avatar
Guilhem Saurel committed
60
{% endif %}  image: gepetto/linters
Guilhem Saurel's avatar
Guilhem Saurel committed
61
62
63
  retry:
    max: 2
    when: runner_system_failure
Guilhem Saurel's avatar
Guilhem Saurel committed
64
65
66
  before_script:
    - test -f /builds/setup.cfg || ln -s /root/setup.cfg /builds
    - test -f /builds/.clang-format || ln -s /root/.clang-format /builds
Guilhem Saurel's avatar
Guilhem Saurel committed
67
68
  script:
    - check-clang-format.sh
Guilhem Saurel's avatar
Guilhem Saurel committed
69
    {% if project.has_python %}- flake8 .
Guilhem Saurel's avatar
yapf .    
Guilhem Saurel committed
70
    - yapf -dr .
Guilhem Saurel's avatar
Guilhem Saurel committed
71
{% endif %}