.gitlab-ci.yml 7.58 KB
Newer Older
1
variables:
2
  RSYNC_OPTS: --recursive --ignore-missing-args --chown ${DEPLOY_USER}:${DEPLOY_USER}
3
4
5
  DOCKER_TAG: ${CI_COMMIT_REF_NAME}
  DOCKER_IMAGE: rwthacs/dpsim
  DOCKER_IMAGE_DEV: rwthacs/dpsim-dev
6
7

before_script:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
8
  - git config --local core.longpaths true
9
  - git submodule sync --recursive
10
  - git submodule update --init --recursive
11

12
13
14
stages:
  - prepare
  - build
Steffen Vogel's avatar
Steffen Vogel committed
15
  - test
Markus Mirz's avatar
fix ci    
Markus Mirz committed
16
  - generate
Markus Mirz's avatar
Markus Mirz committed
17
  - deploy
18

19
docker:fedora:
20
  stage: prepare
21
  needs: []
22
  script:
23
    - docker build
24
        --file Packaging/Docker/Dockerfile.dev
Markus Mirz's avatar
Markus Mirz committed
25
        --tag ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
26
        --tag ${DOCKER_IMAGE_DEV}:latest .
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  tags:
    - shell
    - linux

docker:centos:
  stage: prepare
  needs: []
  script:
    - cp -r ~/.ssh .
    - docker build
        --file Packaging/Docker/Dockerfile.dev-centos
        --tag ${DOCKER_IMAGE_DEV}-centos:${DOCKER_TAG}
        --tag ${DOCKER_IMAGE_DEV}-centos:latest .
  tags:
    - shell
    - linux

docker:jupyter:
  stage: prepare
  needs: []
  script:
Steffen Vogel's avatar
Steffen Vogel committed
48
49
50
    - docker build
       --file Packaging/Docker/Dockerfile.jupyter
       --build-arg DOCKER_IMAGE=${DOCKER_IMAGE_DEV}
Markus Mirz's avatar
Markus Mirz committed
51
52
       --build-arg DOCKER_TAG=${DOCKER_TAG}
       --tag ${DOCKER_IMAGE_DEV}-jupyter:${DOCKER_TAG}
Steffen Vogel's avatar
Steffen Vogel committed
53
       --tag ${DOCKER_IMAGE_DEV}-jupyter:latest .
54
  tags:
Markus Mirz's avatar
Markus Mirz committed
55
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
56
    - linux
57

58
build:linux:
59
  stage: build
60
  needs: ["docker:fedora"]
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  script:
    - mkdir -p build
    - cd build
    - cmake -DWITH_CUDA=OFF ..
    - make -j 32
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
  cache:
    paths:
      - build
    key: build-linux
  artifacts:
    paths:
      - build
  tags:
    - docker

build:linux-cuda:
Markus Mirz's avatar
Markus Mirz committed
78
  stage: build
79
  needs: ["docker:centos"]
80
  script:
81
    - mkdir -p build
Markus Mirz's avatar
Markus Mirz committed
82
    - cd build
83
    - cmake -DWITH_SPDLOG_SUBMODULE=ON ..
Steffen Vogel's avatar
Steffen Vogel committed
84
    - make -j 32
85
86
87
88
89
  image: ${DOCKER_IMAGE_DEV}-centos:${DOCKER_TAG}
  cache:
    paths:
      - build
    key: build-linux-cuda
90
91
  artifacts:
    paths:
92
     - build
93
  tags:
Georg Martin Reinke's avatar
Georg Martin Reinke committed
94
95
    - docker

96
build:windows:
Steffen Vogel's avatar
Steffen Vogel committed
97
  stage: build
98
  needs: []
Steffen Vogel's avatar
Steffen Vogel committed
99
  script:
Steffen Vogel's avatar
Steffen Vogel committed
100
101
    - New-Item -ItemType Directory -Force -Path build
    - Set-Location -Path build
102
103
104
    # 64 Bit Graphviz Builds for Windows:
    # https://ci.appveyor.com/project/ellson/graphviz-pl238/
    - cmake .. -DGraphviz_ROOT="C:/Program Files/Graphviz 2.41.20190716.1839"
105
    - cmake --build . -j 24
Steffen Vogel's avatar
Steffen Vogel committed
106
107
108
109
110
111
112
  tags:
    - win10
  cache:
    paths:
      - build
    key: build-win10

