.gitlab-ci.yml 2.99 KB
Newer Older
1
variables:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
2
  DOCKER_TAG_DEV: ${CI_COMMIT_REF_NAME}
3
  RSYNC_OPTS: --recursive --ignore-missing-args --chown ${DEPLOY_USER}:${DEPLOY_USER}
Markus Mirz's avatar
Markus Mirz committed
4
  DOCKER_IMAGE_DEV: dpsim-dev
5
6

before_script:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
7
  - git config --local core.longpaths true
8
  - git submodule sync --recursive
9
  - git submodule update --init --recursive
10

11
12
stages:
  - prepare
Steffen Vogel's avatar
Steffen Vogel committed
13
  - pre-build
14
  - build
Steffen Vogel's avatar
Steffen Vogel committed
15
  - test
Markus Mirz's avatar
Markus Mirz committed
16
  - deploy
17
  #- post-all
18
19
20
21

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

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

41
42
build:docs:
  stage: build
Georg Martin Reinke's avatar
Georg Martin Reinke committed
43
  script:
Steffen Vogel's avatar
Steffen Vogel committed
44
45
    - make -C build docs
    - make -C build docs_cxx
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
46
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
Steffen Vogel's avatar
Steffen Vogel committed
47
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
48
    - build:linux
Georg Martin Reinke's avatar
Georg Martin Reinke committed
49
50
  artifacts:
    paths:
Markus Mirz's avatar
Markus Mirz committed
51
52
      - build/Documentation/html
      - build/Documentation/Cxx/html
Georg Martin Reinke's avatar
Georg Martin Reinke committed
53
54
  tags:
    - docker
55

Steffen Vogel's avatar
Steffen Vogel committed
56
57
58
build:packages:
  stage: build
  script:
Steffen Vogel's avatar
Steffen Vogel committed
59
    - make -C build package
Steffen Vogel's avatar
Steffen Vogel committed
60
61
62
63
64
  only:
    - tags
  tags:
    - docker
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
Steffen Vogel's avatar
Steffen Vogel committed
65
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
66
    - build:linux
Steffen Vogel's avatar
Steffen Vogel committed
67
68
69
70
71
  artifacts:
    paths:
      - build/*.rpm
      - build/*.tar.gz

72
73
74
75
76
77
78
build:docker:
  stage: build
  script:
    - docker build -f Packaging/Docker/Dockerfile -t rwthacs/dpsim:${DOCKER_TAG_DEV} .
  tags:
    - shell

79
test:pytest:
Steffen Vogel's avatar
Steffen Vogel committed
80
81
82
  stage: test
  script:
    - make -C build install
83
    - pytest -v
Steffen Vogel's avatar
Steffen Vogel committed
84
85
  image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
  dependencies:
Steffen Vogel's avatar
fix CI    
Steffen Vogel committed
86
    - build:linux
Steffen Vogel's avatar
Steffen Vogel committed
87
88
  artifacts:
    paths:
89
      - Logs/
Steffen Vogel's avatar
Steffen Vogel committed
90
91
92
  tags:
    - docker

93
94
95
96
97
98
99
100
101
deploy:docker:
  stage: deploy
  script:
    - docker push rwthacs/dpsim:${DOCKER_TAG_DEV} .
  dependencies:
    - build:docker
  tags:
    - shell

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

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

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