.gitlab-ci.yml 6.7 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
24
    - docker build
        --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 .
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 ..
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
  cache:
    paths:
      - build
67
    key: build-linux-cuda
68
69
  artifacts:
    paths:
Markus Mirz's avatar
Markus Mirz committed
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
.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: ''
  script:
    - ls $TEST_BINARY_PATH
    - ldd $TEST_BINARY_PATH/$TEST_BINARY | sed -n -E -e 's/^\s+\S+ => (\S+) \S+$/\1/p'  | xargs -I % cp % $LDIR
    - echo "$TEST_BINARY_PATH/$TEST_BINARY $TEST_FILES" | tr -d '\n' | xargs -r -d " " -I % cp % $LDIR
    - ssh $GPU_TARGET mkdir -p $RDIR
    - scp -r $LDIR/* $GPU_TARGET:$RDIR/
    - ssh $GPU_TARGET "LD_LIBRARY_PATH=$RDIR:$${LD_LIBRARY_PATH} LD_PRELOAD=$RDIR/cricket-server.so $RDIR/$TEST_BINARY" &
    - sleep 2
    - PATH=$LDIR:$PATH LD_PRELOAD=$LDIR/libtirpc.so.3:$LDIR/cricket-client.so $LDIR/$TEST_BINARY
  after_script:
#- ssh $GPU_TARGET rm -rf $RDIR
    - 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:
      TEST_BINARY: 'WSCC_9bus_mult_decoupled'
      TEST_BINARY_PATH: 'build/Examples/Cxx'
      TEST_FILES: '/usr/local/lib64/libvillas.so.1
                   Examples/CIM/grid-data/WSCC-09/WSCC-09_RX/WSCC-09_RX_DI.xml
                   Examples/CIM/grid-data/WSCC-09/WSCC-09_RX/WSCC-09_RX_EQ.xml
                   Examples/CIM/grid-data/WSCC-09/WSCC-09_RX/WSCC-09_RX_SV.xml
                   Examples/CIM/grid-data/WSCC-09/WSCC-09_RX/WSCC-09_RX_TP.xml'

Markus Mirz's avatar
Markus Mirz committed
230
231
# Stage deploy
##############################################################################
232
.pages:
Markus Mirz's avatar
Markus Mirz committed
233
234
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
235
236
    - cp -r build/docs/sphinx/html/. public/sphinx
    - cp -r build/docs/doxygen/html/. public/doxygen
Markus Mirz's avatar
Markus Mirz committed
237
238
239
240
241
242
  artifacts:
    paths:
      - public
  dependencies:
    - generate:docs
  only:
243
    - deploy
Markus Mirz's avatar
Markus Mirz committed
244
245
246
247
  tags:
    - shell
    - linux

248
.deploy:docker:
249
250
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
251
    - docker push ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
252
    - docker push ${DOCKER_IMAGE_DEV}:latest
253
    - docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
254
    - docker push ${DOCKER_IMAGE}:latest
255
256
257
258
  dependencies:
    - build:docker
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
259
    - linux
Steffen Vogel's avatar
Steffen Vogel committed
260
261
  only:
    - tags
262

263
.deploy:packages:
Steffen Vogel's avatar
Steffen Vogel committed
264
265
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
266
    - rsync ${RSYNC_OPTS} build/*.rpm ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/packages/fedora/29/x86_64
Steffen Vogel's avatar
Steffen Vogel committed
267
    - rsync ${RSYNC_OPTS} build/*.tar.gz ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/dpsim/src
Markus Mirz's avatar
Markus Mirz committed
268
    - ssh ${DEPLOY_USER}@${DEPLOY_HOST} createrepo /var/www/packages/fedora/29
Steffen Vogel's avatar
Steffen Vogel committed
269
  dependencies:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
270
    - generate:packages
Steffen Vogel's avatar
Steffen Vogel committed
271
272
273
274
275
  only:
    - tags
  tags:
    - fein-deploy
    - shell
276
    - linux