summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 1f5e1ac9659418972536e56cedb4313fcad0c8d5 (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
image: registry.gitlab.gnome.org/gnome/glib/master:v11

stages:
  - build
  - coverage
  - deploy

cache:
  paths:
    - _ccache/

variables:
  MESON_TEST_TIMEOUT_MULTIPLIER: 2
  G_MESSAGES_DEBUG: all
  MESON_COMMON_OPTIONS: "--buildtype debug --fatal-meson-warnings"

fedora-x86_64:
  stage: build
  except:
    - tags
  variables:
    CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
  script:
    - meson ${MESON_COMMON_OPTIONS}
            --werror
            --default-library=both
            --prefix=$HOME/glib-installed
            --libdir=lib
            -Dsystemtap=true
            -Ddtrace=true
            -Dfam=true
            -Dinstalled_tests=true
            _build
    - ninja -C _build
    - mkdir -p _coverage
    - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
    - .gitlab-ci/run-tests.sh
    - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
    # FIXME: We should run all installed tests, but do only this one for now
    # because it cannot run uninstalled. Reconfigure with dtrace disabled
    # because it breaks static link.
    - meson configure -Ddtrace=false _build
    - ninja -C _build install
    - GLIB_TEST_COMPILATION=1 $HOME/glib-installed/libexec/installed-tests/glib/static-link.py $HOME/glib-installed/lib/pkgconfig
  artifacts:
    reports:
      junit: "_build/${CI_JOB_NAME}-report.xml"
    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
    when: always
    paths:
      - "_build/config.h"
      - "_build/glib/glibconfig.h"
      - "_build/meson-logs"
      - "_build/${CI_JOB_NAME}-report.xml"
      - "_coverage"

G_DISABLE_ASSERT:
  stage: build
  except:
    - tags
  variables:
    CPPFLAGS: "-DG_DISABLE_ASSERT"
  script:
    - meson ${MESON_COMMON_OPTIONS}
            --werror
            -Dsystemtap=true
            -Ddtrace=true
            -Dfam=true
            -Dinstalled_tests=true
            _build
    - ninja -C _build
    - bash -x ./.gitlab-ci/run-tests.sh
  artifacts:
    reports:
      junit: "_build/${CI_JOB_NAME}-report.xml"
    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
    when: always
    paths:
      - "_build/config.h"
      - "_build/glib/glibconfig.h"
      - "_build/meson-logs"
      - "_build/${CI_JOB_NAME}-report.xml"

.cross-template: &cross-template
  stage: build
  except:
    - tags
  artifacts:
    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
    when: always
    paths:
      - "_build/meson-logs"

cross-android_api21_arm64:
  <<: *cross-template
  script:
    # FIXME: add --werror
    - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=gnu -Dinternal_pcre=true _build
    - ninja -C _build

cross-android_api28_arm64:
  <<: *cross-template
  script:
    # FIXME: add --werror
    - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_28.txt -Dinternal_pcre=true _build
    - ninja -C _build

cross-mingw64:
  <<: *cross-template
  script:
    # FIXME: Add --werror
    - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build
    - ninja -C _build

msys2-mingw32:
  stage: build
  except:
    - tags
  tags:
    - win32
  variables:
    MSYSTEM: "MINGW32"
    CHERE_INVOKING: "yes"
  script:
    - C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
    - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
  artifacts:
    name: "glib-%CI_JOB_NAME%-%CI_COMMIT_REF_NAME%"
    when: always
    paths:
      - _build/meson-logs
      - _coverage/

vs2017-x64:
  stage: build
  except:
    - tags
  tags:
    - win32
  script:
    - .gitlab-ci/test-msvc.bat
  artifacts:
    name: "glib-%CI_JOB_NAME%-%CI_COMMIT_REF_NAME%"
    when: always
    paths:
      - _build/meson-logs

freebsd-11-x86_64:
  stage: build
  only:
    - branches@GNOME/glib
  tags:
    # To run a FreeBSD builder, install gitlab-runner package and start both
    # gitlab-runner and dbus service because we need /var/lib/dbus/machine-id.
    # To compile GLib, you still have to install the following packages:
    # desktop-file-utils gettext libiconv meson pkgconf python3 shared-mime-info
    - freebsd-11
  variables:
    # CPPFLAGS is required because libintl doesn't use pkg-config.
    CPPFLAGS: -I/usr/local/include
    # FIXME: Workaround meson inability to set LD_LIBRARY_PATH.
    # https://github.com/mesonbuild/meson/issues/1383
    # https://github.com/mesonbuild/meson/issues/1635
    # https://github.com/mesonbuild/meson/issues/2881
    LDFLAGS: -L/usr/local/lib -Wl,--disable-new-dtags
    # FreeBSD doesn't have C.UTF-8 locale.
    LANG: en_US.UTF-8
  script:
    # We cannot use -Wl,--no-undefined because GLib uses 'environ' variable.
    # FreeBSD iconv doesn't handle transliteration, so we use GNU libiconv here.
    # FreeBSD supports xattr, but its API is different from Linux xattr.
    # FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
    - meson ${MESON_COMMON_OPTIONS} -Db_lundef=false -Diconv=gnu -Dxattr=false _build
    - ninja -C _build
    - bash -x ./.gitlab-ci/run-tests.sh
  except:
    - tags
  artifacts:
    reports:
      junit: "_build/${CI_JOB_NAME}-report.xml"
    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
    when: always
    paths:
      - "_build/config.h"
      - "_build/glib/glibconfig.h"
      - "_build/meson-logs"
      - "_build/${CI_JOB_NAME}-report.xml"

coverage:
  stage: coverage
  except:
    - tags
  artifacts:
    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
    paths:
      - _coverage/
  script:
    - bash -x ./.gitlab-ci/coverage-docker.sh
  coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'

pages:
  stage: deploy
  only:
    - master
  script:
    - mv _coverage/ public/
  artifacts:
    paths:
      - public

dist-job:
  stage: build
  only:
    - tags
  script:
    - meson --buildtype release --fatal-meson-warnings -Dgtk_doc=true -Dman=true _build
    - cd _build
    - ninja dist
    - ninja glib-doc gobject-doc gio-doc
    - tar -c -f "glib-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/glib html
    - tar -c -f "gobject-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gobject html
    - tar -c -f "gio-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gio html
  artifacts:
    paths:
      - "${CI_PROJECT_DIR}/_build/glib-docs.tar.xz"
      - "${CI_PROJECT_DIR}/_build/gobject-docs.tar.xz"
      - "${CI_PROJECT_DIR}/_build/gio-docs.tar.xz"
      - "${CI_PROJECT_DIR}/_build/meson-dist/glib-*.tar.xz"