.gitlab-ci.yml 4.03 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 .
28
  tags:
Markus Mirz's avatar
Markus Mirz committed
29
    - shell
30

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

Steffen Vogel's avatar
Steffen Vogel committed
49
50
test:pytest:
  stage: test
Steffen Vogel's avatar
Steffen Vogel committed
51
52
  variables:
    PYTHONPATH: "build/Source/Python:Source/Python"
Steffen Vogel's avatar
Steffen Vogel committed
53
  script:
Markus Mirz's avatar
Markus Mirz committed
54
55
56
57
    - 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
Steffen Vogel's avatar
Steffen Vogel committed
58
59
60
61
62
63
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
  dependencies:
    - build:linux
  tags:
    - docker

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

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

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

Steffen Vogel's avatar
Steffen Vogel committed
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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

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

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

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
165
    - generate:packages
Steffen Vogel's avatar
Steffen Vogel committed
166
167
168
169
170
171
172
  only:
    - tags
  tags:
    - fein-deploy
  tags:
    - shell

173
# We run the windows build at last as it takes ages to finish
Markus Mirz's avatar
Markus Mirz committed
174
175
176
177
178
179
180
181
182
#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
183
#    - windows