summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-11-03 11:15:36 +0100
committerThomas Haller <thaller@redhat.com>2018-11-12 11:29:37 +0100
commit763cb8d486de61315da70a54c12fd0daf234ddb0 (patch)
treed739d330b4d0f3769639a8288f0545ade732d69a
parent570c41aae421b6b4817a114eef2cfc18ca21e867 (diff)
downloadNetworkManager-763cb8d486de61315da70a54c12fd0daf234ddb0.tar.gz
ci: use common script for tests on travis and gitlab
For one, it's not unreasonable that we want to run the same tests both for gitlab and travis. Move the actual tests into a script, which is called by both CI environments. We still can do something different, based on the environment. The advantage here is, that the common part will be shared, and the places where we differ can easily be spot. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/44
-rw-r--r--.gitlab-ci.yml42
-rw-r--r--.travis.yml88
-rwxr-xr-xcontrib/scripts/nm-ci-run.sh150
-rwxr-xr-xcontrib/travis/travis-check.sh27
4 files changed, 164 insertions, 143 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 33c95bd957..700cb3d35b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,6 +11,8 @@ stages:
.fedora_install: &fedora_install
before_script:
- NM_INSTALL="dnf install -y" ./contrib/fedora/REQUIRED_PACKAGES
+ - dnf install -y glibc-langpack-pl
+ - locale -a
checkpatch:
image: fedora:28
@@ -24,45 +26,25 @@ checkpatch:
paths:
- checkpatch-out.txt
-f28_build_default:
+f28_build_autotools:
<<: *fedora_install
image: fedora:28
stage: test
script:
- - dnf install -y glibc-langpack-pl
- - locale -a
- - NOCONFIGURE=1 ./autogen.sh
- - mkdir ./build
- - cd ./build
- - ../configure
- --prefix="$PWD/INST"
- --enable-gtk-doc=yes
- --with-systemd-logind=yes
- --enable-more-warnings=error
- --enable-tests=yes
- --with-crypto=gnutls
- --with-libnm-glib=yes
- --with-iwd=yes
- --with-ofono=yes
- --enable-teamdctl=yes
- --with-dhcpcanon=yes
- --with-dhcpcd=yes
- --with-dhclient=yes
- --with-netconfig=/bin/nowhere/netconfig
- --with-resolvconf=/bin/nowhere/resolvconf
- --enable-ifcfg-rh=yes
- --enable-config-plugin-ibft=yes
- --enable-ifupdown=yes
- - make -j 6
- - make install
- - NM_TEST_CLIENT_CHECK_L10N=1 make -j 6 -k check
- - cd ..
+ - CI=gitlab BUILD_TYPE=autotools contrib/scripts/nm-ci-run.sh
- mv build/INST/share/gtk-doc/html docs-html
artifacts:
expire_in: 1 day
paths:
- docs-html
+f28_build_meson:
+ <<: *fedora_install
+ image: fedora:28
+ stage: test
+ script:
+ - CI=gitlab BUILD_TYPE=meson contrib/scripts/nm-ci-run.sh
+
f28_rpm_autotools_dbg:
<<: *fedora_install
image: fedora:28
@@ -80,7 +62,7 @@ f28_rpm_meson_dbg:
pages:
stage: deploy
dependencies:
- - f28_build_default
+ - f28_build_autotools
script:
- mv docs-html public
artifacts:
diff --git a/.travis.yml b/.travis.yml
index c96bb9496a..6dd6ae0491 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -75,94 +75,10 @@ before_install:
popd
fi
- sudo chmod o+x /usr/sbin/pppd
+ - sudo locale-gen pl_PL.UTF-8
script:
- - |
- if test "$BUILD_TYPE" == 'meson'; then
- if [ "$CC" == gcc ]; then
- CRYPTO=nss
- else
- CRYPTO=gnutls
- fi &&
- meson build \
- \
- -D ld_gc=false \
- -D session_tracking=no \
- -D systemdsystemunitdir=no \
- -D systemd_journal=false \
- -D selinux=false \
- -D libaudit=no \
- -D libpsl=false \
- -D vapi=false \
- -D introspection=false \
- -D qt=false \
- -D crypto=$CRYPTO \
- -D docs=false \
- \
- -D libnm_glib=true \
- -D iwd=true \
- -D ofono=true \
- -D teamdctl=false \
- \
- -D dhclient=/bin/nowhere/dhclient \
- -D dhcpcanon=/bin/nowhere/dhcpcanon \
- -D dhcpcd=/bin/nowhere/dhcpd \
- \
- -D netconfig=/bin/nowhere/netconfig \
- -D resolvconf=/bin/nowhere/resolvconf \
- \
- -D ifcfg_rh=false \
- -D ibft=true \
- -D ifupdown=true \
- &&
- ninja -C build &&
- ninja -C build test
- fi
- - |
- if test "$BUILD_TYPE" == 'autotools'; then
- if [ "$CC" == gcc ]; then
- CRYPTO=gnutls
- else
- CRYPTO=nss
- fi &&
- git clean -fdx &&
- NOCONFIGURE=1 ./autogen.sh &&
- mkdir ./build &&
- pushd ./build &&
- ../configure \
- --prefix="$PWD/INST" \
- --enable-gtk-doc=yes \
- --with-systemd-logind=no \
- --enable-more-warnings=no \
- --enable-tests=yes \
- --with-crypto=$CRYPTO \
- \
- --with-libnm-glib=yes \
- --with-iwd=yes \
- --with-ofono=yes \
- --enable-teamdctl=no \
- \
- --with-dhcpcanon=yes \
- --with-dhcpcd=yes \
- --with-dhclient=yes \
- \
- --with-netconfig=/bin/nowhere/netconfig \
- --with-resolvconf=/bin/nowhere/resolvconf \
- \
- --enable-ifcfg-rh=yes \
- --enable-config-plugin-ibft=yes \
- --enable-ifupdown=yes \
- &&
- make -j4 &&
- if [ "$CC" == gcc ]; then
- sudo locale-gen pl_PL.UTF-8 &&
- sudo make install &&
- NM_TEST_CLIENT_CHECK_L10N=1 ../contrib/travis/travis-check.sh
- else
- ../contrib/travis/travis-check.sh
- fi &&
- popd
- fi
+ - CI=travis contrib/scripts/nm-ci-run.sh
env:
matrix:
diff --git a/contrib/scripts/nm-ci-run.sh b/contrib/scripts/nm-ci-run.sh
new file mode 100755
index 0000000000..ca98d8965f
--- /dev/null
+++ b/contrib/scripts/nm-ci-run.sh
@@ -0,0 +1,150 @@
+#!/bin/bash
+
+set -exv
+
+die() {
+ printf "%s\n" "$@"
+ exit 1
+}
+
+###############################################################################
+
+if [ "$BUILD_TYPE" == meson ]; then
+ _TRUE=true
+ _FALSE=false
+elif [ "$BUILD_TYPE" == autotools ]; then
+ _TRUE=yes
+ _FALSE=no
+else
+ die "invalid BUILD_TYPE \"$BUILD_TYPE\""
+fi
+
+_WITH_CRYPTO="gnutls"
+_WITH_MORE_WARNINGS="error"
+_WITH_LIBTEAM="$_TRUE"
+_WITH_DOCS="$_TRUE"
+_WITH_SYSTEMD_LOGIND="$_TRUE"
+if [ "$CI" == travis ]; then
+ _WITH_MORE_WARNINGS="no"
+ _WITH_LIBTEAM="$_FALSE"
+ _WITH_DOCS="$_FALSE"
+ _WITH_SYSTEMD_LOGIND="$_FALSE"
+fi
+if [ "$CI" == gitlab ]; then
+ :
+fi
+if [ "$CC" != gcc ]; then
+ _WITH_CRYPTO=nss
+fi
+
+###############################################################################
+
+_autotools_test_print_logs() {
+ echo ">>>> PRINT TEST LOGS $1 (start)"
+ cat test-suite.log
+ echo ">>>> PRINT TEST LOGS $1 (done)"
+}
+
+run_autotools() {
+ NOCONFIGURE=1 ./autogen.sh
+ mkdir ./build
+ pushd ./build
+ ../configure \
+ --prefix="$PWD/INST" \
+ --enable-introspection=$_WITH_DOCS \
+ --enable-gtk-doc=$_WITH_DOCS \
+ --with-systemd-logind=$_WITH_SYSTEMD_LOGIND \
+ --enable-more-warnings=$_WITH_MORE_WARNINGS \
+ --enable-tests=yes \
+ --with-crypto=$_WITH_CRYPTO \
+ \
+ --with-libnm-glib=yes \
+ --with-iwd=yes \
+ --with-ofono=yes \
+ --enable-teamdctl=$_WITH_LIBTEAM \
+ \
+ --with-dhcpcanon=yes \
+ --with-dhcpcd=yes \
+ --with-dhclient=yes \
+ \
+ --with-netconfig=/bin/nowhere/netconfig \
+ --with-resolvconf=/bin/nowhere/resolvconf \
+ \
+ --enable-ifcfg-rh=yes \
+ --enable-config-plugin-ibft=yes \
+ --enable-ifupdown=yes \
+ \
+ #end
+
+ make -j 6
+ make install
+
+ export NM_TEST_CLIENT_CHECK_L10N=1
+
+ if [ "$CI" == travis ]; then
+ # travis is known to generate the settings doc differently.
+ # Don't compare.
+ export NMTST_NO_CHECK_SETTINGS_DOCS=yes
+ fi
+
+ if ! make check -j 6 -k ; then
+
+ _autotools_test_print_logs "first-test"
+
+ echo ">>>> RUN SECOND TEST (start)"
+ NMTST_DEBUG=TRACE,no-expect-message make check -k || :
+ echo ">>>> RUN SECOND TEST (done)"
+
+ _autotools_test_print_logs "second-test"
+ die "test failed"
+ fi
+ popd
+}
+
+###############################################################################
+
+run_meson() {
+ meson build \
+ \
+ -D ld_gc=false \
+ -D session_tracking=no \
+ -D systemdsystemunitdir=no \
+ -D systemd_journal=false \
+ -D selinux=false \
+ -D libaudit=no \
+ -D libpsl=false \
+ -D vapi=false \
+ -D introspection=$_WITH_DOCS \
+ -D qt=false \
+ -D crypto=$_WITH_CRYPTO \
+ -D docs=$_WITH_DOCS \
+ \
+ -D libnm_glib=true \
+ -D iwd=true \
+ -D ofono=true \
+ -D teamdctl=$_WITH_LIBTEAM \
+ \
+ -D dhclient=/bin/nowhere/dhclient \
+ -D dhcpcanon=/bin/nowhere/dhcpcanon \
+ -D dhcpcd=/bin/nowhere/dhcpd \
+ \
+ -D netconfig=/bin/nowhere/netconfig \
+ -D resolvconf=/bin/nowhere/resolvconf \
+ \
+ -D ifcfg_rh=false \
+ -D ibft=true \
+ -D ifupdown=true \
+ \
+ #end
+
+ ninja -C build
+ ninja -C build test
+}
+
+###############################################################################
+
+if [ "$BUILD_TYPE" == autotools ]; then
+ run_autotools
+elif [ "$BUILD_TYPE" == meson ]; then
+ run_meson
+fi
diff --git a/contrib/travis/travis-check.sh b/contrib/travis/travis-check.sh
deleted file mode 100755
index ee9fdee535..0000000000
--- a/contrib/travis/travis-check.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-set -ev
-
-print_test_logs() {
- echo ">>>> PRINT TEST LOGS $1 (start)"
- cat test-suite.log
- echo ">>>> PRINT TEST LOGS $1 (done)"
-}
-
-# travis is known to generate the settings doc differently.
-# Don't compare.
-export NMTST_NO_CHECK_SETTINGS_DOCS=yes
-
-if ! make check -j 4 -k ; then
-
- print_test_logs "first-test"
-
- echo ">>>> RUN SECOND TEST (start)"
- NMTST_DEBUG=TRACE,no-expect-message make check -k || :
- echo ">>>> RUN SECOND TEST (done)"
-
- print_test_logs "second-test"
-
- exit 57
-fi
-