Imported Upstream version 2.61.0
[platform/upstream/glib.git] / .gitlab-ci.yml
1 image: registry.gitlab.gnome.org/gnome/glib/master:v11
2
3 stages:
4   - build
5   - coverage
6   - deploy
7
8 cache:
9   paths:
10     - _ccache/
11
12 variables:
13   MESON_TEST_TIMEOUT_MULTIPLIER: 2
14   G_MESSAGES_DEBUG: all
15   MESON_COMMON_OPTIONS: "--buildtype debug --fatal-meson-warnings"
16
17 fedora-x86_64:
18   stage: build
19   except:
20     - tags
21   variables:
22     CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
23   script:
24     - meson ${MESON_COMMON_OPTIONS}
25             --werror
26             --default-library=both
27             --prefix=$HOME/glib-installed
28             --libdir=lib
29             -Dsystemtap=true
30             -Ddtrace=true
31             -Dfam=true
32             -Dinstalled_tests=true
33             _build
34     - ninja -C _build
35     - mkdir -p _coverage
36     - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
37     - .gitlab-ci/run-tests.sh
38     - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
39     # FIXME: We should run all installed tests, but do only this one for now
40     # because it cannot run uninstalled. Reconfigure with dtrace disabled
41     # because it breaks static link.
42     - meson configure -Ddtrace=false _build
43     - ninja -C _build install
44     - GLIB_TEST_COMPILATION=1 $HOME/glib-installed/libexec/installed-tests/glib/static-link.py $HOME/glib-installed/lib/pkgconfig
45   artifacts:
46     reports:
47       junit: "_build/${CI_JOB_NAME}-report.xml"
48     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
49     when: always
50     paths:
51       - "_build/config.h"
52       - "_build/glib/glibconfig.h"
53       - "_build/meson-logs"
54       - "_build/${CI_JOB_NAME}-report.xml"
55       - "_coverage"
56
57 G_DISABLE_ASSERT:
58   stage: build
59   except:
60     - tags
61   variables:
62     CPPFLAGS: "-DG_DISABLE_ASSERT"
63   script:
64     - meson ${MESON_COMMON_OPTIONS}
65             --werror
66             -Dsystemtap=true
67             -Ddtrace=true
68             -Dfam=true
69             -Dinstalled_tests=true
70             _build
71     - ninja -C _build
72     - bash -x ./.gitlab-ci/run-tests.sh
73   artifacts:
74     reports:
75       junit: "_build/${CI_JOB_NAME}-report.xml"
76     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
77     when: always
78     paths:
79       - "_build/config.h"
80       - "_build/glib/glibconfig.h"
81       - "_build/meson-logs"
82       - "_build/${CI_JOB_NAME}-report.xml"
83
84 .cross-template: &cross-template
85   stage: build
86   except:
87     - tags
88   artifacts:
89     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
90     when: always
91     paths:
92       - "_build/meson-logs"
93
94 cross-android_api21_arm64:
95   <<: *cross-template
96   script:
97     # FIXME: add --werror
98     # We use -Diconv=auto to test that we successfully detect that iconv is not
99     # provided by android api 21, and detect the external iconv instead.
100     - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=auto -Dinternal_pcre=true _build
101     - ninja -C _build
102
103 cross-android_api28_arm64:
104   <<: *cross-template
105   script:
106     # FIXME: add --werror
107     - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_28.txt -Dinternal_pcre=true _build
108     - ninja -C _build
109
110 cross-mingw64:
111   <<: *cross-template
112   script:
113     # FIXME: Add --werror
114     - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build
115     - ninja -C _build
116
117 msys2-mingw32:
118   stage: build
119   except:
120     - tags
121   tags:
122     - win32
123   variables:
124     MSYSTEM: "MINGW32"
125     CHERE_INVOKING: "yes"
126   script:
127     - C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
128     - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
129   artifacts:
130     reports:
131       junit: "_build/%CI_JOB_NAME%-report.xml"
132     name: "glib-%CI_JOB_NAME%-%CI_COMMIT_REF_NAME%"
133     when: always
134     paths:
135       - _build/meson-logs
136       - "_build/%CI_JOB_NAME%-report.xml"
137       - _coverage/
138
139 vs2017-x64:
140   stage: build
141   except:
142     - tags
143   tags:
144     - win32
145   script:
146     - .gitlab-ci/test-msvc.bat
147   artifacts:
148     reports:
149       junit: "_build/%CI_JOB_NAME%-report.xml"
150     name: "glib-%CI_JOB_NAME%-%CI_COMMIT_REF_NAME%"
151     when: always
152     paths:
153       - _build/meson-logs
154       - "_build/%CI_JOB_NAME%-report.xml"
155
156 freebsd-11-x86_64:
157   stage: build
158   only:
159     - branches@GNOME/glib
160   tags:
161     # To run a FreeBSD builder, install gitlab-runner package and start both
162     # gitlab-runner and dbus service because we need /var/lib/dbus/machine-id.
163     # To compile GLib, you still have to install the following packages:
164     # desktop-file-utils gettext libiconv meson pkgconf python3 shared-mime-info
165     - freebsd-11
166   variables:
167     # CPPFLAGS is required because libintl doesn't use pkg-config.
168     CPPFLAGS: -I/usr/local/include
169     # FIXME: Workaround meson inability to set LD_LIBRARY_PATH.
170     # https://github.com/mesonbuild/meson/issues/1383
171     # https://github.com/mesonbuild/meson/issues/1635
172     # https://github.com/mesonbuild/meson/issues/2881
173     LDFLAGS: -L/usr/local/lib -Wl,--disable-new-dtags
174     # FreeBSD doesn't have C.UTF-8 locale.
175     LANG: en_US.UTF-8
176   script:
177     # We cannot use -Wl,--no-undefined because GLib uses 'environ' variable.
178     # FreeBSD iconv doesn't handle transliteration, so we use (external) GNU libiconv here.
179     # FreeBSD supports xattr, but its API is different from Linux xattr.
180     # FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
181     - meson ${MESON_COMMON_OPTIONS} -Db_lundef=false -Diconv=external -Dxattr=false _build
182     - ninja -C _build
183     - bash -x ./.gitlab-ci/run-tests.sh
184   except:
185     - tags
186   artifacts:
187     reports:
188       junit: "_build/${CI_JOB_NAME}-report.xml"
189     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
190     when: always
191     paths:
192       - "_build/config.h"
193       - "_build/glib/glibconfig.h"
194       - "_build/meson-logs"
195       - "_build/${CI_JOB_NAME}-report.xml"
196
197 coverage:
198   stage: coverage
199   except:
200     - tags
201   artifacts:
202     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
203     paths:
204       - _coverage/
205   script:
206     - bash -x ./.gitlab-ci/coverage-docker.sh
207   coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
208
209 pages:
210   stage: deploy
211   only:
212     - master
213   script:
214     - mv _coverage/ public/
215   artifacts:
216     paths:
217       - public
218
219 dist-job:
220   stage: build
221   only:
222     - tags
223   script:
224     - meson --buildtype release --fatal-meson-warnings -Dgtk_doc=true -Dman=true _build
225     - cd _build
226     - ninja dist
227     - ninja glib-doc gobject-doc gio-doc
228     - tar -c -f "glib-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/glib html
229     - tar -c -f "gobject-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gobject html
230     - tar -c -f "gio-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gio html
231   artifacts:
232     paths:
233       - "${CI_PROJECT_DIR}/_build/glib-docs.tar.xz"
234       - "${CI_PROJECT_DIR}/_build/gobject-docs.tar.xz"
235       - "${CI_PROJECT_DIR}/_build/gio-docs.tar.xz"
236       - "${CI_PROJECT_DIR}/_build/meson-dist/glib-*.tar.xz"