forked from Kistler-Group/sdbus-cpp
* chore: don't use systemd headers with elogind
In file included from src/VTableUtils.c:27:
src/VTableUtils.h:30:10: fatal error: 'systemd/sd-bus.h' file not found
#include <systemd/sd-bus.h>
^~~~~~~~~~~~~~~~~~
* chore: add basu support
Similar to elogind but also supported on non-Linux.
* chore(tests): permit /var/lib/machine-id on non-systemd
https://github.com/elogind/elogind/commit/84fdc0fc61c1
https://git.sr.ht/~emersion/basu/commit/8324e6729231
* chore(ci): add simple freebsd job
Mainly to cover libc++ and basu.
* chore(ci): explicitly pass CMAKE_INSTALL_PREFIX
Some sdbus-cpp tests require configuring system bus. However, Linux
testing relies on writing outside of prefix in order to affect current
system bus instance instead of launching a dedicated one.
* chore(tests): respect CMAKE_INSTALL_PREFIX for system bus config
DBus isn't part of base system on BSDs, so may not use /etc for configs.
Also, testing installation failed as non-root:
$ cmake -DBUILD_TESTS=1 -DCMAKE_INSTALL_PREFIX=/tmp/sdbus-cpp_prefix -DTESTS_INSTALL_PATH=/tmp/sdbus-cpp_prefix/tests
$ cmake --build .
$ cmake --install .
[...]
CMake Error at tests/cmake_install.cmake:105 (file):
file cannot create directory: /etc/dbus-1/system.d. Maybe need
administrative privileges.
* chore(tests): temporarily skip 1 test on FreeBSD to keep CI happy
* chore(ci): run tests in freebsd job
106 lines
4.0 KiB
YAML
106 lines
4.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-20.04, ubuntu-22.04]
|
|
compiler: [g++, clang]
|
|
build: [shared-libsystemd]
|
|
include:
|
|
- os: ubuntu-20.04
|
|
compiler: g++
|
|
build: embedded-static-libsystemd
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- 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: install-googletest
|
|
if: matrix.os == 'ubuntu-22.04' # On older ubuntus the libgmock-dev package is either unavailable or has faulty pkg-config file
|
|
run: |
|
|
sudo apt-get install -y libgmock-dev
|
|
- name: configure-debug
|
|
if: matrix.build == 'shared-libsystemd' && matrix.os == 'ubuntu-20.04'
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_CXX_FLAGS="-O0 -g -W -Wextra -Wall -Wnon-virtual-dtor -Werror" -DCMAKE_VERBOSE_MAKEFILE=ON -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-22.04'
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_CXX_FLAGS="-O3 -DNDEBUG -W -Wextra -Wall -Wnon-virtual-dtor -Werror" -DCMAKE_VERBOSE_MAKEFILE=ON -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 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -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
|
|
cmake --build . -j4
|
|
- name: verify
|
|
run: |
|
|
cd build
|
|
sudo cmake --build . --target install
|
|
ctest --output-on-failure
|
|
- name: pack
|
|
if: matrix.build == 'shared-libsystemd' && matrix.os == 'ubuntu-20.04'
|
|
run: |
|
|
cd build
|
|
cpack -G DEB
|
|
- name: 'Upload Artifact'
|
|
if: matrix.build == 'shared-libsystemd' && matrix.os == 'ubuntu-20.04' && matrix.compiler == 'g++'
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "debian-packages-${{ matrix.os }}-${{ matrix.compiler }}"
|
|
path: |
|
|
build/sdbus-c++*.deb
|
|
build/sdbus-c++*.ddeb
|
|
retention-days: 10
|
|
freebsd-build:
|
|
name: build (freebsd, clang/libc++, basu)
|
|
runs-on: macos-12 # until https://github.com/actions/runner/issues/385
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Test in FreeBSD VM
|
|
uses: vmactions/freebsd-vm@v0
|
|
with:
|
|
copyback: false
|
|
usesh: true
|
|
prepare: |
|
|
pkg install -y cmake ninja pkgconf basu expat googletest
|
|
run: |
|
|
cmake -B _build -G Ninja -DBUILD_CODE_GEN=ON -DBUILD_TESTS=ON -DENABLE_PERF_TESTS=ON -DENABLE_STRESS_TESTS=ON
|
|
cmake --build _build
|
|
cmake --install _build
|
|
pkg install -y dbus
|
|
service dbus onestart
|
|
ctest --output-on-failure --test-dir _build
|