Imported Upstream version 2.60.5
[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     - meson test -C _build --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER} --no-suite flaky
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     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
47     when: always
48     paths:
49       - "_build/config.h"
50       - "_build/glib/glibconfig.h"
51       - "_build/meson-logs"
52       - "_coverage"
53
54 .cross-template: &cross-template
55   stage: build
56   except:
57     - tags
58   artifacts:
59     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
60     when: always
61     paths:
62       - "_build/meson-logs"
63
64 cross-android_api21_arm64:
65   <<: *cross-template
66   script:
67     # FIXME: add --werror
68     - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=gnu -Dinternal_pcre=true _build
69     - ninja -C _build
70
71 cross-android_api28_arm64:
72   <<: *cross-template
73   script:
74     # FIXME: add --werror
75     - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_28.txt -Dinternal_pcre=true _build
76     - ninja -C _build
77
78 cross-mingw64:
79   <<: *cross-template
80   script:
81     # FIXME: Add --werror
82     - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build
83     - ninja -C _build
84
85 msys2-mingw32:
86   stage: build
87   except:
88     - tags
89   tags:
90     - win32
91   variables:
92     MSYSTEM: "MINGW32"
93     CHERE_INVOKING: "yes"
94   script:
95     - C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
96     - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
97   artifacts:
98     name: "glib-%CI_JOB_NAME%-%CI_COMMIT_REF_NAME%"
99     when: always
100     paths:
101       - _build/meson-logs
102       - _coverage/
103
104 vs2017-x64:
105   stage: build
106   except:
107     - tags
108   tags:
109     - win32
110   script:
111     - .gitlab-ci/test-msvc.bat
112   artifacts:
113     name: "glib-%CI_JOB_NAME%-%CI_COMMIT_REF_NAME%"
114     when: always
115     paths:
116       - _build/meson-logs
117
118 freebsd-11-x86_64:
119   stage: build
120   only:
121     - branches@GNOME/glib
122   tags:
123     # To run a FreeBSD builder, install gitlab-runner package and start both
124     # gitlab-runner and dbus service because we need /var/lib/dbus/machine-id.
125     # To compile GLib, you still have to install the following packages:
126     # desktop-file-utils gettext libiconv meson pkgconf python3 shared-mime-info
127     - freebsd-11
128   variables:
129     # CPPFLAGS is required because libintl doesn't use pkg-config.
130     CPPFLAGS: -I/usr/local/include
131     # FIXME: Workaround meson inability to set LD_LIBRARY_PATH.
132     # https://github.com/mesonbuild/meson/issues/1383
133     # https://github.com/mesonbuild/meson/issues/1635
134     # https://github.com/mesonbuild/meson/issues/2881
135     LDFLAGS: -L/usr/local/lib -Wl,--disable-new-dtags
136     # FreeBSD doesn't have C.UTF-8 locale.
137     LANG: en_US.UTF-8
138   script:
139     # We cannot use -Wl,--no-undefined because GLib uses 'environ' variable.
140     # FreeBSD iconv doesn't handle transliteration, so we use GNU libiconv here.
141     # FreeBSD supports xattr, but its API is different from Linux xattr.
142     # FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
143     - meson ${MESON_COMMON_OPTIONS} -Db_lundef=false -Diconv=gnu -Dxattr=false _build
144     - ninja -C _build
145     - meson test -C _build --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" --no-suite flaky
146   except:
147     - tags
148   artifacts:
149     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
150     when: always
151     paths:
152       - "_build/config.h"
153       - "_build/glib/glibconfig.h"
154       - "_build/meson-logs"
155
156 coverage:
157   stage: coverage
158   except:
159     - tags
160   artifacts:
161     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
162     paths:
163       - _coverage/
164   script:
165     - bash -x ./.gitlab-ci/coverage-docker.sh
166   coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
167
168 pages:
169   stage: deploy
170   only:
171     - master
172   script:
173     - mv _coverage/ public/
174   artifacts:
175     paths:
176       - public
177
178 dist-job:
179   stage: build
180   only:
181     - tags
182   script:
183     - meson --buildtype release --fatal-meson-warnings -Dgtk_doc=true -Dman=true _build
184     - cd _build
185     - ninja dist
186     - ninja glib-doc gobject-doc gio-doc
187     - tar -c -f "glib-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/glib html
188     - tar -c -f "gobject-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gobject html
189     - tar -c -f "gio-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gio html
190   artifacts:
191     paths:
192       - "${CI_PROJECT_DIR}/_build/glib-docs.tar.xz"
193       - "${CI_PROJECT_DIR}/_build/gobject-docs.tar.xz"
194       - "${CI_PROJECT_DIR}/_build/gio-docs.tar.xz"
195       - "${CI_PROJECT_DIR}/_build/meson-dist/glib-*.tar.xz"