summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: ae37234d59af5d642e7a9dcaa9c0bc2120870e47 (plain)
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
include:
 - remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/80f87b3058efb75a1faae11826211375fba77e7f/templates/fedora.yml'

variables:
  FDO_DISTRIBUTION_TAG: latest
  FDO_DISTRIBUTION_VERSION: 36
  FDO_UPSTREAM_REPO: gnome/gnome-settings-daemon
  # Expiry sets fdo.expires on the image
  FEDORA_IMAGE: "$CI_REGISTRY/$FDO_UPSTREAM_REPO/fedora/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG"
  FDO_EXPIRES_AFTER: 8w
  FEDORA_DEPENDENCIES: >
    @c-development
    alsa-lib-devel
    colord-devel
    compiler-rt
    cups-devel
    fontconfig-devel
    gcr-devel
    geoclue2-devel geocode-glib-devel
    gettext
    git
    glib2-devel
    gnome-desktop3-devel
    gnome-session
    gobject-introspection
    gobject-introspection-devel
    gsettings-desktop-schemas-devel
    gtk3-devel
    lcms2-devel
    lcov gcovr clang libasan libubsan libtsan
    libcanberra-devel
    libgtop2-devel
    libgudev-devel
    libgweather4-devel
    libnotify-devel
    librsvg2-devel
    libwacom-devel
    libX11-devel
    libXi-devel
    libXtst-devel
    libXfixes-devel
    llvm
    mesa-dri-drivers
    meson
    ModemManager-glib-devel
    NetworkManager-libnm-devel
    nss-devel
    perl-interpreter
    polkit-devel
    pulseaudio-libs-devel
    python3-gobject python3-dbusmock
    umockdev
    upower-devel
    wayland-devel
    which
    xorg-x11-drv-wacom-devel
    xorg-x11-server-Xvfb
    mutter

image: "$FEDORA_IMAGE"

stages:
  - build
  - test
  - manual
  - delivery

.Log files: &log_files  [./*.log, _build/meson-logs/]

.Build logs: &save_build_logs
  artifacts:
    name: log
    when: always
    paths: *log_files

.Git Untracked files: &save_untracked_files
  artifacts:
    name: untracked
    when: always
    paths: [$(pwd)]
    expire_in: 3h30min

.Show Info: &environment_information
  build-aux/ci/ci-helper.sh "INFO" &&
  build-aux/ci/ci-helper.sh "GIT_INFO"

.Build procedure: &build_procedure
  echo "== Building ==" &&
  rm -rf _build/ &&
  meson . _build ${BUILD_OPTS} -Dgcr3=true &&
  ninja -C _build 2>&1 | tee compilation.log

.Run Tests: &run_tests
  echo "== Testing ==" &&
  meson test -C _build --verbose --no-stdsplit

##
# Stage: Build
#
# Checks if GNOME Settings Daemon is properly building and installing. This is the
# most important stage of the CI, and no MR should ever be merged if it breaks
# any of them.
##
build:
  <<: *save_untracked_files
  tags: ['crun']
  stage: build

  script:
    - *environment_information
    - *build_procedure

    - echo "== Installing =="
    - ninja -C _build install

    - echo "== Report =="
    - build-aux/ci/ci-helper.sh "WARNINGS"

    # Save all but git-related files
    - rm -rf .git .gitignore .gitmodules

  except:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule"

##
# Stage: Test
#
# Runs the unit tests.
##
test:
  <<: *save_build_logs
  tags: ['crun']
  stage: test

  dependencies:
    - build

  script:
    - *environment_information

    - |
      if [[ -n "${CI_COMMIT_TAG}" ]]; then
        *run_tests

        echo "== Distro Test =="
        ninja dist -C _build
      else
        echo "== Testing =="
        meson test -C _build --verbose --no-stdsplit
      fi

  except:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule"
      - $CI_COMMIT_TITLE =~ /^Update.*translation$/

# Runs the coverage test.
coverage:
  <<: *save_build_logs
  tags: ['crun']
  stage: test
  # Appears to be broken on Fedora Rawhide as of 2018-02-05
  allow_failure: true
  variables:
    BUILD_OPTS: "-Db_coverage=true"
    coverage: '/^Lines:.\d+.\d+.(\d+\.\d+\%)/'
  only:
    - master@GNOME/gnome-settings-daemon

  script:
    - *environment_information
    - *build_procedure
    - *run_tests

    - ninja -C _build coverage-html

    # Parse the report to get the coverage result
    - |
      echo == Coverage ==
      sed -e 's/<[^>]*>//g' _build/meson-logs/coveragereport/index.html | tr -d ' \t' | grep -A3 -P '^Lines:$'  | tr '\n' ' '; echo

##
# Stage: Delivery
#
# Publishes the Coverage Report generated above
##
pages:
  stage: delivery
  # Don't error in case coverage failed
  allow_failure: true
  dependencies:
    - coverage
  script:
    - mv _build/meson-logs/coveragereport/ public/
  artifacts:
    paths:
      - public
  only:
    - master@GNOME/gnome-settings-daemon

##
# Stage: Manual
#
# Runs the sanitizers [address, thread, undefined, and memory].
##
.sanitizer: &sanitizer
  <<: *save_build_logs
  tags: ['crun']
  stage: manual
  when: manual
  script:
    - *environment_information
    - *build_procedure
    - *run_tests

  except:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule"
      - $CI_COMMIT_TITLE =~ /^Update.*translation$/

#asan:
#  <<: *sanitizer
#  # ASAN requires debugging capabilities
#  tags: [ asan ]
#  variables:
#    BUILD_OPTS: "-Db_sanitize=address"

tsan:
  <<: *sanitizer
  variables:
    BUILD_OPTS: "-Db_sanitize=thread"

ubsan:
  <<: *sanitizer
  variables:
    BUILD_OPTS: "-Db_sanitize=undefined"

msan:
  <<: *sanitizer
  variables:
    BUILD_OPTS: "-Db_sanitize=memory -Db_lundef=false"
    CC: "clang"

#############################################
#          Create CI Docker Images          #
#############################################

# See also https://gitlab.freedesktop.org/freedesktop/ci-templates
container_fedora_build:
  extends: .fdo.container-build@fedora
  only:
    variables:
      - $CI_PIPELINE_SOURCE == "schedule" && $CRON_TASK == "BUILD_CI_IMAGES"
  variables:
    GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
    FDO_FORCE_REBUILD: 1 # Force rebuilding the image
    FDO_DISTRIBUTION_PACKAGES: $FEDORA_DEPENDENCIES
    FDO_DISTRIBUTION_EXEC: |
      git clone https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas.git && \
        cd gsettings-desktop-schemas && \
        meson . _build --prefix=/usr && \
        ninja -C _build && \
        ninja -C _build install && \
        cd ..