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

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

13
14
15
stages:
  - prepare
  - build
Steffen Vogel's avatar
Steffen Vogel committed
16
  - test
Markus Mirz's avatar
fix ci    
Markus Mirz committed
17
  - generate
Markus Mirz's avatar
Markus Mirz committed
18
  - deploy
19
  #- post-all
20
21
22
23

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

Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
39
build:linux:
Markus Mirz's avatar
Markus Mirz committed
40
  stage: build
41
  script:
42
    - mkdir -p build
Markus Mirz's avatar
Markus Mirz committed
43
    - cd build
44
    - cmake ..
Steffen Vogel's avatar
Steffen Vogel committed
45
    - make -j 32
Markus Mirz's avatar
Markus Mirz committed
46
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
47
48
49
50
  cache:
    paths:
      - build
    key: build-linux
51
52
  artifacts:
    paths:
Markus Mirz's avatar
Markus Mirz committed
53
      - build
54
  tags:
Georg Martin Reinke's avatar
Georg Martin Reinke committed
55
56
    - docker

Steffen Vogel's avatar
Steffen Vogel committed
57
58
59
build:windows:
  stage: build
  script:
Steffen Vogel's avatar
Steffen Vogel committed
60
61
    - New-Item -ItemType Directory -Force -Path build
    - Set-Location -Path build
62
63
64
    # 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"
65
    - cmake --build . -j 24
Steffen Vogel's avatar
Steffen Vogel committed
66
67
68
69
70
71
72
  tags:
    - win10
  cache:
    paths:
      - build
    key: build-win10

Steffen Vogel's avatar
Steffen Vogel committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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
            -DWITH_CIM_SUBMODULE=ON 
            -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
93
94
test:pytest:
  stage: test
Steffen Vogel's avatar
Steffen Vogel committed
95
96
  variables:
    PYTHONPATH: "build/Source/Python:Source/Python"
Steffen Vogel's avatar
Steffen Vogel committed
97
  script:
Steffen Vogel's avatar
Steffen Vogel committed
98
    - pytest -v Examples/CIM/test_CIM.yml
Markus Mirz's avatar
Markus Mirz committed
99
100
    - pytest -v Examples/Cxx/test_Circuits.yml
    - pytest -v Examples/Cxx/test_RealTime.yml
101
102
103
104
105
    #- 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
Steffen Vogel's avatar
Steffen Vogel committed
106
107
108
109
110
111
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
  dependencies:
    - build:linux
  tags:
    - docker

Markus Mirz's avatar
fix ci    
Markus Mirz committed
112
113
generate:docs:
  stage: generate
Georg Martin Reinke's avatar
Georg Martin Reinke committed
114
  script:
Steffen Vogel's avatar
Steffen Vogel committed
115
116
    - make -j$(nproc) -C build docs
    - make -j$(nproc) -C build docs_cxx
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
117
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
Steffen Vogel's avatar
Steffen Vogel committed
118
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
119
    - build:linux
Georg Martin Reinke's avatar
Georg Martin Reinke committed
120
121
  artifacts:
    paths:
Markus Mirz's avatar
Markus Mirz committed
122
123
      - build/Documentation/html
      - build/Documentation/Cxx/html
Georg Martin Reinke's avatar
Georg Martin Reinke committed
124
125
  tags:
    - docker
126

Markus Mirz's avatar
fix ci    
Markus Mirz committed
127
128
generate:packages:
  stage: generate
Steffen Vogel's avatar
Steffen Vogel committed
129
  script:
Steffen Vogel's avatar
Steffen Vogel committed
130
    - make -j$(nproc) -C build package
Steffen Vogel's avatar
Steffen Vogel committed
131
132
133
134
135
  only:
    - tags
  tags:
    - docker
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
Steffen Vogel's avatar
Steffen Vogel committed
136
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
137
    - build:linux
