From e29071a5de59aa2aec62a2d172df5c0ce19ac917 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 29 Apr 2021 08:38:20 +0200 Subject: Travis CI: Initial draft for CI builds. --- .build.yml | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 43 +++++++++++++++++++ 2 files changed, 179 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..870b03c --- /dev/null +++ b/.build.yml @@ -0,0 +1,136 @@ +######################################################### +# THE FOLLOWING LINES IS USED BY docker-build +########################################################## +requires: + archlinux: + # Useful URL: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ayatana-indicator-keyboard + - clang + - gcc + - git + - make + - startup-notification + - which + - cmake + - cmake-extras + - mate-common + - cmake + - intltool + - glib2 + - systemd + + debian: + # Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-ido + - autopoint + - clang + - clang-tools + - g++ + - cppcheck + - git + - cmake + - cmake-extras + - mate-common + - libglib2.0-dev + - liblomiri-url-dispatcher-dev + - libgtest-dev + + debian:stable: + # Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-ido + - autopoint + - clang + - clang-tools + - g++ + - cppcheck + - git + - cmake + - cmake-extras + - mate-common + - libglib2.0-dev + - libgtest-dev + + ubuntu: + - autopoint + - clang + - clang-tools + - g++ + - git + - cmake + - cmake-extras + - mate-common + - libglib2.0-dev + - liblomiri-url-dispatcher-dev + - libgtest-dev + + ubuntu:focal: + - autopoint + - clang + - clang-tools + - g++ + - git + - cmake + - cmake-extras + - mate-common + - libglib2.0-dev + - libgtest-dev + +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"' + +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..3748e4d --- /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 --build autotools + +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 82d873933f3aef190b139c4f3ff903c41808c0f5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 29 Apr 2021 08:43:28 +0200 Subject: CMakeLists.txt: Adjust test build option (DISABLE_TESTS -> ENABLE_TESTS, defaulting to OFF). Add ENABLE_COVERAGE build option. --- CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1bffc3..ce7ab46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,16 @@ set(API_VERSION 0) set(ABI_VERSION 0) # Options -option(DISABLE_TESTS "Disable tests" off) +option (ENABLE_TESTS "Build the package's automatic tests." OFF) +option (ENABLE_COVERAGE "Generate lcov code coverage reports." OFF) + +if(ENABLE_COVERAGE) + set(ENABLE_TESTS ON) + set(CMAKE_BUILD_TYPE "Coverage") +else() + set(CMAKE_BUILD_TYPE "Release") +endif() + # GNU standard installation directories include (GNUInstallDirs) @@ -34,10 +43,10 @@ set(CC_WARNING_ARGS " -Wall -pedantic -Wextra -Wno-missing-field-initializers") add_subdirectory(src) -if (DISABLE_TESTS) - message(STATUS "Tests disabled") -else() +if (ENABLE_TESTS) include(CTest) enable_testing() add_subdirectory(tests) +else() + message(STATUS "Tests disabled") endif() -- cgit v1.2.3 From 2a3e4e99ed819a2ac97bc620bb07094d26e19432 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 29 Apr 2021 08:43:46 +0200 Subject: debian/rules: Explicitly enable unit tests during package build. --- debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/rules b/debian/rules index f447c58..82088c0 100755 --- a/debian/rules +++ b/debian/rules @@ -11,6 +11,7 @@ include /usr/share/dpkg/buildflags.mk override_dh_auto_configure: dh_auto_configure -- \ + -DENABLE_TESTS=ON \ -DCMAKE_INSTALL_DIR=/usr \ $(NULL) -- cgit v1.2.3 From 6781806dc77a22b35f0ef059a7ca945f7badd0e9 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 29 Apr 2021 08:59:40 +0200 Subject: README.md: Add file, show Travis CI status. --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..6487f56 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# libayatana-common - Common functions for Ayatana System Indicators [![Build Status](https://travis-ci.org/AyatanaIndicators/libayatana-common.svg)](https://travis-ci.org/AyatanaIndicators/libayatana-common) + +## About Ayatana Indicators + +The Ayatana Indicators project is the continuation of Application +Indicators and System Indicators, two technologies developed by Canonical +Ltd. for the Unity7 desktop. + +Application Indicators are a GTK implementation of the StatusNotifierItem +Specification (SNI) that was originally submitted to freedesktop.org by +KDE. + +System Indicators are an extensions to the Application Indicators idea. +System Indicators allow for far more widgets to be displayed in the +indicator's menu. + +The Ayatana Indicators project is the new upstream for application +indicators, system indicators and associated projects with a focus on +making Ayatana Indicators a desktop agnostic technology. + +On GNU/Linux, Ayatana Indicators are currently available for desktop +envinronments like MATE (used by default in [Ubuntu +MATE](https://ubuntu-mate.com)), XFCE (used by default in +[Xubuntu](https://bluesabre.org/2021/02/25/xubuntu-21-04-progress-update/), +LXDE, and the Budgie Desktop. + +The Lomiri Operating Environment (UI of the Ubuntu Touch OS, formerly +known as Unity8) uses Ayatana Indicators for rendering its notification +area and the [UBports](https://ubports.com) project is a core contributor +to the Ayatana Indicators project. + +For further info, please visit: +https://ayatana-indicators.org + +## About this Software Component + +This shared library contains functions that two or more system indicator +components share. + +This shared library was originally created to reduce code duplication +across various system indicator components. + +## License and Copyright + +See COPYING and AUTHORS file in this project. -- cgit v1.2.3 From 2484d58fc929919e5a228123afed8ddf85e82674 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 29 Apr 2021 09:01:42 +0200 Subject: tests/CMakeLists.txt: Build unit tests with --no-pie CXXFLAG. --- tests/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1c5d318..c6e26ae 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,7 @@ find_package(GMock) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie") + include_directories( ${CMAKE_SOURCE_DIR}/src ) -- cgit v1.2.3 From e863413203f26a18306b6009b05977210ed25dd5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 29 Apr 2021 09:02:56 +0200 Subject: .travis.yml: Temporarily disable CI builds on ubuntu:rolling. Ubuntu's I series is not ready yet as docker container. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3748e4d..2efd2f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ env: # - DISTRO="archlinux:latest" - DISTRO="debian:testing" - DISTRO="debian:stable" - - DISTRO="ubuntu:rolling" +# - DISTRO="ubuntu:rolling" - DISTRO="ubuntu:focal" jobs: -- cgit v1.2.3 From 298f4b37043e0921761c8242cabd762d1014c771 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 29 Apr 2021 09:07:03 +0200 Subject: CMakeLists.txt: Be happy with cmake 3.13 (fixes FTBFS on Debian 10). --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce7ab46..aaeb591 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ project (libayatana-common C CXX) -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.13) set(PROJECT_VERSION "0.9.1") set(PACKAGE ${CMAKE_PROJECT_NAME}) -- cgit v1.2.3