.gitlab-ci.yml 5.63 KB
Newer Older
Millian Poquet's avatar
Millian Poquet committed
1
image: oarteam/batsim_ci
2

3
variables:
Millian Poquet's avatar
Millian Poquet committed
4
  GIT_SUBMODULE_STRATEGY: none
5

6
7
8
################################################################################
# Build stage
###############################################################################
9
10
11
12
13
build_clang:
  stage: build
  script:
    - export CC=/usr/bin/clang
    - export CXX=/usr/bin/clang++
14
15
    - rm -rf /builds/batsim/batsim/build
    - mkdir  /builds/batsim/batsim/build
16
17
18
19
20
21
    - cd /builds/batsim/batsim/build
    - cmake .. -DCMAKE_BUILD_TYPE=Debug -Dtreat_warnings_as_errors=ON
    - make
  artifacts:
    paths:
      - /builds/batsim/batsim/build
Millian Poquet's avatar
Millian Poquet committed
22
23

build_gcc:
Michael Mercier's avatar
Michael Mercier committed
24
25
  stage: build
  script:
Millian Poquet's avatar
Millian Poquet committed
26
27
    - export CC=/usr/bin/gcc
    - export CXX=/usr/bin/g++
28
29
    - rm -rf /builds/batsim/batsim/build
    - mkdir  /builds/batsim/batsim/build
Millian Poquet's avatar
Millian Poquet committed
30
    - cd /builds/batsim/batsim/build
31
    - cmake .. -DCMAKE_BUILD_TYPE=Debug -Dtreat_warnings_as_errors=ON
32
    - make
Michael Mercier's avatar
Michael Mercier committed
33

Millian Poquet's avatar
Millian Poquet committed
34
build_batsched:
35
  stage: build
36
  script:
37
    - rm -rf /builds/batsim/batsim/schedulers/batsched
Millian Poquet's avatar
Millian Poquet committed
38
39
40
    # Get the code at the expected revision
    - git clone https://gitlab.inria.fr/batsim/batsched.git /builds/batsim/batsim/schedulers/batsched
    - cd /builds/batsim/batsim/schedulers/batsched
41
    - git reset --hard 59f73b7 # 2017-10-07
Millian Poquet's avatar
Millian Poquet committed
42
    # Build batsched
43
    - rm -rf   /builds/batsim/batsim/schedulers/batsched/build
Millian Poquet's avatar
Millian Poquet committed
44
45
    - mkdir -p /builds/batsim/batsim/schedulers/batsched/build
    - cd /builds/batsim/batsim/schedulers/batsched/build
46
    - cmake /builds/batsim/batsim/schedulers/batsched
47
48
49
    - make
  artifacts:
    paths:
Millian Poquet's avatar
Millian Poquet committed
50
51
      - /builds/batsim/batsim/schedulers/batsched/build

52
53
54
55
56
57
retrieve_pybatsim:
  stage: build
  script:
    - rm -rf /builds/batsim/batsim/schedulers/pybatsim
    - git clone https://gitlab.inria.fr/batsim/pybatsim.git /builds/batsim/batsim/schedulers/pybatsim
    - cd /builds/batsim/batsim/schedulers/pybatsim
58
    - git reset --hard 3dd3fc0  # 2017-09-28
59
60
61
62
63
64
65
  artifacts:
    paths:
      - /builds/batsim/batsim/schedulers/pybatsim

################################################################################
# Test stage
################################################################################
Millian Poquet's avatar
Millian Poquet committed
66
test_doc:
Millian Poquet's avatar
Millian Poquet committed
67
  stage: test
68
  script:
Millian Poquet's avatar
Millian Poquet committed
69
    - cd /builds/batsim/batsim/doc
70
71
72
73
74
75
    - doxygen
    - cat doxygen_warnings.log
    # The next line fails if doxygen generated warnings
    - eval "[ $(wc -c doxygen_warnings.log | cut -d ' ' -f1) -eq 0 ]"
  artifacts:
    paths:
Millian Poquet's avatar
Millian Poquet committed
76
      - /builds/batsim/batsim/doc/doxygen_doc/html
77

Millian Poquet's avatar
Millian Poquet committed
78
test_test:
Michael Mercier's avatar
Michael Mercier committed
79
80
  stage: test
  script:
