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

docker:
  stage: prepare
  script:
23
24
25
26
    - 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
27
# build dedicated jupyter image in the future
Steffen Vogel's avatar
Steffen Vogel committed
28
29
30
31
32
33
    - 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 .
34
  tags:
Markus Mirz's avatar
Markus Mirz committed
35
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
36
    - linux
37

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

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

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

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

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

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

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

Steffen Vogel's avatar
Steffen Vogel committed
160
test:jupyter:
161
162
163
164
165
166
167
168
169
170
171
172
173
  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
174

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

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

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