Skip to content

perf(tck): use const references instead of copies for host_id #29

perf(tck): use const references instead of copies for host_id

perf(tck): use const references instead of copies for host_id #29

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
format-check:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install clang-format-18
run: |
sudo apt-get update
sudo apt-get install -y clang-format-18
- name: Check C++ formatting
run: ./scripts/format.sh --check
tidy-check:
name: Run clang-tidy checks
runs-on: ubuntu-latest
container: fedora:42
needs: [format-check]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
dnf install -y \
gcc-c++ \
clang \
clang-tools-extra \
cmake \
ninja-build \
git \
protobuf-devel \
abseil-cpp-devel \
paho-c-devel \
openssl-devel
- name: Configure CMake
env:
CC: clang
CXX: clang++
run: cmake --preset default
- name: Build (for compile_commands.json)
run: cmake --build build -j$(nproc)
- name: Run clang-tidy
run: ./scripts/tidy.sh --quiet
build-and-test-fedora:
name: Build and test (Fedora 42)
runs-on: ubuntu-latest
container: fedora:42
needs: [tidy-check]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
dnf install -y \
gcc-c++ \
clang \
cmake \
ninja-build \
git \
protobuf-devel \
abseil-cpp-devel \
paho-c-devel \
openssl-devel \
openssl \
mosquitto \
procps-ng
- name: Generate TLS certificates
run: |
cd certs
chmod +x generate_certs.sh
./generate_certs.sh
echo "Certificates generated:"
ls -la *.crt *.key
- name: Create password file for authentication tests
run: |
cd certs
mosquitto_passwd -c -b passwordfile admin admin
chmod 600 passwordfile
echo "Password file created with admin/admin"
- name: Start Mosquitto broker
run: |
# Start Mosquitto with default config for basic tests
mosquitto -v &
MOSQUITTO_PID=$!
sleep 2
# Verify Mosquitto is running
if ps -p $MOSQUITTO_PID > /dev/null; then
echo "Mosquitto started successfully (PID: $MOSQUITTO_PID)"
else
echo "ERROR: Mosquitto failed to start"
exit 1
fi
- name: Configure CMake
env:
CC: clang
CXX: clang++
run: cmake --preset default
- name: Build
run: cmake --build build -j$(nproc)
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Authentication tests disabled - require complex Mosquitto TLS setup
# Re-enable once Mosquitto container configuration is fixed
# - name: Run authentication tests
# run: |
# mosquitto -c certs/mosquitto_test.conf -d
# sleep 2
# ./build/examples/test_auth_password
# ./build/examples/test_auth_mtls
# ./build/examples/test_auth_combined
build-and-test-ubuntu:
name: Build and test (Ubuntu 24.04 LTS)
runs-on: ubuntu-24.04
needs: [tidy-check]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
clang-18 \
cmake \
git \
protobuf-compiler \
libprotobuf-dev \
libabsl-dev \
libssl-dev \
openssl \
pkg-config \
mosquitto
- name: Build and install Paho MQTT C
run: |
cd /tmp
git clone --depth 1 --branch v1.3.15 https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
cmake -Bbuild \
-DCMAKE_BUILD_TYPE=Release \
-DPAHO_WITH_SSL=ON \
-DPAHO_BUILD_DOCUMENTATION=OFF \
-DPAHO_BUILD_SAMPLES=OFF \
-DPAHO_BUILD_STATIC=OFF
cmake --build build
sudo cmake --install build
- name: Generate TLS certificates
run: |
cd certs
chmod +x generate_certs.sh
./generate_certs.sh
- name: Create password file
run: |
cd certs
mosquitto_passwd -c -b passwordfile admin admin
chmod 600 passwordfile
- name: Start Mosquitto broker
run: |
mosquitto -c certs/mosquitto_test.conf -d
sleep 3
timeout 1 mosquitto_sub -h localhost -p 1883 -t test || true
- name: Configure CMake
env:
CC: clang-18
CXX: clang++-18
run: cmake --preset default
- name: Build
run: cmake --build build -j$(nproc)
- name: Run tests
run: ctest --test-dir build --output-on-failure
- name: Verify tl::expected is used (Ubuntu lacks std::expected)
run: |
echo "Checking that tl::expected fallback is working..."
strings build/src/libsparkplug_cpp.a | grep -q "tl::" || echo "Note: Binary doesn't contain tl:: symbols (may be optimized out)"
echo "Ubuntu 24.04 build successful with C++23 compatibility layer!"