summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2021-05-22 20:16:46 +0200
committerJens Georg <mail@jensge.org>2021-05-22 20:16:46 +0200
commitbd58180f02066f51e4b08834e60711e312457aa0 (patch)
treece627d209286186dbd1dc43213e2be0cef974db9
parente7f983760588668bdf80c7f2b1e22ea4de41a177 (diff)
downloadgupnp-bd58180f02066f51e4b08834e60711e312457aa0.tar.gz
CI: Enable CI build
-rw-r--r--.gitlab-ci.yml187
-rw-r--r--libgupnp/meson.build12
-rw-r--r--meson.build8
-rw-r--r--subprojects/gssdp-1.2.wrap8
-rw-r--r--vala/meson.build13
5 files changed, 220 insertions, 8 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..62374c4
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,187 @@
+include:
+ - remote: "https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/ci-fairy.yml"
+ - remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/fedora.yml'
+
+variables:
+ MESON_TEST_TIMEOUT_MULTIPLIER: 3
+
+stages:
+ - review
+ - prepare
+ - build
+ - test
+ - analysis
+ - website
+
+.check-template: &check
+ extends:
+ - .fdo.ci-fairy
+ artifacts:
+ expire_in: 1 week
+ paths:
+ - check-junit-report.xml
+ reports:
+ junit: check-junit-report.xml
+
+check-commit-log:
+ variables:
+ GIT_DEPTH: "100"
+ stage: review
+ script:
+ - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
+ then
+ ci-fairy check-commits --junit-xml=check-junit-report.xml ;
+ else
+ echo "Not a merge request" ;
+ fi
+ <<: *check
+
+check-merge-request:
+ variables:
+ GIT_STRATEGY: none
+ stage: review
+ script:
+ - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
+ then
+ ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-junit-report.xml ;
+ else
+ echo "Not a merge request" ;
+ fi
+ <<: *check
+
+.build-template: &build
+ stage: build
+ script:
+ - meson . build --prefix=/usr -Db_coverage=true
+ - ninja -C build
+ artifacts:
+ expire_in: 1 day
+ paths:
+ - build
+
+.gupnp.fedora@common:
+ variables:
+ BASE_TAG: '2021-05-22.2'
+ FDO_UPSTREAM_REPO: GNOME/gupnp
+ FDO_DISTRIBUTION_PACKAGES: 'clang clang-analyzer gcovr git libasan libubsan python3-gobject python3-pip xmlto gobject-introspection-devel gtk-doc libsoup-devel libuuid-devel libxml2-devel vala ninja-build'
+ FDO_DISTRIBUTION_EXEC: |
+ dnf clean all &&
+ pip3 install meson
+
+.gupnp.fedora:34@x86_64:
+ extends: .gupnp.fedora@common
+ variables:
+ FDO_DISTRIBUTION_VERSION: 34
+ FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
+
+build-fedora-container@x86_64:
+ extends:
+ - .fdo.container-build@fedora
+ - .gupnp.fedora:34@x86_64
+ stage: prepare
+ variables:
+ GIT_STRATEGY: none
+
+
+build-fedora@x86_64:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnp.fedora:34@x86_64
+ needs:
+ - build-fedora-container@x86_64
+ <<: *build
+
+
+.test-template: &test
+ stage: test
+ variables:
+ G_SLICE: "always-malloc"
+ MALLOC_CHECK_: "3"
+ script:
+ - cd build
+ - |
+ # Remove the many "CI_" variables from the environment. Meson dumps the
+ # whole environment for every failed test, and that gives a whole
+ # screenful of junk each time unless we strip these.
+ unset $(env|grep -o '^CI_[^=]*')
+ env LANG=C.UTF-8 LC_ALL=C.UTF-8 meson test --print-errorlogs ${MESON_TEST_EXTRA_ARGS}
+ after_script:
+ - |
+ echo "Distribution: "
+ echo
+ egrep '^NAME=|^VERSION=' /etc/os-release
+ echo
+ echo "Test suite settings:"
+ echo
+ echo "G_MESSAGES_DEBUG: ${G_MESSAGES_DEBUG}"
+ echo "MESON_TEST_EXTRA_ARGS: ${MESON_TEST_EXTRA_ARGS}"
+ echo
+ echo "These values can be set at https://gitlab.gnome.org/GNOME/gupnp/pipelines/new"
+ artifacts:
+ expire_in: 1 day
+ when: always
+ paths:
+ - build
+ reports:
+ junit: "build/meson-logs/testlog.junit.xml"
+
+test-fedora@x86_64:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnp.fedora:34@x86_64
+ needs:
+ - build-fedora@x86_64
+ <<: *test
+
+coverage-analysis:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnp.fedora:34@x86_64
+ stage: analysis
+ allow_failure: true
+ script:
+ - cd build
+ - mkdir -p coveragereport
+ - gcovr --html-details --print-summary --root=.. --exclude=../build --exclude=../docs/reference --exclude=../tests --exclude=../tools --exclude=../examples --output coveragereport/index.html
+ coverage: '/^lines: (\d+\.\d+\%)/'
+ artifacts:
+ when: always
+ paths:
+ - build/coveragereport
+ needs:
+ - test-fedora@x86_64
+
+static-scan:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnp.fedora:34@x86_64
+ stage: analysis
+ needs:
+ - build-fedora-container@x86_64
+ script:
+ - meson --buildtype=debug _scan_build
+ - ninja -C _scan_build scan-build
+ artifacts:
+ paths:
+ - _scan_build/meson-logs
+ allow_failure: true
+
+pages:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .gupnp.fedora:34@x86_64
+ stage: website
+ script:
+ - meson doc-build -Dgtk_doc=true
+ - ninja -C doc-build gupnp-doc
+ - mkdir -p public
+ - mv doc-build/doc/html public/docs
+ artifacts:
+ paths:
+ - public
+ needs:
+ - build-fedora-container@x86_64
+ only:
+ - master
+ - /^wip\/.*\/ci.*$/
+
diff --git a/libgupnp/meson.build b/libgupnp/meson.build
index fb0f77d..8a976c1 100644
--- a/libgupnp/meson.build
+++ b/libgupnp/meson.build
@@ -117,16 +117,22 @@ gupnp = declare_dependency(
)
pkg.generate(
- libraries : libgupnp,
+ libgupnp,
subdirs: 'gupnp-1.2',
name : 'gupnp-1.2',
- requires : dependencies,
+ requires : ['glib-2.0', 'gio-2.0', 'gssdp-1.2'],
description : 'GObject-based UPnP library',
version : meson.project_version(),
filebase : 'gupnp-1.2'
)
if get_option('introspection')
+ gir_includes = ['GObject-2.0', 'Gio-2.0', 'Soup-2.4', 'libxml2-2.0']
+ if gssdp_dep.type_name() == 'internal'
+ gir_includes += subproject('gssdp-1.2').get_variable('gir').get(0)
+ else
+ gir_includes += 'GSSDP-1.2'
+ endif
gir = gnome.generate_gir(
libgupnp,
sources : headers + sources + enums,
@@ -136,7 +142,7 @@ if get_option('introspection')
symbol_prefix : 'gupnp',
identifier_prefix : 'GUPnP',
export_packages : 'gupnp-1.2',
- includes : ['GObject-2.0', 'Gio-2.0', 'Soup-2.4', 'GSSDP-1.2', 'libxml2-2.0'],
+ includes : gir_includes,
install : true,
extra_args : '-DGOBJECT_INTROSPECTION_SKIP'
)
diff --git a/meson.build b/meson.build
index bf9a49d..0aa3fe3 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('gupnp', 'c', version : '1.2.4', meson_version : '>= 0.48.0')
+project('gupnp', 'c', version : '1.2.4', meson_version : '>= 0.53.0')
gnome = import('gnome')
pkg = import('pkgconfig')
@@ -14,17 +14,19 @@ conf.set('HAVE_IFADDRS_H', ifaddrs_available)
conf.set('HAVE_LINUX_WIRELESS_H', cc.has_header('linux/wireless.h'))
config_h = configure_file(output : 'config.h', configuration : conf)
-add_global_arguments('-DHAVE_CONFIG_H=1', language : 'c')
+add_project_arguments('-DHAVE_CONFIG_H=1', language : 'c')
guul = subproject('guul', default_options : ['default_library=static'])
+gssdp_dep = dependency('gssdp-1.2', version : '>= 1.2.4', default_options: ['sniffer=false'])
+
dependencies = [
dependency('glib-2.0', version : '>= 2.58'),
dependency('gio-2.0', version : '>= 2.58'),
dependency('gmodule-2.0', version : '>= 2.44'),
dependency('gobject-2.0', version : '>= 2.44'),
- dependency('gssdp-1.2', version : '>= 1.2.3'),
dependency('libsoup-2.4', version : '>= 2.48.0'),
+ gssdp_dep,
dependency('libxml-2.0')
]
diff --git a/subprojects/gssdp-1.2.wrap b/subprojects/gssdp-1.2.wrap
new file mode 100644
index 0000000..34d9b0b
--- /dev/null
+++ b/subprojects/gssdp-1.2.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+url = https://gitlab.gnome.org/GNOME/gssdp.git
+revision = master
+depth = 1
+
+[provides]
+dependency_name = gssdp-1.2
+
diff --git a/vala/meson.build b/vala/meson.build
index 2c4106f..aacaa71 100644
--- a/vala/meson.build
+++ b/vala/meson.build
@@ -1,5 +1,14 @@
+if gssdp_dep.type_name() == 'internal'
+ gssdp_vala_package = subproject('gssdp-1.2').get_variable('vapi')
+ gssdp_gir_dirs = subproject('gssdp-1.2').get_variable('gssdp_gir_dir')
+else
+ gssdp_vala_package = 'gssdp-1.2'
+ gssdp_gir_dirs = []
+endif
gnome.generate_vapi('gupnp-1.2',
sources : [gir.get(0), 'gupnp-1.2-custom.vala'],
- packages : ['gssdp-1.2', 'gio-2.0', 'libsoup-2.4', 'libxml-2.0'],
- install : true)
+ packages : [gssdp_vala_package, 'gio-2.0', 'libsoup-2.4', 'libxml-2.0'],
+ gir_dirs : gssdp_gir_dirs,
+ install : true
+)