Markus Mirz's avatar
Markus Mirz committed
113
114
115
116
117
118
119
#build:macos:
#  stage: build
#  script:
#    - mkdir -p build
#    - cd build
#    - cmake -DCMAKE_C_COMPILER=/usr/local/bin/gcc-9
#            -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-9
Markus Mirz's avatar
Markus Mirz committed
120
#            -DWITH_CIM_SUBMODULE=ON
Markus Mirz's avatar
Markus Mirz committed
121
122
123
124
125
126
127
128
129
130
131
#            -DWITH_SUNDIALS=OFF ..
#    - make -j $(sysctl -n hw.ncpu)
#  cache:
#    paths:
#      - build
#    key: build-macos
#  artifacts:
#    paths:
#      - build
#  tags:
#    - mac
Steffen Vogel's avatar
Steffen Vogel committed
132

Markus Mirz's avatar
Markus Mirz committed
133
134
135
136
137
138
139
140
141
142
143
144
145
#test:pytest:
#  stage: test
#  variables:
#    PYTHONPATH: "build/Source/Python:Source/Python"
#  script:
#    - pytest -v Examples/CIM/test_CIM.yml
#    - pytest -v Examples/Cxx/test_Circuits.yml
#    - pytest -v Examples/Cxx/test_RealTime.yml
#    #- pytest -v Examples/Cxx/test_Shmem.yml
#    - pytest -v Examples/Python/Base
#    - pytest -v Examples/Python/Circuits
#    - pytest -v Examples/Python/RealTime
#    #- pytest -v Examples/Python/Shmem
Markus Mirz's avatar
Markus Mirz committed
146
#  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
Markus Mirz's avatar
Markus Mirz committed
147
148
149
150
#  dependencies:
#    - build:linux
#  tags:
#    - docker
Steffen Vogel's avatar
Steffen Vogel committed
151

152
generate:docs:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
153
  stage: generate
154
  needs: ["build:linux"]
Georg Martin Reinke's avatar
Georg Martin Reinke committed
155
  script:
Steffen Vogel's avatar
Steffen Vogel committed
156
157
    - make -j$(nproc) -C build docs
    - make -j$(nproc) -C build docs_cxx
Markus Mirz's avatar
Markus Mirz committed
158
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
Steffen Vogel's avatar
Steffen Vogel committed
159
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
160
    - build:linux
Georg Martin Reinke's avatar
Georg Martin Reinke committed
161
162
  artifacts:
    paths:
Markus Mirz's avatar
Markus Mirz committed
163
164
      - build/docs/sphinx/html
      - build/docs/doxygen/html
Georg Martin Reinke's avatar
Georg Martin Reinke committed
165
166
  tags:
    - docker
167

168
generate:packages:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
169
  stage: generate
170
  needs: ["build:linux"]
Steffen Vogel's avatar
Steffen Vogel committed
171
  script:
Steffen Vogel's avatar
Steffen Vogel committed
172
    - make -j$(nproc) -C build package
Steffen Vogel's avatar
Steffen Vogel committed
173
174
175
176
  only:
    - tags
  tags:
    - docker
Markus Mirz's avatar
Markus Mirz committed
177
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
Steffen Vogel's avatar
Steffen Vogel committed
178
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
179
    - build:linux
