forked from Nheko-Reborn/mtxclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
211 lines (197 loc) · 5.76 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
variables:
CCACHE_COMPILERCHECK: content
CCACHE_DIR: "${CI_PROJECT_DIR}/.ccache"
# prevent configure tzdata hanging apt install commands
DEBIAN_FRONTEND: noninteractive
include:
- template: 'Workflows/Branch-Pipelines.gitlab-ci.yml'
stages:
- prepare
- build
.build-synapse-image:
stage: prepare
image:
# newer version doesn't seem to like our arm runner
name: gcr.io/kaniko-project/executor:v1.6.0-debug
entrypoint: [""]
rules:
- if: $CI_COMMIT_BRANCH
changes:
- .ci/synapse/Dockerfile
- .ci/synapse/setup-synapse.sh
- .ci/synapse/service/synapse/*
- .ci/synapse/service/postgresql/*
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --whitelist-var-run=false --context $CI_PROJECT_DIR/.ci/synapse --dockerfile $CI_PROJECT_DIR/.ci/synapse/Dockerfile --destination $CI_REGISTRY_IMAGE/synapse-${M_ARCH}:latest
build synapse amd64:
extends: .build-synapse-image
tags: [docker]
variables:
M_ARCH: x86_64
build synapse arm64:
extends: .build-synapse-image
tags: [docker-arm64]
variables:
M_ARCH: aarch64
.build-linux:
stage: build
image: ubuntu:20.04
services:
- name: $CI_REGISTRY_IMAGE/synapse-${M_ARCH}:latest
alias: synapse
variables:
TRAVIS_OS_NAME: linux
before_script:
- apt-get update
- apt-get install -y software-properties-common
- add-apt-repository ppa:ubuntu-toolchain-r/test -y
- apt-get update && apt-get -y install --no-install-recommends build-essential ninja-build libssl-dev git ccache curl lcov gcovr cmake libgtest-dev
# need recommended deps for wget
- apt-get -y install wget
- rm -rf ../.hunter && mv .hunter ../.hunter || true
script:
- curl -s -f -k https://synapse:8008/_matrix/client/versions
- export PATH="/usr/lib/ccache:${PATH}"
- export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l)
- export PATH="/usr/local/bin/:${PATH}"
- cmake -GNinja -H. -Bbuild
-DCMAKE_INSTALL_PREFIX=.deps/usr
-DHUNTER_ROOT="../.hunter"
-DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=Debug -DHUNTER_CONFIGURATION_TYPES=Debug
-DCI_BUILD=ON
-DCOVERAGE=${COVERAGE}
- cmake --build build
- MTXCLIENT_SERVER=synapse GTEST_OUTPUT=xml:junit-output/ make test
after_script:
- mv ../.hunter .hunter
cache:
key: "$CI_JOB_NAME"
paths:
- .hunter/
- .ccache
artifacts:
reports:
junit: build/junit-output/*.xml
paths:
- build/junit-output/*.xml
build linux amd64:
extends: .build-linux
tags: [docker]
variables:
M_ARCH: x86_64
COVERAGE: "ON"
after_script:
- ./.ci/coverage.sh
- (cd build && gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml -e '../tests' -e '../examples' -e '_deps' --root ${CI_PROJECT_DIR})
- bash <(curl -s https://codecov.io/bash) -f build/coverage.info || echo "Codecov failed"
- mv ../.hunter .hunter
needs:
- job: "build synapse amd64"
optional: true
coverage: /^\s*lines:\s*\d+.\d+\%/
artifacts:
reports:
cobertura: build/coverage.xml
paths:
- build/junit-output/*.xml
- build/coverage.xml
build linux arm64:
extends: .build-linux
tags: [docker-arm64]
variables:
M_ARCH: aarch64
needs:
- job: "build synapse arm64"
optional: true
build linux meson wraps:
stage: build
image: alpine:latest
tags: [docker]
needs:
- job: "build synapse amd64"
optional: true
variables:
M_ARCH: x86_64
COVERAGE: "ON"
services: !reference [.build-linux, services]
before_script:
- echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
- apk update && apk add meson git g++ cmake pkgconf openssl openssl-dev make
script:
- meson setup builddir -Dtests=true -Dexamples=true -Ddefault_library=static
- meson compile -C builddir
- MTXCLIENT_SERVER=synapse meson test -C builddir
artifacts:
reports:
junit: builddir/*.xml
paths:
- builddir/*.xml
build-macos:
stage: build
tags: [macos]
needs: []
before_script:
- rm -rf ../.hunter && mv .hunter ../.hunter || true
script:
- export PATH=/usr/local/opt/qt/bin/:${PATH}
- cmake -GNinja -H. -Bbuild
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_INSTALL_PREFIX=.deps/usr
-DHUNTER_ROOT="../.hunter"
-DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo
-DUSE_BUNDLED_OPENSSL=ON
-DCI_BUILD=ON
- cmake --build build
- mv ../.hunter .hunter
cache:
key: "${CI_JOB_NAME}"
paths:
- .hunter/
- "${CCACHE_DIR}"
linting:
stage: build
image: alpine:latest
tags: [docker]
needs: []
before_script:
- apk update && apk add clang-extra-tools make git
script:
- make lint
test-pages:
stage: build
tags: [docker]
image: alpine:latest
except:
- master
needs: []
before_script:
- apk update
- apk add doxygen git texlive-full py3-jinja2 py3-pygments
- git clone https://github.com/mosra/m.css.git
script:
- ./m.css/documentation/doxygen.py Doxyfile-mcss
- mv generated-docs/html/ public/
artifacts:
paths:
- public
pages:
stage: build
tags: [docker]
image: alpine:latest
only:
- master
needs: []
before_script:
- apk update
- apk add doxygen git texlive-full py3-jinja2 py3-pygments
- git clone https://github.com/mosra/m.css.git
script:
- ./m.css/documentation/doxygen.py Doxyfile-mcss
- mv generated-docs/html/ public/
artifacts:
paths:
- public