.gitlab-ci.yml 2.97 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
stages:
  - prepare
Steffen Vogel's avatar
Steffen Vogel committed
15
  - pre-build
16
  - build
Steffen Vogel's avatar
Steffen Vogel committed
17
  - test
Markus Mirz's avatar
Markus Mirz committed
18
  - deploy
19
  #- post-all
20
21
22
23

docker:
  stage: prepare
  script:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
24
    - docker build -f Packaging/Docker/Dockerfile.dev -t ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV} .
25
  tags:
Markus Mirz's avatar
Markus Mirz committed
26
    - shell
27

Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
28
build:linux:
Steffen Vogel's avatar
Steffen Vogel committed
29
  stage: pre-build
30
  script:
Markus Mirz's avatar
Markus Mirz committed
31
32
    - mkdir build
    - cd build
Georg Martin Reinke's avatar
fix CI    
Georg Martin Reinke committed
33
    - cmake ..
Markus Mirz's avatar
Markus Mirz committed
34
    - make -j 8
Markus Mirz's avatar
Markus Mirz committed
35
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
36
37
  artifacts:
    paths:
Markus Mirz's avatar
Markus Mirz committed
38
      - build
39
  tags:
Georg Martin Reinke's avatar
Georg Martin Reinke committed
40
41
    - docker

Steffen Vogel's avatar
Steffen Vogel committed
42
43
44
45
46
47
48
49
50
51
test:pytest:
  stage: test
  script:
    - pytest -v
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
  dependencies:
    - build:linux
  tags:
    - docker

52
53
build:docs:
  stage: build
Georg Martin Reinke's avatar
Georg Martin Reinke committed
54
  script:
Steffen Vogel's avatar
Steffen Vogel committed
55
56
    - make -C build docs
    - make -C build docs_cxx
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
57
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
Steffen Vogel's avatar
Steffen Vogel committed
58
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
59
    - build:linux
Georg Martin Reinke's avatar
Georg Martin Reinke committed
60
61
  artifacts:
    paths:
Markus Mirz's avatar
Markus Mirz committed
62
63
      - build/Documentation/html
      - build/Documentation/Cxx/html
Georg Martin Reinke's avatar
Georg Martin Reinke committed
64
65
  tags:
    - docker
66

Steffen Vogel's avatar
Steffen Vogel committed
67
68
69
build:packages:
  stage: build
  script:
Steffen Vogel's avatar
Steffen Vogel committed
70
    - make -C build package
Steffen Vogel's avatar
Steffen Vogel committed
71
72
73
74
75
  only:
    - tags
  tags:
    - docker
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
Steffen Vogel's avatar
Steffen Vogel committed
76
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
77
    - build:linux
Steffen Vogel's avatar
Steffen Vogel committed
78
79
80
81
82
  artifacts:
    paths:
      - build/*.rpm
      - build/*.tar.gz

83
84
85
build:docker:
  stage: build
  script:
86
    - docker build -f Packaging/Docker/Dockerfile -t ${DOCKER_IMAGE}:${DOCKER_TAG} .
87
88
89
90
91
92
  tags:
    - shell

deploy:docker:
  stage: deploy
  script:
93
    - docker push ${DOCKER_IMAGE}:${DOCKER_TAG}
94
95
96
97
98
  dependencies:
    - build:docker
  tags:
    - shell

99
deploy:docs:
Markus Mirz's avatar
Markus Mirz committed
100
101
  stage: deploy
  script:
102
    - ssh ${DEPLOY_USER}@${DEPLOY_HOST} mkdir -p ${DEPLOY_PATH}/doc/${CI_BUILD_REF_NAME}/{sphinx,doxygen}
103
104
    - 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
105
106
107
108
109
110
111
112
  dependencies:
    - build:docs
  only:
    - tags
    - master
    - development
  tags:
    - fein-deploy
Markus Mirz's avatar
Markus Mirz committed
113
114
  tags:
    - shell
Steffen Vogel's avatar
Steffen Vogel committed
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

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:
    - build:packages
  only:
    - tags
  tags:
    - fein-deploy
  tags:
    - shell

131
# We run the windows build at last as it takes ages to finish
Markus Mirz's avatar
Markus Mirz committed
132
133
134
135
136
137
138
139
140
141
#build:windows:
#  stage: post-all
#  script:
#    - rmdir build /s
#    - mkdir build
#    - cd build
#    - cmake -G "Visual Studio 15 2017 Win64" ..
#    - cmake --build .
#  tags:
#    - windows