Steffen Vogel's avatar
Steffen Vogel committed
138
139
140
141
142
  artifacts:
    paths:
      - build/*.rpm
      - build/*.tar.gz

143
144
145
build:docker:
  stage: build
  script:
146
147
148
    - docker build 
        --file Packaging/Docker/Dockerfile
        --build-arg DOCKER_TAG=${DOCKER_TAG}
149
150
151
152
        --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}
153
154
        --tag ${DOCKER_IMAGE}:${DOCKER_TAG}
        --tag ${DOCKER_IMAGE}:latest .
155
156
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
157
    - linux
Markus Mirz's avatar
Markus Mirz committed
158
159
  only:
    - tags
160

Steffen Vogel's avatar
Steffen Vogel committed
161
test:jupyter:
162
163
164
165
166
167
168
169
170
171
172
173
174
  stage: test
  variables:
    PYTHONPATH: "build/Source/Python:Source/Python"
  script:
    - pytest -v Examples/Notebooks
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
  dependencies:
    - build:linux
  tags:
    - docker
  artifacts:
    paths:
      - outputs/Examples/Notebooks/
Steffen Vogel's avatar
Steffen Vogel committed
175

Markus Mirz's avatar
Markus Mirz committed
176
deploy:docker:
177
178
  stage: deploy
  script:
179
180
    - docker push ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
    - docker push ${DOCKER_IMAGE_DEV}:latest
181
    - docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
182
    - docker push ${DOCKER_IMAGE}:latest
183
184
185
186
  dependencies:
    - build:docker
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
187
    - linux
Steffen Vogel's avatar
Steffen Vogel committed
188
189
  only:
    - tags
190

191
deploy:docs:
Markus Mirz's avatar
Markus Mirz committed
192
193
  stage: deploy
  script:
194
    - ssh ${DEPLOY_USER}@${DEPLOY_HOST} mkdir -p ${DEPLOY_PATH}/doc/${CI_BUILD_REF_NAME}/{sphinx,doxygen}
195
196
    - rsync ${RSYNC_OPTS} --delete build/Documentation/html/ ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/doc/${CI_BUILD_REF_NAME}/sphinx
    - rsync ${RSYNC_OPTS} --delete build/Documentation/Cxx/html/ ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}/doc/${CI_BUILD_REF_NAME}/doxygen
197
  dependencies:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
198
    - generate:docs
199
200
  only:
    - tags
Markus Mirz's avatar
Markus Mirz committed
201
    - deploy
202
203
  tags:
    - fein-deploy
Markus Mirz's avatar
Markus Mirz committed
204
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
205
    - linux
Steffen Vogel's avatar
Steffen Vogel committed
206
207
208
209

deploy:packages:
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
210
    - rsync ${RSYNC_OPTS} build/*.rpm ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/packages/fedora/29/x86_64
Steffen Vogel's avatar
Steffen Vogel committed
211
    - rsync ${RSYNC_OPTS} build/*.tar.gz ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/dpsim/src
Markus Mirz's avatar
Markus Mirz committed
212
    - ssh ${DEPLOY_USER}@${DEPLOY_HOST} createrepo /var/www/packages/fedora/29
Steffen Vogel's avatar
Steffen Vogel committed
213
  dependencies:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
214
    - generate:packages
Steffen Vogel's avatar
Steffen Vogel committed
215
216
217
218
219
  only:
    - tags
  tags:
    - fein-deploy
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
220
    - linux
Steffen Vogel's avatar
Steffen Vogel committed
221

222
# We run the windows build at last as it takes ages to finish
Markus Mirz's avatar
Markus Mirz committed
223
224
225
226
227
228
229
230
231
#build:windows:
#  stage: post-all
#  script:
#    - rmdir build /s
#    - mkdir build
#    - cd build
#    - cmake -G "Visual Studio 15 2017 Win64" ..
#    - cmake --build .
#  tags:
Steffen Vogel's avatar
Steffen Vogel committed
232
#    - windows