Add sdbus-c++ ConnMan client example #67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| codeql: | |
| name: CodeQL Security Analysis | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write | |
| contents: read | |
| actions: read | |
| steps: | |
| - name: Checkout code | |
| # actions/checkout v4.2.2 — pinned to full SHA | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| submodules: recursive | |
| - name: Initialize CodeQL | |
| # github/codeql-action/init v4.32.6 — pinned to full SHA | |
| uses: github/codeql-action/init@fb0994ef1c058010acf1efccff928b0a83b1ed54 # v4.32.6 | |
| with: | |
| languages: cpp | |
| queries: security-and-quality | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| cmake \ | |
| ninja-build \ | |
| libudev-dev \ | |
| libsystemd-dev \ | |
| pkg-config \ | |
| gcc-14 \ | |
| g++-14 | |
| - name: Build for CodeQL | |
| run: | | |
| mkdir -p build | |
| cd build | |
| cmake .. -GNinja \ | |
| -DCMAKE_BUILD_TYPE=Release | |
| ninja | |
| env: | |
| CC: gcc-14 | |
| CXX: g++-14 | |
| - name: Perform CodeQL Analysis | |
| # github/codeql-action/analyze v4.32.6 — pinned to full SHA (was @v3, now consistent with init) | |
| uses: github/codeql-action/analyze@fb0994ef1c058010acf1efccff928b0a83b1ed54 # v4.32.6 | |
| with: | |
| category: "/language:cpp" | |
| clang-format: | |
| name: Code Formatting Check | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| # actions/checkout v4.2.2 — pinned to full SHA | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install clang-format | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang-format | |
| - name: Run clang-format check | |
| run: | | |
| # Find all C++ source files and check formatting | |
| find src -type f \( -name "*.cpp" -o -name "*.cc" \ | |
| -o -name "*.h" -o -name "*.hpp" \) -print0 | \ | |
| xargs -0 clang-format --dry-run --Werror | |
| shell: bash | |
| clang-tidy: | |
| name: Static Analysis (clang-tidy) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| # actions/checkout v4.2.2 — pinned to full SHA | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| # Install LLVM 19 with libc++ | |
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | \ | |
| sudo tee /etc/apt/trusted.gpg.d/llvm.asc | |
| sudo add-apt-repository -y \ | |
| 'deb https://apt.llvm.org/noble/ llvm-toolchain-noble-19 main' | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| clang-19 \ | |
| clang-tidy-19 \ | |
| llvm-19 \ | |
| llvm-19-dev \ | |
| lld-19 \ | |
| libc++-19-dev \ | |
| libc++abi-19-dev \ | |
| cmake \ | |
| ninja-build \ | |
| libudev-dev \ | |
| libsystemd-dev \ | |
| pkg-config | |
| - name: Configure CMake for clang-tidy | |
| run: | | |
| mkdir -p build | |
| cd build | |
| cmake .. -GNinja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | |
| -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -lc++abi" \ | |
| -DLLVM_CONFIG=/usr/bin/llvm-config-19 | |
| sed -i \ | |
| -e 's/-fdeps-format=p1689r5//g' \ | |
| -e 's/-fmodules-ts//g' \ | |
| -e 's/-fmodule-mapper=[^ ]*//g' \ | |
| -e 's/@[^ ]*\.modmap//g' \ | |
| compile_commands.json | |
| env: | |
| CC: clang-19 | |
| CXX: clang++-19 | |
| - name: Run clang-tidy | |
| run: | | |
| # Find all C++ source files and run clang-tidy | |
| # Exclude third_party directory from analysis | |
| export FILE_LIST=$(find src -type d -name third_party -prune -false -o -name '*.cc' -o -name '*.hpp' -o -name '*.h') | |
| clang-tidy-19 --version | |
| clang-tidy-19 --help | |
| clang-tidy-19 \ | |
| -p build \ | |
| -export-fixes=tidy-results-suggested-fixes.txt \ | |
| -extra-arg='-Ithird_party/glaze/include' \ | |
| -extra-arg='-Ithird_party/sdbus-cpp/include' \ | |
| -extra-arg='-Ithird_party/spdlog/include' \ | |
| -warnings-as-errors='*' \ | |
| -header-filter='^(?!.*third_party).*$' \ | |
| --dump-config | |
| run-clang-tidy-19 \ | |
| -p build \ | |
| -export-fixes=tidy-results-suggested-fixes.txt \ | |
| -extra-arg='-Ithird_party/glaze/include' \ | |
| -extra-arg='-Ithird_party/sdbus-cpp/include' \ | |
| -extra-arg='-Ithird_party/spdlog/include' \ | |
| -warnings-as-errors='*' \ | |
| -header-filter='^(?!.*third_party).*$' \ | |
| $FILE_LIST | |
| shell: bash | |
| build: | |
| name: Build and Publish Artifacts | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| compiler: | |
| - {cc: gcc-14, cxx: g++-14, name: gcc-14, stdlib: libstdc++} | |
| - {cc: clang-19, cxx: clang++-19, name: llvm-19, stdlib: libc++} | |
| steps: | |
| - name: Checkout code | |
| # actions/checkout v4.2.2 — pinned to full SHA | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| cmake \ | |
| ninja-build \ | |
| libudev-dev \ | |
| libsystemd-dev \ | |
| pkg-config | |
| - name: Install compiler toolchain | |
| run: | | |
| if [ "${{ matrix.compiler.name }}" = "gcc-14" ]; then | |
| sudo apt-get install -y gcc-14 g++-14 | |
| elif [ "${{ matrix.compiler.name }}" = "llvm-19" ]; then | |
| # Install LLVM 19 with libc++ | |
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | \ | |
| sudo tee /etc/apt/trusted.gpg.d/llvm.asc | |
| sudo add-apt-repository -y \ | |
| 'deb https://apt.llvm.org/noble/ llvm-toolchain-noble-19 main' | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| clang-19 \ | |
| llvm-19 \ | |
| llvm-19-dev \ | |
| lld-19 \ | |
| libc++-19-dev \ | |
| libc++abi-19-dev | |
| fi | |
| - name: Configure CMake | |
| run: | | |
| mkdir -p build | |
| cd build | |
| # Configure with C++23 support | |
| if [ "${{ matrix.compiler.stdlib }}" = "libc++" ]; then | |
| # For LLVM with libc++ | |
| cmake .. -GNinja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DENABLE_LTO=ON \ | |
| -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -lc++abi" \ | |
| -DLLVM_CONFIG=/usr/bin/llvm-config-19 | |
| else | |
| # For GCC with libstdc++ | |
| cmake .. -GNinja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DENABLE_LTO=ON | |
| fi | |
| env: | |
| CC: ${{ matrix.compiler.cc }} | |
| CXX: ${{ matrix.compiler.cxx }} | |
| - name: Build | |
| run: | | |
| cd build | |
| ninja -v | |
| - name: Collect executables | |
| run: | | |
| mkdir -p artifacts | |
| # Find all executables in src directories | |
| # (exclude CMake test artifacts and temporary files) | |
| find build/src -type f -executable \ | |
| -not -path "*/CMakeFiles/*" \ | |
| -not -name "*.so*" \ | |
| -not -name "*.a" \ | |
| -exec cp {} artifacts/ \; | |
| # List what we collected | |
| echo "Collected artifacts:" | |
| ls -lh artifacts/ | |
| - name: Upload build artifacts | |
| # actions/upload-artifact v4.6.2 — pinned to full SHA | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: binaries-${{ matrix.compiler.name }} | |
| path: artifacts/* | |
| if-no-files-found: error | |
| retention-days: 30 |