Merge "Fix crashes in various GParamSpec creation functions" into tizen
[platform/upstream/glib.git] / .gitlab-ci.yml
index 3b6f44e..bd10823 100644 (file)
@@ -4,25 +4,33 @@ stages:
   - coverage
   - analysis
   - deploy
+  - report
 
 cache:
   paths:
     - _ccache/
 
 variables:
-  FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v19"
+  FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v20"
   COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7"
-  DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v13"
-  MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v9"
-  MESON_TEST_TIMEOUT_MULTIPLIER: 2
+  DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v14"
+  MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v10"
+  MESON_TEST_TIMEOUT_MULTIPLIER: 4
   G_MESSAGES_DEBUG: all
   MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings"
 
+# Default CI job setup; contrast with `.only-origin`.
+#
+# Don’t execute the pipeline when a merge request is merged into `main`, as it
+# will have already been tested
 .only-default:
   only:
     - branches
   except:
-    - tags
+    refs:
+      - tags
+    variables:
+      - $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
 
 # Some jobs run on CI runners which don’t have good isolation between CI jobs,
 # and don’t have much available resource. Limit those jobs to only ones on the
@@ -48,17 +56,46 @@ variables:
     - bash .gitlab-ci/show-execution-environment.sh
     - cp -r $HOME/subprojects/* subprojects/
 
-style-check-diff:
+# FIXME: Work around https://gitlab.com/gitlab-org/gitlab/-/issues/391756
+.only-default-with-git:
   extends: .only-default
+  before_script:
+   - rm -rf subprojects/gvdb
+   - git submodule update --init --depth 1
+  variables:
+    GIT_SUBMODULE_STRATEGY: "none"
+    GIT_SUBMODULE_DEPTH: 1
+
+style-check-advisory:
+  extends: .only-default-with-git
   image: $DEBIAN_IMAGE
   stage: style-check
   allow_failure: true
   script:
     - .gitlab-ci/run-style-check-diff.sh
+    - .gitlab-ci/run-check-todos.sh
+
+sh-and-py-check:
+  extends: .only-default
+  image: $DEBIAN_IMAGE
+  stage: style-check
+  allow_failure: false
+  script:
     - .gitlab-ci/run-shellcheck.sh
     - .gitlab-ci/run-black.sh
     - .gitlab-ci/run-flake8.sh
-    - .gitlab-ci/run-check-todos.sh
+  only:
+    changes:
+      - "**/*.py"
+      - "**/*.sh"
+
+style-check-mandatory:
+  extends: .only-default-with-git
+  image: $DEBIAN_IMAGE
+  stage: style-check
+  allow_failure: false
+  script:
+    - .gitlab-ci/run-reuse.sh
 
 fedora-x86_64:
   extends:
@@ -70,7 +107,7 @@ fedora-x86_64:
   variables:
     CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
   script:
-    - meson ${MESON_COMMON_OPTIONS}
+    - meson setup ${MESON_COMMON_OPTIONS}
             --werror
             --default-library=both
             --prefix=$HOME/glib-installed
@@ -81,19 +118,20 @@ fedora-x86_64:
             -Dinstalled_tests=true
             -Dgtk_doc=true
             _build
-    - ninja -C _build
+    - meson compile -C _build
     - mkdir -p _coverage
     - lcov --config-file .lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
     - .gitlab-ci/run-tests.sh
     - lcov --config-file .lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
     paths:
-      - "_build/docs/reference/"
       - "_build/config.h"
       - "_build/glib/glibconfig.h"
       - "_build/meson-logs"
@@ -116,7 +154,7 @@ debian-stable-x86_64:
   stage: build
   needs: []
   script:
-    - meson ${MESON_COMMON_OPTIONS}
+    - meson setup ${MESON_COMMON_OPTIONS}
             --werror
             --default-library=both
             --prefix=$HOME/glib-installed
@@ -124,13 +162,14 @@ debian-stable-x86_64:
             --libdir=lib
             -Dsystemtap=true
             -Ddtrace=true
-            -Dinstalled_tests=true
             _build
