Imported Upstream version 2.57.2
[platform/upstream/glib.git] / .gitlab-ci.yml
index 608ae9e..916f41e 100644 (file)
-image: registry.gitlab.gnome.org/gnome/glib/master:v3
+image: registry.gitlab.gnome.org/gnome/glib/master:v6
 
 stages:
   - build
+  - coverage
+  - deploy
 
-build-job:
+cache:
+  paths:
+    - _ccache/
+
+variables:
+  MESON_TEST_TIMEOUT_MULTIPLIER: 2
+
+fedora-x86_64:
   stage: build
+  except:
+    - tags
+  variables:
+    CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
   script:
-    - meson --prefix /usr --libdir /usr/lib64 --buildtype debug --werror -Dsystemtap=true -Ddtrace=true _build .
-    - cd _build
-    - ninja
-    - meson test
+    - meson --buildtype debug --werror -Dsystemtap=true -Ddtrace=true -Dfam=true _build .
+    - ninja -C _build
+    - mkdir -p _coverage
+    - lcov --rc lcov_branch_coverage=1 --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
+    - meson test -C _build --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER}
+    - lcov --rc lcov_branch_coverage=1 --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
+  artifacts:
+    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
+    when: always
+    paths:
+      - "_build/meson-logs"
+      - "_coverage"
+
+.cross-template: &cross-template
+  stage: build
   except:
     - tags
   artifacts:
-    when: on_failure
-    name: "glib-_${CI_COMMIT_REF_NAME}"
+    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 --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=gnu -Dinternal_pcre=true --buildtype debug _build
+    - ninja -C _build
+
+cross-android_api28_arm64:
+  <<: *cross-template
+  script:
+    # FIXME: add --werror
+    - meson --cross-file=/opt/cross_file_android_arm64_28.txt -Dinternal_pcre=true --buildtype debug _build
+    - ninja -C _build
+
+cross-mingw64:
+  <<: *cross-template
+  script:
+    # FIXME: Add --werror
+    - meson --cross-file=/opt/cross_file_mingw64.txt --buildtype debug _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:
+  when: manual
+  stage: build
+  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 -Db_lundef=false -Diconv=gnu -Dxattr=false --buildtype debug _build
+    - ninja -C _build
+    - meson test -C _build --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}"
+  # FIXME: Remove this when we have a stable FreeBSD runner
+  # https://gitlab.gnome.org/Infrastructure/GitLab/issues/286
+  allow_failure: true
+  except:
+    - tags
+  artifacts:
+    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
+    when: always
+    paths:
+      - "_build/meson-logs"
+
+coverage:
+  stage: coverage
+  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:
-      - "${CI_PROJECT_DIR}/_build/meson-logs"
+      - public
 
 dist-job:
   stage: build
   only:
     - tags
   script:
-    - meson --prefix /usr --libdir /usr/lib64 --buildtype release -Dgtk_doc=true -Dman=true _build .
+    - meson --buildtype release -Dgtk_doc=true -Dman=true _build
     - cd _build
     - ninja dist
-    - ninja glib-doc
+    - 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