Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-build-binary-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
-DVCPKG_TRIPLET=${{ matrix.triplet }} \
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} \
-S .
cmake --build $BUILD_DIR --parallel --config Release
cmake --build $BUILD_DIR --config Release
cmake --install $BUILD_DIR
cp dependencies.txt ${{ env.INSTALL_DIR }}

Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR_DEBUG \
-DCMAKE_BUILD_TYPE=Debug \
-S .
cmake --build $BUILD_DIR --parallel --config Debug
cmake --build $BUILD_DIR --config Debug
cmake --install $BUILD_DIR --config Debug
cp dependencies.txt $INSTALL_DIR_DEBUG

Expand Down
237 changes: 2 additions & 235 deletions .github/workflows/ci-pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,161 +29,9 @@ concurrency:

jobs:

formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '11'
exclude-regex: '.*\.(proto|hpp)'

wireshark-dissector-build:
name: Build the Wireshark dissector
needs: formatting-check
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
# TODO: support build on macos-14
os: [ubuntu-latest]

steps:
- name: checkout
uses: actions/checkout@v3

- name: Install deps (Ubuntu)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get update -y
sudo apt-get install -y protobuf-compiler libprotobuf-dev wireshark-dev

- name: Install deps (macOS)
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
# See https://github.com/Homebrew/homebrew-core/issues/157142
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
cd /usr/local/bin
rm -f 2to3* idle3* pydoc* python3*
rm -f /usr/local/share/man/man1/python3.1 /usr/local/lib/pkgconfig/python3*
cd /usr/local/Frameworks/Python.framework
rm -rf Headers Python Resources Versions/Current
brew update
brew install pkg-config wireshark protobuf
- name: Build wireshark plugin
run: |
cmake -S wireshark -B build-wireshark
cmake --build build-wireshark

lint:
name: Lint
needs: formatting-check
runs-on: ubuntu-24.04
timeout-minutes: 120

steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Build the project
run: |
cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build -j8

- name: Tidy check
run: |
sudo apt-get install -y clang-tidy
./build-support/run_clang_tidy.sh
if [[ $? -ne 0 ]]; then
echo "clang-tidy failed"
exit 1
fi

unit-tests:
name: Run unit tests
needs: formatting-check
runs-on: ubuntu-24.04
timeout-minutes: 120

steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Build core libraries
run: |
cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=OFF
cmake --build build -j8

- name: Check formatting
run: |
./vcpkg/vcpkg format-manifest vcpkg.json
if [[ $(git diff | wc -l) -gt 0 ]]; then
echo "Please run `./vcpkg/vcpkg format-manifest vcpkg.json` to reformat vcpkg.json"
exit 1
fi

- name: Build tests
run: |
cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build -j8

- name: Install gtest-parallel
run: |
sudo curl -o /gtest-parallel https://raw.githubusercontent.com/google/gtest-parallel/master/gtest_parallel.py

- name: Run unit tests
run: RETRY_FAILED=3 CMAKE_BUILD_DIRECTORY=./build ./run-unit-tests.sh

- name: Build with Boost.Asio
run: |
cmake -B build-boost-asio -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON
cmake --build build-boost-asio -j8

- name: Build perf tools
run: |
cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DBUILD_PERF_TOOLS=ON
cmake --build build -j8

- name: Verify custom vcpkg installation
run: |
mv vcpkg /tmp/
cmake -B build-2 -DINTEGRATE_VCPKG=ON -DCMAKE_TOOLCHAIN_FILE="/tmp/vcpkg/scripts/buildsystems/vcpkg.cmake"

cpp20-build:
name: Build with the C++20 standard
needs: lint
runs-on: ubuntu-22.04
timeout-minutes: 60

steps:
- name: checkout
uses: actions/checkout@v3
- name: Install deps
run: |
sudo apt-get update -y
sudo apt-get install -y libcurl4-openssl-dev libssl-dev \
protobuf-compiler libprotobuf-dev libboost-dev \
libboost-dev libboost-program-options-dev \
libzstd-dev libsnappy-dev libgmock-dev libgtest-dev
- name: CMake
run: cmake -B build -DBUILD_PERF_TOOLS=ON -DCMAKE_CXX_STANDARD=20
- name: Build
run: |
cmake --build build -j8 --target pulsarShared pulsarStatic
cmake --build build -j8