Steffen Vogel's avatar
Steffen Vogel committed
180
181
182
183
184
  artifacts:
    paths:
      - build/*.rpm
      - build/*.tar.gz

185
186
build:docker:
  stage: build
187
  needs: []
188
  script:
Markus Mirz's avatar
Markus Mirz committed
189
    - docker build
190
191
        --file Packaging/Docker/Dockerfile
        --build-arg DOCKER_TAG=${DOCKER_TAG}
192
193
194
195
        --build-arg CI=1
        --build-arg CI_COMMIT_SHA=${CI_COMMIT_SHA}
        --build-arg CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME}
        --build-arg CI_COMMIT_TAG=${CI_COMMIT_TAG}
196
197
        --tag ${DOCKER_IMAGE}:${DOCKER_TAG}
        --tag ${DOCKER_IMAGE}:latest .
198
199
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
200
    - linux
Markus Mirz's avatar
Markus Mirz committed
201
202
  only:
    - tags
203

204
test:jupyter:
205
  stage: test
206
  needs: ["build:linux"]
207
208
209
210
  variables:
    PYTHONPATH: "build/Source/Python:Source/Python"
  script:
    - pytest -v Examples/Notebooks
Markus Mirz's avatar
Markus Mirz committed
211
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
212
213
214
215
216
217
218
  dependencies:
    - build:linux
  tags:
    - docker
  artifacts:
    paths:
      - outputs/Examples/Notebooks/
Steffen Vogel's avatar
Steffen Vogel committed
219

220
221
.remote-gpu:
  stage: test
222
  needs: ["build:linux-cuda"]
223
224
225
226
227
228
  variables:
    GPU_TARGET: 'gitlab-runner@ghost'
    RDIR: '/tmp/gitlab-jobs/$CI_PROJECT_NAME/$CI_JOB_ID'
    CI_DIR: '$CI_BUILDS_DIR/$CI_PROJECT_PATH'
    LDIR: '/cricket/bin'
    TEST_FILES: ''
229
230
231
232
233
234
235
236
237
238
239
240
241
    TEST_PARAM: ''
    REMOTE_LIBS: 'linux-vdso.so.1
                  librt.so.1
                  libdl.so.2
                  libcudart.so.10.2
                  libcusolver.so.10
                  libstdc\+\+.so.6
                  libm.so.6
                  libgcc_s.so.1
                  libc.so.6
                  /lib64/ld-linux-x86-64.so.2
                  libutil.so.1
                  libpthread.so.0'
242
243
  script:
    - echo "$TEST_BINARY_PATH/$TEST_BINARY $TEST_FILES" | tr -d '\n' | xargs -r -d " " -I % cp % $LDIR
244
245
246
247
    - ldd $LDIR/$TEST_BINARY |
      sed -n -E -e 's/^\s+\S+ => (\S+) \S+$/\1/p' |
      grep -Ev "$(echo $REMOTE_LIBS | tr ' ' '|')|not" |
      xargs -I % cp % $LDIR/
248
249
    - ssh $GPU_TARGET mkdir -p $RDIR
    - scp -r $LDIR/* $GPU_TARGET:$RDIR/
250
    - ssh $GPU_TARGET "LD_LIBRARY_PATH=$RDIR:${LD_LIBRARY_PATH} LD_PRELOAD=$RDIR/cricket-server.so $RDIR/$TEST_BINARY" &
251
    - sleep 2
252
    - PATH=$LDIR:${PATH} LD_PRELOAD=$LDIR/cricket-client.so $TEST_BINARY_PATH/$TEST_BINARY $TEST_PARAM
253
  after_script:
254
    - ssh $GPU_TARGET rm -rf $RDIR
255
    - ssh $GPU_TARGET pkill -fe -2 $RDIR/test_kernel
256
  image: ${DOCKER_IMAGE_DEV}-centos:${DOCKER_TAG}
257
258
259
260
261
262
263
  dependencies:
    - build:linux-cuda
  tags:
    - docker

test:cuda:
    extends: .remote-gpu
264
    allow_failure: true
265
    variables:
266
# Name of the test binary
267
      TEST_BINARY: 'WSCC_9bus_mult_decoupled'
268
# Path where the test binary is located
269
      TEST_BINARY_PATH: 'build/Examples/Cxx'
270
271
272
273
# Additional files that are necessary to run the application on the GPU node
      TEST_FILE: ''
# Command line parameters for the test binary
      TEST_PARAM: ''
274

Markus Mirz's avatar
Markus Mirz committed
275
276
# Stage deploy
##############################################################################
277
pages:
Markus Mirz's avatar
Markus Mirz committed
278
  stage: deploy
279
  needs: ["generate:docs"]
Markus Mirz's avatar
Markus Mirz committed
280
  script:
Markus Mirz's avatar
Markus Mirz committed
281
282
    - cp -r build/docs/sphinx/html/. public/sphinx
    - cp -r build/docs/doxygen/html/. public/doxygen
Markus Mirz's avatar
Markus Mirz committed
283
284
285
286
287
288
  artifacts:
    paths:
      - public
  dependencies:
    - generate:docs
  only:
289
    - deploy
Markus Mirz's avatar
Markus Mirz committed
290
291
292
293
  tags:
    - shell
    - linux

294
deploy:docker:
295
296
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
297
    - docker push ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
298
    - docker push ${DOCKER_IMAGE_DEV}:latest
299
    - docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
300
    - docker push ${DOCKER_IMAGE}:latest
301
302
303
304
  dependencies:
    - build:docker
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
305
    - linux
Steffen Vogel's avatar
Steffen Vogel committed
306
307
  only:
    - tags
308

309
deploy:packages:
Steffen Vogel's avatar
Steffen Vogel committed
310
311
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
312
    - rsync ${RSYNC_OPTS} build/*.rpm ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/packages/fedora/29/x86_64
Steffen Vogel's avatar
Steffen Vogel committed
313
    - rsync ${RSYNC_OPTS} build/*.tar.gz ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/dpsim/src
Markus Mirz's avatar
Markus Mirz committed
314
    - ssh ${DEPLOY_USER}@${DEPLOY_HOST} createrepo /var/www/packages/fedora/29
Steffen Vogel's avatar
Steffen Vogel committed
315
  dependencies:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
316
    - generate:packages
Steffen Vogel's avatar
Steffen Vogel committed
317
318
319
320
321
  only:
    - tags
  tags:
    - fein-deploy
    - shell
322
    - linux