-    - ninja -C _build
+    - meson compile -C _build
     - .gitlab-ci/run-tests.sh
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
@@ -148,15 +187,15 @@ installed-tests:
   needs: []
   script:
     # dtrace is disabled because it breaks the static-link.py test
-    - meson ${MESON_COMMON_OPTIONS}
+    - meson setup ${MESON_COMMON_OPTIONS}
             --werror
             --prefix=/usr --libdir=/usr/lib64
             -Dinstalled_tests=true
             -Ddefault_library=both
             -Ddtrace=false
             _build
-    - ninja -C _build
-    - sudo ninja -C _build install
+    - meson compile -C _build
+    - sudo meson install -C _build
     # Remove old headers, possibly present in current installation
     - sudo rm -f /usr/include/glib-2.0/glib/gurifuncs.h
     - sudo chown -R `id -un`:`id -gn` _build/
@@ -185,18 +224,20 @@ G_DISABLE_ASSERT:
   stage: build
   needs: []
   script:
-    - meson ${MESON_COMMON_OPTIONS}
+    - meson setup ${MESON_COMMON_OPTIONS}
             --werror
             -Dsystemtap=true
             -Ddtrace=true
             -Dinstalled_tests=true
             -Dglib_assert=false
             _build
-    - ninja -C _build
+    - meson compile -C _build
     - bash -x ./.gitlab-ci/run-tests.sh
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
@@ -215,22 +256,19 @@ valgrind:
   variables:
     MESON_TEST_TIMEOUT_MULTIPLIER: 15
   script:
-    - meson ${MESON_COMMON_OPTIONS}
+    - meson setup ${MESON_COMMON_OPTIONS}
             --werror
             -Dsystemtap=true
             -Ddtrace=true
             -Dinstalled_tests=true
             _build
-    - ninja -C _build
+    - meson compile -C _build
     # Valgrind doesn’t work when the soft FD limit is set too high
     # See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2710
     - ulimit -Sn 1024
     - bash -x ./.gitlab-ci/run-tests.sh
                  --setup valgrind
                  --no-suite slow
-  # FIXME: Remove this when we have zero valgrind leaks.
-  # https://gitlab.gnome.org/GNOME/glib/issues/333
-  allow_failure: true
   artifacts:
     reports:
       junit: "_build/meson-logs/testlog-valgrind.junit.xml"
@@ -260,21 +298,25 @@ cross-android_arm64:
   image: $FEDORA_IMAGE
   script:
     # FIXME: add --werror
-    - meson ${MESON_COMMON_OPTIONS} --cross-file=.gitlab-ci/cross_file_android_arm64_31.txt _build
-    - ninja -C _build
+    - meson setup ${MESON_COMMON_OPTIONS} --cross-file=.gitlab-ci/cross_file_android_arm64_31.txt _build
+    - meson compile -C _build
 
 cross-mingw64:
   extends:
     - .cross-build-linux
     - .only-default
   image: $MINGW_IMAGE
+  variables:
+    PYTHONUTF8: "1"
   script:
     # FIXME: Add --werror
-    - meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build
-    - ninja -C _build
+    - meson setup ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build
+    - meson compile -C _build
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
@@ -295,13 +337,21 @@ msys2-mingw32:
   variables:
     MSYSTEM: "MINGW32"
     CHERE_INVOKING: "yes"
+    CFLAGS: -coverage -ftest-coverage -fprofile-arcs
+    PYTHONUTF8: "1"
+    # FIXME: For some reason enabling jit debugging "fixes" random python crashes
+    # see https://github.com/msys2/MINGW-packages/issues/11864 and
+    # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3280#note_1678973
+    MSYS: "winjitdebug"
   script:
     - C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
     - C:\msys64\usr\bin\bash .gitlab-ci/show-execution-environment.sh
     - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
@@ -309,12 +359,41 @@ msys2-mingw32:
       - _build/meson-logs
       - _coverage/
 
