.gitlab-ci.yml 7.04 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
20
21

docker:
  stage: prepare
  script:
22
    - cp -r ~/.ssh .
23
    - docker build
24
        --file Packaging/Docker/Dockerfile.dev-centos
Markus Mirz's avatar
Markus Mirz committed
25
        --tag ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
26
        --tag ${DOCKER_IMAGE_DEV}:latest .
Markus Mirz's avatar
Markus Mirz committed
27
# build dedicated jupyter image in the future
Steffen Vogel's avatar
Steffen Vogel committed
28
29
30
    - docker build
       --file Packaging/Docker/Dockerfile.jupyter
       --build-arg DOCKER_IMAGE=${DOCKER_IMAGE_DEV}
Markus Mirz's avatar
Markus Mirz committed
31
32
       --build-arg DOCKER_TAG=${DOCKER_TAG}
       --tag ${DOCKER_IMAGE_DEV}-jupyter:${DOCKER_TAG}
Steffen Vogel's avatar
Steffen Vogel committed
33
       --tag ${DOCKER_IMAGE_DEV}-jupyter:latest .
34
  tags:
Markus Mirz's avatar
Markus Mirz committed
35
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
36
    - linux
37

38
.build:linux:
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  stage: build
  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
57
  stage: build
58
  script:
59
    - mkdir -p build
Markus Mirz's avatar
Markus Mirz committed
60
    - cd build
61
    - cmake -DWITH_SPDLOG_SUBMODULE=ON ..
Steffen Vogel's avatar
Steffen Vogel committed
62
    - make -j 32
Markus Mirz's avatar
Markus Mirz committed
63
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
64
65
66
67
#  cache:
#    paths:
#      - build
#    key: build-linux-cuda
68
69
  artifacts:
    paths:
70
     - build
71
  tags:
Georg Martin Reinke's avatar
Georg Martin Reinke committed
72
73
    - docker

74
.build:windows:
Steffen Vogel's avatar
Steffen Vogel committed
75
76
  stage: build
  script:
Steffen Vogel's avatar
Steffen Vogel committed
77
78
    - New-Item -ItemType Directory -Force -Path build
    - Set-Location -Path build
79
80
81
    # 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"
82
    - cmake --build . -j 24
Steffen Vogel's avatar
Steffen Vogel committed
83
84
85
86
87
88
89
  tags:
    - win10
  cache:
    paths:
      - build
    key: build-win10

Markus Mirz's avatar
Markus Mirz committed
90
91
92
93
94
95
96
#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
97
#            -DWITH_CIM_SUBMODULE=ON
Markus Mirz's avatar
Markus Mirz committed
98
99
100
101
102
103
104
105
106
107
108
#            -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
109

Markus Mirz's avatar
Markus Mirz committed
110
111
112
113
114
115
116
117
118
119
120
121
122
#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
123
#  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
Markus Mirz's avatar
Markus Mirz committed
124
125
126
127
#  dependencies:
#    - build:linux
#  tags:
#    - docker
Steffen Vogel's avatar
Steffen Vogel committed
128

129
.generate:docs:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
130
  stage: generate
Georg Martin Reinke's avatar
Georg Martin Reinke committed
131
  script:
Steffen Vogel's avatar
Steffen Vogel committed
132
133
    - make -j$(nproc) -C build docs
    - make -j$(nproc) -C build docs_cxx
Markus Mirz's avatar
Markus Mirz committed
134
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
Steffen Vogel's avatar
Steffen Vogel committed
135
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
136
    - build:linux
Georg Martin Reinke's avatar
Georg Martin Reinke committed
137
138
  artifacts:
    paths:
Markus Mirz's avatar
Markus Mirz committed
139
140
      - build/docs/sphinx/html
      - build/docs/doxygen/html
Georg Martin Reinke's avatar
Georg Martin Reinke committed
141
142
  tags:
    - docker
143

144
.generate:packages:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
145
  stage: generate
Steffen Vogel's avatar
Steffen Vogel committed
146
  script:
Steffen Vogel's avatar
Steffen Vogel committed
147
    - make -j$(nproc) -C build package
Steffen Vogel's avatar
Steffen Vogel committed
148
149
150
151
  only:
    - tags
  tags:
    - docker
Markus Mirz's avatar
Markus Mirz committed
152
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
Steffen Vogel's avatar
Steffen Vogel committed
153
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
154
    - build:linux
