.gitlab-ci.yml 5.68 KB
Newer Older
1
image: registry.gitlab.gnome.org/gnome/glib/master:v11
2 3 4

stages:
  - build
5 6
  - coverage
  - deploy
7

8 9 10 11
cache:
  paths:
    - _ccache/

12 13
variables:
  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 20
  except:
    - tags
21
  variables:
22
    CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
23
  script:
24 25 26 27 28 29 30 31 32 33
    - meson ${MESON_COMMON_OPTIONS}
            --werror
            --default-library=both
            --prefix=$HOME/glib-installed
            --libdir=lib
            -Dsystemtap=true
            -Ddtrace=true
            -Dfam=true
            -Dinstalled_tests=true
            _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 40 41 42 43 44
    # 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
45
  artifacts:
46
    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
47
    when: always
48
    paths:
49 50
      - "_build/config.h"
      - "_build/glib/glibconfig.h"
51 52
      - "_build/meson-logs"
      - "_coverage"
53

54
.cross-template: &cross-template
Xavier Claessens's avatar
Xavier Claessens committed
55 56 57 58
  stage: build
  except:
    - tags
  artifacts:
59 60
    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
    when: always
Xavier Claessens's avatar
Xavier Claessens committed
61
    paths:
62
      - "_build/meson-logs"
Xavier Claessens's avatar
Xavier Claessens committed
63

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

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

78
cross-mingw64:
79
  <<: *cross-template
80 81
  script:
    # FIXME: Add --werror
82
    - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build
83 84
    - ninja -C _build

85 86
msys2-mingw32:
  stage: build
87 88
  except:
    - tags
89 90 91 92 93 94 95 96
  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"
97
  artifacts:
98
    name: "glib-%CI_JOB_NAME%-%CI_COMMIT_REF_NAME%"
99
    when: always
100
    paths:
101
      - _build/meson-logs
102 103
      - _coverage/

Christoph Reiter's avatar
Christoph Reiter committed
104 105
vs2017-x64:
  stage: build
106 107
  except:
    - tags
Christoph Reiter's avatar
Christoph Reiter committed
108 109 110 111 112
  tags:
    - win32
  script:
    - .gitlab-ci/test-msvc.bat
  artifacts:
113
    name: "glib-%CI_JOB_NAME%-%CI_COMMIT_REF_NAME%"
Christoph Reiter's avatar
Christoph Reiter committed
114 115 116 117
    when: always
    paths:
      - _build/meson-logs

Ting-Wei Lan's avatar
Ting-Wei Lan committed
118 119
freebsd-11-x86_64:
  stage: build
120 121
  only:
    - branches@GNOME/glib
Ting-Wei Lan's avatar
Ting-Wei Lan committed
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
  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
143
    - meson ${MESON_COMMON_OPTIONS} -Db_lundef=false -Diconv=gnu -Dxattr=false _build
Ting-Wei Lan's avatar
Ting-Wei Lan committed
144
    - ninja -C _build
145
    - meson test -C _build --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" --no-suite flaky
Ting-Wei Lan's avatar
Ting-Wei Lan committed
146 147 148 149 150 151
  except:
    - tags
  artifacts:
    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
    when: always
    paths:
Ting-Wei Lan's avatar
Ting-Wei Lan committed
152 153
      - "_build/config.h"
      - "_build/glib/glibconfig.h"
Ting-Wei Lan's avatar
Ting-Wei Lan committed
154 155
      - "_build/meson-logs"

156 157
coverage:
  stage: coverage
158 159
  except:
    - tags
160
  artifacts:
161
    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
162 163 164 165
    paths:
      - _coverage/
  script:
    - bash -x ./.gitlab-ci/coverage-docker.sh
166
  coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
167 168 169

pages:
  stage: deploy
170 171
  only:
    - master
172 173 174 175 176
  script:
    - mv _coverage/ public/
  artifacts:
    paths:
      - public
177

178 179 180 181 182
dist-job:
  stage: build
  only:
    - tags
  script:
183
    - meson --buildtype release --fatal-meson-warnings -Dgtk_doc=true -Dman=true _build
184 185
    - cd _build
    - ninja dist
186
    - ninja glib-doc gobject-doc gio-doc
187 188 189 190 191 192 193 194 195
    - 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"