+msys2-clang64:
+  extends: .only-schedules
+  stage: build
+  tags:
+    - win32-ps
+  needs: []
+  variables:
+    MSYSTEM: "CLANG64"
+    CHERE_INVOKING: "yes"
+    PYTHONUTF8: "1"
+    # FIXME: For some reason enabling jit debugging "fixes" random python crashes
+    # see https://github.com/msys2/MINGW-packages/issues/11864 and
+    # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3280#note_1678973
+    MSYS: "winjitdebug"
+  script:
+    - C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
+    - C:\msys64\usr\bin\bash .gitlab-ci/show-execution-environment.sh
+    - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
+  artifacts:
+    reports:
+      junit: "_build/meson-logs/testlog.junit.xml"
+    name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
+    when: always
+    expire_in: 1 week
+    paths:
+      - _build/meson-logs
+
 vs2017-x64:
   extends: .only-default
   stage: build
   tags:
     - win32-ps
   needs: []
+  variables:
+    PYTHONUTF8: "1"
   script:
     # FIXME: These should use --wrap-mode=nodownload but the Windows CI machines
     # aren’t currently set up for that.
@@ -324,7 +403,9 @@ vs2017-x64:
                                --python.purelibdir=C:\Python37\site-packages
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
@@ -342,6 +423,8 @@ vs2017-x64-static:
   tags:
     - win32-ps
   needs: []
+  variables:
+    PYTHONUTF8: "1"
   script:
     # FIXME: These should use --wrap-mode=nodownload but the Windows CI machines
     # aren’t currently set up for that.
@@ -352,7 +435,9 @@ vs2017-x64-static:
                                --python.purelibdir=C:\Python37\site-packages
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
@@ -389,12 +474,14 @@ freebsd-12-x86_64:
     # FreeBSD supports xattr, but its API is different from Linux xattr.
     # FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
     # localstatedir is needed for access to /var/lib/dbus/machine-id
-    - meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
-    - ninja -C _build
+    - meson setup ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
+    - meson compile -C _build
     - bash -x ./.gitlab-ci/run-tests.sh
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
@@ -416,12 +503,14 @@ freebsd-13-x86_64:
   before_script:
     - bash .gitlab-ci/show-execution-environment.sh
   script:
-    - meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
-    - ninja -C _build
+    - meson setup ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
+    - meson compile -C _build
     - bash -x ./.gitlab-ci/run-tests.sh
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
@@ -430,38 +519,55 @@ freebsd-13-x86_64:
       - "_build/glib/glibconfig.h"
       - "_build/meson-logs"
 
-macos:
+macos-x86_64:
   extends: .only-origin
   stage: build
   tags:
-    - macos
+    - macosintel
   needs: []
+  cache: []
   variables:
     GIT_SUBMODULE_STRATEGY: normal
+    # -Wno-overlength-strings
     # libpcre2 gets built as a subproject, but the default Clang options on
     # macOS limit string lengths to 4095B — pcre2_error.c has a string of length
     # 4380B
-    CFLAGS: '-Wno-overlength-strings'
+    CFLAGS: "-Wno-overlength-strings"
+    # redirect to the runner's volatile temporary directory
+    TMPDIR: /Users/Shared/work/tmp
+    # keep the user profile clean
+    PIP_CACHE_DIR: /Users/Shared/build/cache
+    PIPENV_CACHE_DIR: $PIP_CACHE_DIR
+    PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
+    # target OS X 10.9 Mavericks for backward compatibility
+    SDKROOT: /opt/sdks/MacOSX10.9.sdk
+    # use the runner's ccache directory
+    CCACHE_DIR: /Users/Shared/work/ccache
   before_script:
     - bash .gitlab-ci/show-execution-environment.sh
-    - pip3 install --user meson==0.60.1
-    - pip3 install --user ninja
-    - export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
+    - python3 -m venv .venv
+    - ln -s /opt/cmake/CMake.app/Contents/bin/cmake .venv/bin
+    - ln -s /opt/ccache/ccache .venv/bin
+    - source .venv/bin/activate
+    - pip3 install meson==1.2.0
+    - pip3 install ninja==1.11.1
   script:
     # FIXME: Use --wrap-mode=default so we download dependencies each time,
     # until the macOS runner is a VM where we can use a pre-made image which
     # already contains the dependencies. See:
     #  - https://gitlab.gnome.org/GNOME/glib/merge_requests/388
     #  - https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/225