cpp-build-windows:
timeout-minutes: 120
name: Build CPP Client on ${{ matrix.name }}
needs: unit-tests
runs-on: ${{ matrix.os }}
env:
VCPKG_ROOT: '${{ github.workspace }}/vcpkg'
Expand All @@ -192,12 +40,6 @@ jobs:
fail-fast: false
matrix:
include:
- name: 'Windows x64'
os: windows-2022
triplet: x64-windows-static
suffix: 'windows-win64'
generator: 'Visual Studio 17 2022'
arch: '-A x64'
- name: 'Windows x86'
os: windows-2022
triplet: x86-windows-static
Expand Down Expand Up @@ -259,7 +101,7 @@ jobs:
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmake --build ./build-1 --parallel --config Release
cmake --build ./build-1 --parallel --verbose --config Release
cmake --install ./build-1
fi

Expand All @@ -283,86 +125,11 @@ jobs:
./build-static/Release/win-example.exe
fi

- name: Build (Debug)
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmake \
-B ./build-2 \
-G "${{ matrix.generator }}" ${{ matrix.arch }} \
-DUSE_ASIO=ON \
-DBUILD_TESTS=OFF \
-DVCPKG_TRIPLET="${{ matrix.triplet }}" \
-DCMAKE_INSTALL_PREFIX="${{ env.INSTALL_DIR }}" \
-DCMAKE_BUILD_TYPE=Debug \
-S .
cmake --build ./build-2 --parallel --config Debug
fi

package:
name: Build ${{matrix.pkg.name}} ${{matrix.cpu.platform}}
runs-on: ubuntu-22.04
needs: [lint, unit-tests]
timeout-minutes: 500

strategy:
fail-fast: true
matrix:
pkg:
- { name: 'RPM', type: 'rpm', path: 'pkg/rpm/RPMS' }
- { name: 'Deb', type: 'deb', path: 'pkg/deb/BUILD/DEB' }
- { name: 'Alpine', type: 'apk', path: 'pkg/apk/build' }
cpu:
- { arch: 'x86_64', platform: 'x86_64' }

steps:
- name: checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Package Pulsar source
run: build-support/generate-source-archive.sh

- uses: docker/setup-buildx-action@v2

- name: Build dependencies Docker image
uses: docker/build-push-action@v3
with:
context: ./pkg/${{matrix.pkg.type}}
load: true
tags: build:latest
platforms: linux/${{matrix.cpu.platform}}
build-args: PLATFORM=${{matrix.cpu.arch}}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build packages
run: pkg/${{matrix.pkg.type}}/docker-build-${{matrix.pkg.type}}-${{matrix.cpu.platform}}.sh build:latest

# TODO: verify the pre-built package works without linking issue

cpp-build-macos:
timeout-minutes: 120
name: Build CPP Client on macOS with static dependencies
runs-on: macos-14
needs: lint
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Build libraries
run: ./pkg/mac/build-static-library.sh

# Job that will be required to complete and depends on all the other jobs
check-completion:
name: Check Completion
runs-on: ubuntu-latest
needs: [formatting-check, wireshark-dissector-build, lint, unit-tests, cpp20-build, cpp-build-windows, package, cpp-build-macos]
needs: [cpp-build-windows]

steps:
- run: true
73 changes: 0 additions & 73 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
MESSAGE(STATUS "Threads library: " ${CMAKE_THREAD_LIBS_INIT})

if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif ()

# Compiler specific configuration:
# https://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
Expand Down Expand Up @@ -112,9 +116,6 @@ set(AUTOGEN_DIR ${PROJECT_BINARY_DIR}/generated)
file(MAKE_DIRECTORY ${AUTOGEN_DIR})

if (INTEGRATE_VCPKG)
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif ()
set(CMAKE_C_STANDARD 11)
set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost REQUIRED)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ cmake -B build -DINTEGRATE_VCPKG=ON
cmake --build build -j8
```

> - Before 4.0.0, C++11 is required.
> - Since 4.0.0, C++17 is required.

The 1st step will download vcpkg and then install all dependencies according to the version description in [vcpkg.json](./vcpkg.json). The 2nd step will build the Pulsar C++ libraries under `./build/lib/`, where `./build` is the CMake build directory.

> You can also add the CMAKE_TOOLCHAIN_FILE option if your system already have vcpkg installed.
Expand Down
Loading
Loading