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=RelWithDebInfo -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 cmake --build . -j2 - name: verify run: | cd build sudo cmake --build . --target install ctest - 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@v2 with: name: "debian-packages-${{ matrix.os }}-${{ matrix.compiler }}" path: | build/sdbus-c++*.deb build/sdbus-c++*.ddeb retention-days: 10