Millian Poquet's avatar
Millian Poquet committed
81
    # Install Batsim
82
    - cd /builds/batsim/batsim/build
83
    - make install
84

Millian Poquet's avatar
Millian Poquet committed
85
86
    # Install the Batsched scheduler
    - cd /builds/batsim/batsim/schedulers/batsched/build
87
88
    - make install

MERCIER Michael's avatar
MERCIER Michael committed
89
90
    # clean /tmp to fix https://gitlab.inria.fr/batsim/batsim/issues/27
    - rm -rf /tmp/*
Millian Poquet's avatar
Millian Poquet committed
91
    # Install the pybatsim scheduler
92
    - pip3 install /builds/batsim/batsim/schedulers/pybatsim
Millian Poquet's avatar
Millian Poquet committed
93

94
95
96
97
98
99
100
    # Run the redis server
    - |
      redis-server>/dev/null &
      while ! nc -z localhost 6379; do
        sleep 1
      done

Millian Poquet's avatar
Millian Poquet committed
101
    # Finally run the tests
102
    - cd /builds/batsim/batsim/build
103
    - ctest --output-on-failure -E 'remote|smpi'
104
  dependencies:
105
    - build_clang
Millian Poquet's avatar
Millian Poquet committed
106
    - build_batsched
107
    - retrieve_pybatsim
Millian Poquet's avatar
Millian Poquet committed
108

109
test_version_git:
110
111
112
  stage: test
  script:
    # Checks that 'batsim --version' matches the latest batsim release
113
    - /builds/batsim/batsim/tools/check_batsim_version.py --batsim-command /builds/batsim/batsim/build/batsim --batsim-git-dir /builds/batsim/batsim
114
115
116
  dependencies:
    - build_clang

117
118
119
test_version_no_git:
  stage: test
  script:
120
    # copy Batsim directory
121
122
123
124
125
    - rm -rf /tmp/batsim
    - mkdir /tmp/batsim
    - cp -r {/builds/batsim/batsim,/tmp/batsim}/src
    - cp -r {/builds/batsim/batsim,/tmp/batsim}/CMakeLists.txt
    - cp -r {/builds/batsim/batsim,/tmp/batsim}/cmake
126
127
128
129
130
131
132
133
134
135

    # compile Batsim outside the git directory
    - export CC=/usr/bin/clang
    - export CXX=/usr/bin/clang++
    - rm -rf /tmp/batsim/build
    - mkdir  /tmp/batsim/build
    - cd /tmp/batsim/build
    - cmake .. -DCMAKE_BUILD_TYPE=Debug -Dtreat_warnings_as_errors=ON
    - make

136
    # Checks that 'batsim --version' matches the latest batsim release
137
    - /builds/batsim/batsim/tools/check_batsim_version.py --batsim-command /tmp/batsim/build/batsim --batsim-git-dir /builds/batsim/batsim
138

139
140
141
################################################################################
# Deploy stage
################################################################################
Millian Poquet's avatar
Millian Poquet committed
142
143
144
deploy_code_doc:
  stage: deploy
  script:
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
      # The script below is done to push Batsim's code doc onto the gforge website.
      # Information found on https://docs.gitlab.com/ee/ci/ssh_keys/README.html

      # Install ssh-agent if not already installed, it is required by Docker.
      # (change apt-get to yum if you use a CentOS-based image)
      - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'

      # Run ssh-agent (inside the build environment)
      - eval $(ssh-agent -s)

      # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
      - ssh-add <(echo "$SSH_PRIVATE_KEY")

      # For Docker builds disable host key checking. Be aware that by adding that
      # you are suspectible to man-in-the-middle attacks.
      # WARNING: Use this only with the Docker executor, if you use it with shell
      # you will overwrite your user's SSH config.
      - mkdir -p ~/.ssh
      - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config'

      # Finally push the code documentation on the gforge website
      - cd /builds/batsim/batsim/doc
      - rsync -rlgoDz --delete doxygen_doc/html/ mpoquet@scm.gforge.inria.fr:/home/groups/batsim/htdocs
Millian Poquet's avatar
Millian Poquet committed
168
  dependencies:
Millian Poquet's avatar
Millian Poquet committed
169
    - test_doc
170
171
  only:
    - master