.gitlab-ci.yml 4.13 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
Steffen Vogel's avatar
Steffen Vogel committed
20
  - trigger
21
22
23
24

docker:
  stage: prepare
  script:
25
26
27
28
    - docker build
        --file Packaging/Docker/Dockerfile.dev
        --tag ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
        --tag ${DOCKER_IMAGE_DEV}:latest .
29
  tags:
Markus Mirz's avatar
Markus Mirz committed
30
    - shell
31

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

Steffen Vogel's avatar
Steffen Vogel committed
50
51
test:pytest:
  stage: test
Steffen Vogel's avatar
Steffen Vogel committed
52
53
  variables:
    PYTHONPATH: "build/Source/Python:Source/Python"
Steffen Vogel's avatar
Steffen Vogel committed
54
55
56
57
58
59
60
61
  script:
    - pytest -v
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
  dependencies:
    - build:linux
  tags:
    - docker

Markus Mirz's avatar
fix ci    
Markus Mirz committed
62
63
generate:docs:
  stage: generate
Georg Martin Reinke's avatar
Georg Martin Reinke committed
64
  script:
Steffen Vogel's avatar
Steffen Vogel committed
65
66
    - make -C build docs
    - make -C build docs_cxx
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
67
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
Steffen Vogel's avatar
Steffen Vogel committed
68
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
69
    - build:linux
Georg Martin Reinke's avatar
Georg Martin Reinke committed
70
71
  artifacts:
    paths:
Markus Mirz's avatar
Markus Mirz committed
72
73
      - build/Documentation/html
      - build/Documentation/Cxx/html
Georg Martin Reinke's avatar
Georg Martin Reinke committed
74
75
  tags:
    - docker
76

Markus Mirz's avatar
fix ci    
Markus Mirz committed
77
78
generate:packages:
  stage: generate
Steffen Vogel's avatar
Steffen Vogel committed
79
  script:
Steffen Vogel's avatar
Steffen Vogel committed
80
    - make -C build package
Steffen Vogel's avatar
Steffen Vogel committed
81
82
83
84
85
  only:
    - tags
  tags:
    - docker
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
Steffen Vogel's avatar
Steffen Vogel committed
86
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
87
    - build:linux
Steffen Vogel's avatar
Steffen Vogel committed
88
89
90
91
92
  artifacts:
    paths:
      - build/*.rpm
      - build/*.tar.gz

93
94
95
build:docker:
  stage: build
  script:
96
97
98
    - docker build 
        --file Packaging/Docker/Dockerfile
        --build-arg DOCKER_TAG=${DOCKER_TAG}
99
100
101
102
        --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}
103
104
        --tag ${DOCKER_IMAGE}:${DOCKER_TAG}
        --tag ${DOCKER_IMAGE}:latest .
105
106
  tags:
    - shell
Markus Mirz's avatar
Markus Mirz committed
107
108
  only:
    - tags
109

Steffen Vogel's avatar
Steffen Vogel committed
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
test:jupyter:
  stage: test
  script:
    - cd build
    - cmake ..
    - make -j32 notebooks
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG}
  dependencies:
    - build:linux
  artifacts:
    paths:
      - build/Examples/Notebooks/
  tags:
    - docker

    deploy:docker:
126
127
  stage: deploy
  script:
128
129
    - docker push ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
    - docker push ${DOCKER_IMAGE_DEV}:latest
130
    - docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
131
    - docker push ${DOCKER_IMAGE}:latest
132
133
134
135
  dependencies:
    - build:docker
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
136
137
  only:
    - tags
138

139
deploy:docs:
Markus Mirz's avatar
Markus Mirz committed
140
141
  stage: deploy
  script:
142
    - ssh ${DEPLOY_USER}@${DEPLOY_HOST} mkdir -p ${DEPLOY_PATH}/doc/${CI_BUILD_REF_NAME}/{sphinx,doxygen}
143
144
    - 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
145
  dependencies:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
146
    - generate:docs
147
148
149
150
151
152
  only:
    - tags
    - master
    - development
  tags:
    - fein-deploy
Markus Mirz's avatar
Markus Mirz committed
153
154
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
155
156
157
158
159
160
161
162

deploy:packages:
  stage: deploy
  script:
    - rsync ${RSYNC_OPTS} build/*.rpm ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/packages/redhat/x86_64
    - rsync ${RSYNC_OPTS} build/*.tar.gz ${DEPLOY_USER}@${DEPLOY_HOST}:/var/www/dpsim/src
    - ssh ${DEPLOY_USER}@${DEPLOY_HOST} createrepo /var/www/packages/redhat
  dependencies:
Markus Mirz's avatar
fix ci    
Markus Mirz committed
163
    - generate:packages
Steffen Vogel's avatar
Steffen Vogel committed
164
165
166
167
168
169
170
  only:
    - tags
  tags:
    - fein-deploy
  tags:
    - shell

171
# We run the windows build at last as it takes ages to finish
Markus Mirz's avatar
Markus Mirz committed
172
173
174
175
176
177
178
179
180
#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
181
182
183
184
185
186
187
188
189
190
191
#    - windows

trigger:jupyter:
  stage: trigger
  only:
    - tags
  script:
    - curl -X POST
           -F token=e9751bbb33e68c8206046d0062b5ff
           -F ref=kubernetes
            https://git.rwth-aachen.de/api/v4/projects/13613/trigger/pipeline