From 3b735bf1aad65277f56e65c828a22455cbaf5245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanislav=20Angelovi=C4=8D?= Date: Wed, 22 Jul 2020 16:35:42 +0200 Subject: [PATCH] Introduce CI workflow based on GitHub Actions (#114) This introduces GitHub CI which runs builds and tests in a matrix configuration. It also changes the systemd repo to stable one. And puts the CI badge (plus a few more badges) to the README page. Fixes #44 --- .github/workflows/ci.yml | 68 +++++++++++++++++++++++++++ README.md | 4 ++ cmake/LibsystemdExternalProject.cmake | 6 +-- 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..72b6d50 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-18.04, ubuntu-20.04] + compiler: [g++, clang] + build: [shared-libsystemd] + include: + - os: ubuntu-20.04 + compiler: g++ + build: embedded-static-libsystemd + steps: + - uses: actions/checkout@v2 + - name: install-libsystemd-toolchain + if: matrix.build == 'embedded-static-libsystemd' + run: | + sudo apt-get update -y + sudo apt-get install -y meson ninja-build libcap-dev libmount-dev m4 gperf + - name: install-libsystemd-dev + if: matrix.build == 'shared-libsystemd' + run: | + sudo apt-get update -y + sudo apt-get install -y libsystemd-dev + - name: install-clang + if: matrix.compiler == 'clang' + run: | + sudo apt-get install -y clang + sudo update-alternatives --remove-all cc + sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang 10 + sudo update-alternatives --remove-all c++ + sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 10 + - name: configure-debug + if: matrix.build == 'shared-libsystemd' && matrix.os == 'ubuntu-18.04' + run: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-O0 -g -W -Wextra -Wall -Wnon-virtual-dtor -Werror" -DBUILD_TESTS=ON -DENABLE_PERF_TESTS=ON -DENABLE_STRESS_TESTS=ON -DBUILD_CODE_GEN=ON .. + - name: configure-release + if: matrix.build == 'shared-libsystemd' && matrix.os == 'ubuntu-20.04' + run: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -DNDEBUG -W -Wextra -Wall -Wnon-virtual-dtor -Werror" -DBUILD_TESTS=ON -DENABLE_PERF_TESTS=ON -DENABLE_STRESS_TESTS=ON -DBUILD_CODE_GEN=ON .. + - name: configure-with-embedded-libsystemd + if: matrix.build == 'embedded-static-libsystemd' + run: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON -DENABLE_PERF_TESTS=ON -DENABLE_STRESS_TESTS=ON -DBUILD_CODE_GEN=ON -DBUILD_LIBSYSTEMD=ON -DLIBSYSTEMD_VERSION=244 .. + - name: make + run: | + cd build + make -j2 + - name: verify + run: | + cd build + sudo make install + ctest diff --git a/README.md b/README.md index 7d49c64..7fa0c9e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ sdbus-c++ ========= +![ci](https://github.com/Kistler-Group/sdbus-cpp/workflows/CI/badge.svg) +![license](https://img.shields.io/github/license/Kistler-Group/sdbus-cpp) +![release](https://img.shields.io/github/v/release/Kistler-Group/sdbus-cpp) + sdbus-c++ is a high-level C++ D-Bus library for Linux designed to provide expressive, easy-to-use API in modern C++. It adds another layer of abstraction on top of sd-bus, a nice, fresh C D-Bus implementation by systemd. sdbus-c++ has been written primarily as a replacement of dbus-c++, which currently suffers from a number of (unresolved) bugs, concurrency issues and inherent design complexities and limitations. sdbus-c++ has learned from dbus-c++ and has chosen a different path, a path of simple yet powerful design that is intuitive and friendly to the user and inherently free of those bugs. diff --git a/cmake/LibsystemdExternalProject.cmake b/cmake/LibsystemdExternalProject.cmake index 90b2987..dfa56d4 100644 --- a/cmake/LibsystemdExternalProject.cmake +++ b/cmake/LibsystemdExternalProject.cmake @@ -35,12 +35,12 @@ message(STATUS "Building with embedded libsystemd v${LIBSYSTEMD_VERSION}") include(ExternalProject) ExternalProject_Add(LibsystemdBuildProject PREFIX libsystemd-v${LIBSYSTEMD_VERSION} - GIT_REPOSITORY https://github.com/systemd/systemd.git - GIT_TAG v${LIBSYSTEMD_VERSION} + GIT_REPOSITORY https://github.com/systemd/systemd-stable.git + GIT_TAG v${LIBSYSTEMD_VERSION}-stable GIT_SHALLOW 1 UPDATE_COMMAND "" CONFIGURE_COMMAND ${CMAKE_COMMAND} -E remove /* - COMMAND ${MESON} --prefix= --buildtype=${LIBSYSTEMD_BUILD_TYPE} -Dstatic-libsystemd=pic + COMMAND ${MESON} --prefix= --buildtype=${LIBSYSTEMD_BUILD_TYPE} -Dstatic-libsystemd=pic -Dselinux=false BUILD_COMMAND ${BUILD_VERSION_H} COMMAND ${NINJA} -C libsystemd.a BUILD_ALWAYS 0