-    - meson ${MESON_COMMON_OPTIONS}
+    - meson setup ${MESON_COMMON_OPTIONS}
             --wrap-mode=default
             --werror
             _build
-    - ninja -C _build
+    - meson compile -C _build
     - .gitlab-ci/run-tests.sh
   artifacts:
     reports:
-      junit: "_build/meson-logs/testlog.junit.xml"
+      junit:
+        - _build/meson-logs/testlog.junit.xml
+        - _build/meson-logs/testlog-*.junit.xml
     name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
     when: always
     expire_in: 1 week
@@ -500,7 +606,7 @@ scan-build:
   stage: analysis
   needs: []
   script:
-    - meson ${MESON_COMMON_OPTIONS}
+    - meson setup ${MESON_COMMON_OPTIONS}
             --werror
             --default-library=both
             --prefix=$HOME/glib-installed
@@ -518,7 +624,7 @@ scan-build:
     paths:
       - "_scan_build/meson-logs/scanbuild"
 
-coverity:
+.coverity:
   extends:
     - .build-linux
     - .only-schedules
@@ -529,7 +635,7 @@ coverity:
     # cov-build doesn’t like GLIB_DEPRECATED_ENUMERATOR
     CFLAGS: '-DGLIB_DISABLE_DEPRECATION_WARNINGS'
   script:
-    - meson ${MESON_COMMON_OPTIONS}
+    - meson setup ${MESON_COMMON_OPTIONS}
             --werror
             --default-library=both
             --prefix=$HOME/glib-installed
@@ -539,7 +645,7 @@ coverity:
             -Ddtrace=true
             -Dinstalled_tests=true
             _coverity_build
-    - $HOME/cov-analysis-linux64-*/bin/cov-build --dir cov-int ninja -C _coverity_build
+    - $HOME/cov-analysis-linux64-*/bin/cov-build --dir cov-int meson compile -C _coverity_build
     - tar cfz cov-int.tar.gz cov-int
     - curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
            --form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
@@ -553,10 +659,9 @@ coverity:
       - "cov-int/build-log.txt"
 
 pages:
+  extends: .only-schedules
   stage: deploy
-  only:
-    - main
-  needs: ['coverage', 'style-check-diff']
+  needs: ['coverage', 'style-check-advisory']
   script:
     - mv _coverage/ public/
   artifacts:
@@ -574,10 +679,9 @@ dist-job:
     - git submodule update --init
     - for m in $(git submodule foreach -q 'echo $path'); do git config --global --add safe.directory "${PWD}/${m}"; done
     - meson subprojects download
-    - meson ${MESON_COMMON_OPTIONS} --buildtype release -Dgtk_doc=true -Dman=true _build
-    - cd _build
-    - ninja dist
-    - ninja glib-doc gobject-doc gio-doc
+    - meson setup ${MESON_COMMON_OPTIONS} --buildtype release -Dgtk_doc=true -Dman=true _build
+    - meson dist -C _build
+    - ninja -C _build glib-doc gobject-doc gio-doc
     - tar -c -J -f "glib-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/glib html
     - tar -c -J -f "gobject-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gobject html
     - tar -c -J -f "gio-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gio html
@@ -587,3 +691,11 @@ dist-job:
       - "${CI_PROJECT_DIR}/_build/gobject-docs-$CI_COMMIT_TAG.tar.xz"
       - "${CI_PROJECT_DIR}/_build/gio-docs-$CI_COMMIT_TAG.tar.xz"
       - "${CI_PROJECT_DIR}/_build/meson-dist/glib-*.tar.xz"
+
+issue-bot:
+  stage: report
+  image: registry.gitlab.com/gitlab-org/distribution/issue-bot:latest
+  script: /issue-bot
+  rules:
+    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule"
+      when: on_failure