From b424e9e620d3fdd30761f528ab1ab14113be01ab Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 4 May 2021 21:35:11 +0200 Subject: Travis CI: Initial draft for CI builds. --- .build.yml | 234 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 43 +++++++++++ 2 files changed, 277 insertions(+) create mode 100644 .build.yml create mode 100644 .travis.yml diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..adbfac0 --- /dev/null +++ b/.build.yml @@ -0,0 +1,234 @@ +######################################################### +# THE FOLLOWING LINES IS USED BY docker-build +########################################################## +requires: + archlinux: + # Useful URL: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ayatana-indicator-sound + - clang + - gcc + - git + - make + - startup-notification + - which + - cmake + - cmake-extras + - mate-common + - dbus + - accountsservice + - gsettings-desktop-schemas + - intltool + - vala + - glib2 + - libpulse + - libnotify + - libgee + - libxml2 + - pulseaudio + - qt5-base + - qt5-declarative + - systemd + - gobject-introspection + + debian: + # Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-indicator-sound + - autopoint + - clang + - clang-tools + - g++ + - cppcheck + - git + - cmake + - cmake-extras + - mate-common + - dbus + - gir1.2-accountsservice-1.0 + - intltool + - valac + - libaccountsservice-dev + - libgirepository1.0-dev + - libglib2.0-dev + - liblomiri-api-dev + - liblomiri-url-dispatcher-dev + - libpulse-dev + - libpulse-mainloop-glib0 + - libnotify-dev + - libgee-0.8-dev + - libxml2-dev + - pulseaudio + - qtbase5-dev + - qtbase5-dev-tools + - qtdeclarative5-dev + - qtdeclarative5-dev-tools + - systemd + - dbus-test-runner + - libgtest-dev + - libdbustest1-dev + - libqtdbusmock1-dev + - libqtdbustest1-dev + - python3-dbusmock + + debian:stable: + - autopoint + - clang + - clang-tools + - g++ + - cppcheck + - git + - cmake + - cmake-extras + - mate-common + - dbus + - gir1.2-accountsservice-1.0 + - intltool + - valac + - libaccountsservice-dev + - libgirepository1.0-dev + - libglib2.0-dev + - libpulse-dev + - libpulse-mainloop-glib0 + - libnotify-dev + - libgee-0.8-dev + - libxml2-dev + - pulseaudio + - qtbase5-dev + - qtbase5-dev-tools + - qtdeclarative5-dev + - qtdeclarative5-dev-tools + - systemd + - dbus-test-runner + - libgtest-dev + - libdbustest1-dev + - libqtdbusmock1-dev + - libqtdbustest1-dev + - python3-dbusmock + + ubuntu: + - autopoint + - clang + - clang-tools + - g++ + - git + - cmake + - cmake-extras + - mate-common + - dbus + - gir1.2-accountsservice-1.0 + - intltool + - valac + - libaccountsservice-dev + - libgirepository1.0-dev + - libglib2.0-dev + - liblomiri-api-dev + - liblomiri-url-dispatcher-dev + - libpulse-dev + - libpulse-mainloop-glib0 + - libnotify-dev + - libgee-0.8-dev + - libxml2-dev + - pulseaudio + - qtbase5-dev + - qtbase5-dev-tools + - qtdeclarative5-dev + - qtdeclarative5-dev-tools + - systemd + + ubuntu:focal: + - autopoint + - clang + - clang-tools + - g++ + - git + - cmake + - cmake-extras + - mate-common + - dbus + - gir1.2-accountsservice-1.0 + - intltool + - valac + - libaccountsservice-dev + - libgirepository1.0-dev + - libglib2.0-dev + - libpulse-dev + - libpulse-mainloop-glib0 + - libnotify-dev + - libgee-0.8-dev + - libxml2-dev + - pulseaudio + - qtbase5-dev + - qtbase5-dev-tools + - qtdeclarative5-dev + - qtdeclarative5-dev-tools + - systemd + +variables: + - 'CHECKERS=" + -enable-checker deadcode.DeadStores + -enable-checker alpha.deadcode.UnreachableCode + -enable-checker alpha.core.CastSize + -enable-checker alpha.core.CastToStruct + -enable-checker alpha.core.IdenticalExpr + -enable-checker alpha.core.SizeofPtr + -enable-checker alpha.security.ArrayBoundV2 + -enable-checker alpha.security.MallocOverflow + -enable-checker alpha.security.ReturnPtrRange + -enable-checker alpha.unix.SimpleStream + -enable-checker alpha.unix.cstring.BufferOverlap + -enable-checker alpha.unix.cstring.NotNullTerminated + -enable-checker alpha.unix.cstring.OutOfBounds + -enable-checker alpha.core.FixedAddr + -enable-checker security.insecureAPI.strcpy"' + +before_scripts: + - cd ${START_DIR} + - if [ ! -d libayatana-common-build ]; then + - git clone --depth 1 https://github.com/AyatanaIndicators/libayatana-common.git libayatana-common-build + - fi + - cd libayatana-common-build + - cmake . -DCMAKE_INSTALL_PREFIX=/usr + - make + - make install + +build_scripts: + - if [ ${DISTRO_NAME} == "debian" ];then + - export CFLAGS+=" -Wsign-compare -Wunused-parameter" + - cppcheck --enable=warning,style,performance,portability,information,missingInclude . + - fi + - + - if [ -e ./autogen.sh ]; then + - NOCONFIGURE=1 ./autogen.sh + - scan-build $CHECKERS ./configure --prefix=/usr --enable-gtk-doc --enable-compile-warnings=maximum + - elif [ -e ./CMakeLists.txt ]; then + - if [ ${DISTRO_NAME} == "debian" ];then + - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTS=ON + - else + - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON + - fi + - else + - exit 1 + - fi + - + - if [ $CPU_COUNT -gt 1 ]; then + - if [ ${DISTRO_NAME} == "debian" ];then + - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make -j $CPU_COUNT + - make clean + - fi + - scan-build $CHECKERS --keep-cc -o html-report make -j $CPU_COUNT + - else + - if [ ${DISTRO_NAME} == "debian" ];then + - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make + - make clean + - fi + - scan-build $CHECKERS --keep-cc -o html-report make + - fi + +after_scripts: + - if [ ${BUILD_TYPE} == "scripts" ];then + - XVFB_RUN="$(which xvfb-run || true)" + - if [ ${DISTRO_NAME} == "debian" ];then + - if [ -e ./autogen.sh ]; then + - ${XVFB_RUN} make check + - elif [ -e ./CMakeLists.txt ]; then + - ${XVFB_RUN} env CTEST_OUTPUT_ON_FAILURE=1 make test + - fi + - fi + - fi diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5382638 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,43 @@ +# vim: set ts=2 sts=2 sw=2 expandtab : +dist: bionic +language: shell +os: linux + +arch: + - amd64 + - ppc64le + +services: + - docker + +addons: + apt: + packages: + - python3-pip + - python3-setuptools + +before_install: + # let's use the MATE project's docker build script... + - curl -Ls -o docker-build https://github.com/AyatanaIndicators/ayatana-dev-scripts/raw/master/travis/docker-build + - chmod +x docker-build + +install: + - pip3 install wheel + - pip3 install PyGithub + - ./docker-build --name ${DISTRO} --config .build.yml --install + +script: + - ./docker-build --name ${DISTRO} --verbose --config .build.yml --build scripts + +env: +# temp disable of archlinux builds, see https://gitlab.archlinux.org/archlinux/archlinux-docker/-/issues/56 +# - DISTRO="archlinux:latest" + - DISTRO="debian:testing" + - DISTRO="debian:stable" +# - DISTRO="ubuntu:rolling" + - DISTRO="ubuntu:focal" + +jobs: + exclude: + - env: DISTRO="archlinux:latest" + arch: ppc64le -- cgit v1.2.3 From 7f3ae132dfe690fb8d0559dea0737d67a55fb065 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 4 May 2021 21:37:06 +0200 Subject: .build.yml: Disable unit tests for now during CI builds. Unit tests are entirely broken at the moment for ayatana-indicator-sound. --- .build.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.build.yml b/.build.yml index adbfac0..1ca40ca 100644 --- a/.build.yml +++ b/.build.yml @@ -221,14 +221,14 @@ build_scripts: - scan-build $CHECKERS --keep-cc -o html-report make - fi -after_scripts: - - if [ ${BUILD_TYPE} == "scripts" ];then - - XVFB_RUN="$(which xvfb-run || true)" - - if [ ${DISTRO_NAME} == "debian" ];then - - if [ -e ./autogen.sh ]; then - - ${XVFB_RUN} make check - - elif [ -e ./CMakeLists.txt ]; then - - ${XVFB_RUN} env CTEST_OUTPUT_ON_FAILURE=1 make test - - fi - - fi - - fi +#after_scripts: +# - if [ ${BUILD_TYPE} == "scripts" ];then +# - XVFB_RUN="$(which xvfb-run || true)" +# - if [ ${DISTRO_NAME} == "debian" ];then +# - if [ -e ./autogen.sh ]; then +# - ${XVFB_RUN} make check +# - elif [ -e ./CMakeLists.txt ]; then +# - ${XVFB_RUN} env CTEST_OUTPUT_ON_FAILURE=1 make test +# - fi +# - fi +# - fi -- cgit v1.2.3 From f7d5dfb0dbc170d43e60c5a4e66d297303c37a09 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 4 May 2021 22:23:37 +0200 Subject: debian/rules: Drop -Denable_tests=off option. --- debian/rules | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/rules b/debian/rules index 5a01b3c..593fdf0 100755 --- a/debian/rules +++ b/debian/rules @@ -11,7 +11,6 @@ override_dh_auto_configure: # Debian defines CMAKE_INSTALL_LOCALSTATEDIR as /usr/var, which is wrong. # So until Debian bug 719148 is fixed, do it ourselves. dh_auto_configure -- -DCMAKE_INSTALL_LOCALSTATEDIR="/var" \ - -Denable_tests=off \ $(NULL) override_dh_install: -- cgit v1.2.3 From 0fd84df69e24d5509ae1cb4af51d0b274ce7e57b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 5 Aug 2021 08:25:00 +0200 Subject: tests/CMakeLists.txt: Set '-no-pie' linker option for all unit tests linker calls. --- tests/CMakeLists.txt | 8 ++++++++ tests/integration/CMakeLists.txt | 1 + 2 files changed, 9 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bbb5b84..278da0e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -165,6 +165,7 @@ target_link_libraries (pulse-mock ${PULSEAUDIO_LIBRARIES}) include_directories(${CMAKE_SOURCE_DIR}/src) add_executable (name-watch-test name-watch-test.cc ${CMAKE_SOURCE_DIR}/src/bus-watch-namespace.c) +target_link_options (name-watch-test PRIVATE -no-pie) target_link_libraries (name-watch-test ${SOUNDSERVICE_LIBRARIES} ${GMOCK_LIBRARIES}) add_test(name-watch-test name-watch-test) @@ -174,6 +175,7 @@ add_test(name-watch-test name-watch-test) include_directories(${CMAKE_SOURCE_DIR}/src) add_executable (accounts-service-user-test accounts-service-user.cc) +target_link_options (accounts-service-user-test PRIVATE -no-pie) target_link_libraries ( accounts-service-user-test indicator-sound-service-lib @@ -199,6 +201,7 @@ add_test(accounts-service-user-test-player include_directories(${CMAKE_SOURCE_DIR}/src) add_executable (volume-control-test volume-control-test.cc) add_dependencies (volume-control-test gschemas-compiled) +target_link_options (volume-control-test PRIVATE -no-pie) target_link_libraries ( volume-control-test indicator-sound-service-lib @@ -216,6 +219,7 @@ add_test(volume-control-test volume-control-test) include_directories(${CMAKE_SOURCE_DIR}/src) add_executable (sound-menu-test sound-menu.cc) +target_link_options (sound-menu-test PRIVATE -no-pie) target_link_libraries ( sound-menu-test indicator-sound-service-lib @@ -233,6 +237,7 @@ add_test(sound-menu-test sound-menu-test) include_directories(${CMAKE_SOURCE_DIR}/src) add_executable (notifications-test notifications-test.cc) +target_link_options (notifications-test PRIVATE -no-pie) target_link_libraries ( notifications-test indicator-sound-service-lib @@ -251,6 +256,7 @@ add_test(notifications-test notifications-test) include_directories(${CMAKE_SOURCE_DIR}/src) add_executable (media-player-user-test media-player-user.cc) +target_link_options (media-player-user-test PRIVATE -no-pie) target_link_libraries ( media-player-user-test indicator-sound-service-lib @@ -277,6 +283,7 @@ add_test(media-player-user-test-timeout include_directories(${CMAKE_SOURCE_DIR}/src) add_executable (greeter-list-test greeter-list.cc) +target_link_options (greeter-list-test PRIVATE -no-pie) target_link_libraries ( greeter-list-test indicator-sound-service-lib @@ -304,6 +311,7 @@ add_definitions( ) add_executable (indicator-test indicator-test.cc) add_dependencies (indicator-test gschemas-compiled) +target_link_options (indicator-test PRIVATE -no-pie) target_link_libraries ( indicator-test ${SOUNDSERVICE_LIBRARIES} diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt index 20b311b..74b9c23 100644 --- a/tests/integration/CMakeLists.txt +++ b/tests/integration/CMakeLists.txt @@ -75,6 +75,7 @@ qt5_use_modules( Test ) +target_link_options (integration-tests PRIVATE -no-pie) target_link_libraries( integration-tests sound-indicator-dbus-interfaces -- cgit v1.2.3