Steffen Vogel's avatar
Steffen Vogel committed
155
156
157
158
159
  artifacts:
    paths:
      - build/*.rpm
      - build/*.tar.gz

160
161
162
build:docker:
  stage: build
  script:
Markus Mirz's avatar
Markus Mirz committed
163
    - docker build
164
165
        --file Packaging/Docker/Dockerfile
        --build-arg DOCKER_TAG=${DOCKER_TAG}
166
167
168
169
        --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}
170
171
        --tag ${DOCKER_IMAGE}:${DOCKER_TAG}
        --tag ${DOCKER_IMAGE}:latest .
172
173
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
174
    - linux
Markus Mirz's avatar
Markus Mirz committed
175
176
  only:
    - tags
177

178
.test:jupyter:
179
180
181
182
183
  stage: test
  variables:
    PYTHONPATH: "build/Source/Python:Source/Python"
  script:
    - pytest -v Examples/Notebooks
Markus Mirz's avatar
Markus Mirz committed
184
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
185
186
187
188
189
190
191
  dependencies:
    - build:linux
  tags:
    - docker
  artifacts:
    paths:
      - outputs/Examples/Notebooks/
Steffen Vogel's avatar
Steffen Vogel committed
192

193
194
195
196
197
198
199
200
.remote-gpu:
  stage: test
  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: ''
201
202
203
204
205
206
207
208
209
210
211
212
213
    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'
214
215
  script:
    - echo "$TEST_BINARY_PATH/$TEST_BINARY $TEST_FILES" | tr -d '\n' | xargs -r -d " " -I % cp % $LDIR
216
217
218
219
    - 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/
220
221
    - ssh $GPU_TARGET mkdir -p $RDIR
    - scp -r $LDIR/* $GPU_TARGET:$RDIR/
222
    - ssh $GPU_TARGET "LD_LIBRARY_PATH=$RDIR:${LD_LIBRARY_PATH} LD_PRELOAD=$RDIR/cricket-server.so $RDIR/$TEST_BINARY" &
223
    - sleep 2
224
    - PATH=$LDIR:${PATH} LD_PRELOAD=$LDIR/cricket-client.so $TEST_BINARY_PATH/$TEST_BINARY $TEST_PARAM
225
  after_script:
226
    - ssh $GPU_TARGET rm -rf $RDIR
227
228
229
230
231
232
233
234
235
236
    - ssh $GPU_TARGET pkill -fe -2 $RDIR/test_kernel
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
  dependencies:
    - build:linux-cuda
  tags:
    - docker

test:cuda:
    extends: .remote-gpu
    variables:
237
# Name of the test binary
238
      TEST_BINARY: 'WSCC_9bus_mult_decoupled'
239
# Path where the test binary is located
240
      TEST_BINARY_PATH: 'build/Examples/Cxx'
241
242
243
244
# Additional files that are necessary to run the application on the GPU node
      TEST_FILE: ''
# Command line parameters for the test binary
      TEST_PARAM: ''
245

Markus Mirz's avatar
Markus Mirz committed
246
247
# Stage deploy
##############################################################################
248
.pages:
Markus Mirz's avatar
Markus Mirz committed
249
250
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
251
252
    - cp -r build/docs/sphinx/html/. public/sphinx
    - cp -r build/docs/doxygen/html/. public/doxygen
Markus Mirz's avatar
Markus Mirz committed
253
254
255
256
257
258
  artifacts:
    paths:
      - public
  dependencies:
    - generate:docs
  only:
259
    - deploy
Markus Mirz's avatar
Markus Mirz committed
260
261
262
263
  tags:
    - shell
    - linux

264
.deploy:docker:
265
266
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
267
    - docker push ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
268
    - docker push ${DOCKER_IMAGE_DEV}:latest
269
    - docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
270
    - docker push ${DOCKER_IMAGE}:latest
271
272
273
274
  dependencies:
    - build:docker
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
275
    - linux
Steffen Vogel's avatar
Steffen Vogel committed
276
277
  only:
    - tags
278

279
.deploy:packages:
Steffen Vogel's avatar
Steffen Vogel committed
280
281
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
282
    - rsync ${RSYNC_OPTS} build/*.rpm ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/packages/fedora/29/x86_64
Steffen Vogel's avatar
Steffen Vogel committed
283
    - rsync ${RSYNC_OPTS} build/*.tar.gz ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/dpsim/src
Markus Mirz's avatar
Markus Mirz committed
284
    - ssh ${DEPLOY_USER}@${DEPLOY_HOST} createrepo /var/www/packages/fedora/29
Steffen Vogel's avatar
Steffen Vogel committed
285
  dependencies:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
286
    - generate:packages
Steffen Vogel's avatar
Steffen Vogel committed
287
288
289
290
291
  only:
    - tags
  tags:
    - fein-deploy
    - shell
292
    - linux