.gitlab-ci.yml 4.92 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
23
    - docker build
        --file Packaging/Docker/Dockerfile.dev
Markus Mirz's avatar
Markus Mirz committed
24
        --tag ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
25
        --tag ${DOCKER_IMAGE_DEV}:latest .
Markus Mirz's avatar
Markus Mirz committed
26
# build dedicated jupyter image in the future
Steffen Vogel's avatar
Steffen Vogel committed
27
28
29
    - docker build
       --file Packaging/Docker/Dockerfile.jupyter
       --build-arg DOCKER_IMAGE=${DOCKER_IMAGE_DEV}
Markus Mirz's avatar
Markus Mirz committed
30
31
       --build-arg DOCKER_TAG=${DOCKER_TAG}
       --tag ${DOCKER_IMAGE_DEV}-jupyter:${DOCKER_TAG}
Steffen Vogel's avatar
Steffen Vogel committed
32
       --tag ${DOCKER_IMAGE_DEV}-jupyter:latest .
33
  tags:
Markus Mirz's avatar
Markus Mirz committed
34
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
35
    - linux
36

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

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

Markus Mirz's avatar
Markus Mirz committed
71
72
73
74
75
76
77
#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
78
#            -DWITH_CIM_SUBMODULE=ON
Markus Mirz's avatar
Markus Mirz committed
79
80
81
82
83
84
85
86
87
88
89
#            -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
90

Markus Mirz's avatar
Markus Mirz committed
91
92
93
94
95
96
97
98
99
100
101
102
103
#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
104
#  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
Markus Mirz's avatar
Markus Mirz committed
105
106
107
108
#  dependencies:
#    - build:linux
#  tags:
#    - docker
Steffen Vogel's avatar
Steffen Vogel committed
109

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

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

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

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

Markus Mirz's avatar
Markus Mirz committed
174
175
176
177
178
# Stage deploy
##############################################################################
pages:
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
179
180
    - cp -r build/docs/sphinx/html/. public/sphinx
    - cp -r build/docs/doxygen/html/. public/doxygen
Markus Mirz's avatar
Markus Mirz committed
181
182
183
184
185
186
  artifacts:
    paths:
      - public
  dependencies:
    - generate:docs
  only:
187
    - deploy
Markus Mirz's avatar
Markus Mirz committed
188
189
190
191
  tags:
    - shell
    - linux

Markus Mirz's avatar
Markus Mirz committed
192
deploy:docker:
193
194
  stage: deploy
  script:
Markus Mirz's avatar
Markus Mirz committed
195
    - docker push ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
196
    - docker push ${DOCKER_IMAGE_DEV}:latest
197
    - docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
198
    - docker push ${DOCKER_IMAGE}:latest
199
200
201
202
  dependencies:
    - build:docker
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
203
    - linux
Steffen Vogel's avatar
Steffen Vogel committed
204
205
  only:
    - tags
206

Steffen Vogel's avatar
Steffen Vogel committed
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