-
Notifications
You must be signed in to change notification settings - Fork 14
/
.gitlab-ci.yml
212 lines (201 loc) · 7.03 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
211
212
# Continuous Integration configuration for at-spi2-core
#
# For documentation on how this works, see devel-docs/gitlab-ci.md
#
# Full documentation for Gitlab CI: https://docs.gitlab.com/ee/ci/
#
# Introduction to Gitlab CI: https://docs.gitlab.com/ee/ci/quick_start/index.html
# Include the parameters we need from Freedesktop CI Templates
include:
- local: 'ci/container_builds.yml'
# Stages in the CI pipeline in which jobs will be run
stages:
- container-build
- style-check
- build
- analysis
- docs
- deploy
# Enable merge request pipelines and avoid duplicate pipelines
# https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH'
style-check-diff:
extends:
- '.container.opensuse@x86_64'
- '.fdo.distribution-image@opensuse'
needs: ['opensuse-container@x86_64']
stage: style-check
script:
- sh ./ci/run-style-check.sh
# Default build recipe.
#
# Depends on these variables:
# @MESON_EXTRA_FLAGS: extra arguments for the meson setup invocation
opensuse-x86_64:
stage: build
extends:
- '.container.opensuse@x86_64'
- '.fdo.distribution-image@opensuse'
needs: ['opensuse-container@x86_64']
variables:
MESON_EXTRA_FLAGS: "--buildtype=debug" # -Dwerror=true
script:
- source ci/env.sh
- meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build .
- meson compile -C _build
- meson install -C _build
- mkdir /tmp/test+dir+with+funny+chars
- export XDG_RUNTIME_DIR=/tmp/test+dir+with+funny+chars # See https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/48
- xvfb-run --auto-servernum dbus-run-session -- ci/run-registryd-tests.sh
- xvfb-run --auto-servernum dbus-run-session -- ci/run-tests.sh
artifacts:
reports:
junit:
- "_build/meson-logs/testlog.junit.xml"
- "_build/tests/registryd/registryd-pytest.junit.xml"
when: always
name: "at-spi2-core-${CI_COMMIT_REF_NAME}"
paths:
- "_build/meson-logs"
- "_build/tests/registryd"
fedora-x86_64:
stage: build
extends:
- '.container.fedora@x86_64'
- '.fdo.distribution-image@fedora'
needs: ['fedora-container@x86_64']
variables:
MESON_EXTRA_FLAGS: "--buildtype=debug -Ddefault_bus=dbus-broker -Ddbus_broker=/usr/bin/dbus-broker-launch" # -Dwerror=true
script:
- meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build .
- meson compile -C _build
- meson install -C _build
artifacts:
reports:
junit: "_build/meson-logs/testlog.junit.xml"
when: always
name: "at-spi2-core-${CI_COMMIT_REF_NAME}"
paths:
- "_build/meson-logs"
# Run static analysis on the code.
#
# The logs are part of the compilation stderr.
static-scan:
stage: analysis
extends:
- '.container.opensuse@x86_64'
- '.fdo.distribution-image@opensuse'
needs: ['opensuse-container@x86_64']
variables:
MESON_EXTRA_FLAGS: "--buildtype=debug -Dintrospection=disabled -Ddocs=false"
script:
- meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _scan_build .
- ninja -C _scan_build scan-build
artifacts:
name: "at-spi2-core-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_scan_build/meson-logs/scanbuild"
# Build and run with address sanitizer (asan).
asan-build:
stage: analysis
extends:
- '.container.opensuse@x86_64'
- '.fdo.distribution-image@opensuse'
needs: ['opensuse-container@x86_64']
variables:
MESON_EXTRA_FLAGS: "--buildtype=debug -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled -Ddocs=false"
# Add a suppressions file for address-sanitizer. Looks like libdbus has a minor leak that is hurting
# the tests while run with asan. Hopefully this will go away once we convert everything to gdbus.
#
# https://gitlab.freedesktop.org/dbus/dbus/-/issues/326
LSAN_OPTIONS: "suppressions=${CI_PROJECT_DIR}/ci/address-sanitizer.supp"
script:
- source ci/env.sh
- CC=clang meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build .
- meson compile -C _build
- meson install -C _build
- xvfb-run --auto-servernum dbus-run-session -- ci/run-tests.sh
artifacts:
name: "at-spi2-core-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
allow_failure: true
# Run the test suite and extract code coverage information.
#
# See the _coverage/ artifact for the HTML report.
coverage:
stage: analysis
extends:
- '.container.opensuse@x86_64'
- '.fdo.distribution-image@opensuse'
needs: ['opensuse-container@x86_64']
variables:
MESON_EXTRA_FLAGS: "--buildtype=debug -Ddocs=false -Dintrospection=disabled"
CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
script:
- source ./ci/env.sh
- meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build .
- meson compile -C _build
- meson install -C _build
- xvfb-run --auto-servernum dbus-run-session -- ci/run-registryd-tests.sh
- xvfb-run --auto-servernum dbus-run-session -- ci/run-tests.sh
- mkdir -p public
- grcov _build --source-dir ./ --prefix-dir ../ --output-type cobertura --branch --ignore-not-existing -o coverage.xml
- grcov _build --source-dir ./ --prefix-dir ../ --output-type html --branch --ignore-not-existing -o public/coverage
# In the following line, the first grep finds what it is supposed to find, but exits with a nonzero code.
# I have no idea why. So, force the whole pipeline to return true.
- (grep -Eo 'line-rate="[^"]+"' coverage.xml | head -n 1 | grep -Eo '[0-9.]+' | awk '{ print "Coverage:", $1 * 100 }') || true
coverage: '/Coverage: \d+\.\d+/'
artifacts:
name: "at-spi2-core-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
expire_in: 2 days
when: always
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- "_build/meson-logs"
- public
- coverage.xml
reference:
stage: docs
extends:
- '.container.opensuse@x86_64'
- '.fdo.distribution-image@opensuse'
needs: ['opensuse-container@x86_64']
variables:
MESON_EXTRA_FLAGS: "--buildtype=release -Ddocs=true"
script:
- source ci/env.sh
- meson setup ${MESON_EXTRA_FLAGS} --prefix /usr _build .
- ninja -C _build doc/atk doc/libatspi devel-docs/html
- mkdir _reference
- mv _build/doc/libatspi _reference/libatspi
- mv _build/doc/atk _reference/atk
- mv _build/devel-docs/html _reference/devel-docs
artifacts:
paths:
- _reference
- "_build/meson-logs"
# Publish the test coverage report
pages:
stage: deploy
needs: [ coverage, reference ]
script:
- mv _reference/* public/
artifacts:
paths:
- public
rules:
- if: ($CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH)
# Restrict it to the gnome namespace to avoid every fork pushing a set of pages by default
# - if: ($CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH && $CI_PROJECT_NAMESPACE == "gnome")