@@ -29,9 +29,177 @@ concurrency:
2929
3030jobs :
3131
32+ formatting-check :
33+ name : Formatting Check
34+ runs-on : ubuntu-latest
35+ steps :
36+ - uses : actions/checkout@v3
37+ - name : Run clang-format style check for C/C++/Protobuf programs.
38+ uses : jidicula/clang-format-action@v4.11.0
39+ with :
40+ clang-format-version : ' 11'
41+ exclude-regex : ' .*\.(proto|hpp)'
42+
43+ wireshark-dissector-build :
44+ name : Build the Wireshark dissector
45+ needs : formatting-check
46+ runs-on : ${{ matrix.os }}
47+ timeout-minutes : 60
48+ strategy :
49+ matrix :
50+ # TODO: support build on macos-14
51+ os : [ubuntu-latest]
52+
53+ steps :
54+ - name : checkout
55+ uses : actions/checkout@v3
56+
57+ - name : Install deps (Ubuntu)
58+ if : ${{ startsWith(matrix.os, 'ubuntu') }}
59+ run : |
60+ sudo apt-get update -y
61+ sudo apt-get install -y protobuf-compiler libprotobuf-dev wireshark-dev
62+
63+ - name : Install deps (macOS)
64+ if : ${{ startsWith(matrix.os, 'macos') }}
65+ run : |
66+ # See https://github.com/Homebrew/homebrew-core/issues/157142
67+ export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
68+ cd /usr/local/bin
69+ rm -f 2to3* idle3* pydoc* python3*
70+ rm -f /usr/local/share/man/man1/python3.1 /usr/local/lib/pkgconfig/python3*
71+ cd /usr/local/Frameworks/Python.framework
72+ rm -rf Headers Python Resources Versions/Current
73+ brew update
74+ brew install pkg-config wireshark protobuf
75+ - name : Build wireshark plugin
76+ run : |
77+ cmake -S wireshark -B build-wireshark
78+ cmake --build build-wireshark
79+
80+ lint :
81+ name : Lint
82+ needs : formatting-check
83+ runs-on : ubuntu-24.04
84+ timeout-minutes : 120
85+
86+ steps :
87+ - name : checkout
88+ uses : actions/checkout@v3
89+ with :
90+ fetch-depth : 0
91+ submodules : recursive
92+
93+ - name : Restore vcpkg installed cache
94+ uses : actions/cache@v4
95+ with :
96+ path : build/vcpkg_installed
97+ key : vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'CMakeLists.txt', 'vcpkg-triplets/**') }}
98+ restore-keys : vcpkg-${{ runner.os }}-
99+
100+ - name : Build the project
101+ run : |
102+ cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
103+ cmake --build build -j8
104+
105+ - name : Tidy check
106+ run : |
107+ sudo apt-get install -y clang-tidy
108+ ./build-support/run_clang_tidy.sh
109+ if [[ $? -ne 0 ]]; then
110+ echo "clang-tidy failed"
111+ exit 1
112+ fi
113+
114+ unit-tests :
115+ name : Run unit tests
116+ needs : formatting-check
117+ runs-on : ubuntu-24.04
118+ timeout-minutes : 120
119+
120+ steps :
121+ - name : checkout
122+ uses : actions/checkout@v3
123+ with :
124+ fetch-depth : 0
125+ submodules : recursive
126+
127+ - name : Restore vcpkg installed cache
128+ uses : actions/cache@v4
129+ with :
130+ path : |
131+ build/vcpkg_installed
132+ build-boost-asio/vcpkg_installed
133+ key : vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'CMakeLists.txt', 'vcpkg-triplets/**') }}
134+ restore-keys : vcpkg-${{ runner.os }}-
135+
136+ - name : Build core libraries
137+ run : |
138+ cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=OFF
139+ cmake --build build -j8
140+
141+ - name : Check formatting
142+ run : |
143+ ./vcpkg/vcpkg format-manifest vcpkg.json
144+ if [[ $(git diff | wc -l) -gt 0 ]]; then
145+ echo "Please run `./vcpkg/vcpkg format-manifest vcpkg.json` to reformat vcpkg.json"
146+ exit 1
147+ fi
148+
149+ - name : Build tests
150+ run : |
151+ cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
152+ cmake --build build -j8
153+
154+ - name : Install gtest-parallel
155+ run : |
156+ sudo curl -o /gtest-parallel https://raw.githubusercontent.com/google/gtest-parallel/master/gtest_parallel.py
157+
158+ - name : Run unit tests
159+ run : RETRY_FAILED=3 CMAKE_BUILD_DIRECTORY=./build ./run-unit-tests.sh
160+
161+ - name : Build with Boost.Asio
162+ run : |
163+ cmake -B build-boost-asio -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON
164+ cmake --build build-boost-asio -j8
165+
166+ - name : Build perf tools
167+ run : |
168+ cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DBUILD_PERF_TOOLS=ON
169+ cmake --build build -j8
170+
171+ - name : Verify custom vcpkg installation
172+ run : |
173+ mv vcpkg /tmp/vcpkg-custom
174+ cmake -B build-2 -DINTEGRATE_VCPKG=ON -DCMAKE_TOOLCHAIN_FILE="/tmp/vcpkg-custom/scripts/buildsystems/vcpkg.cmake"
175+
176+ cpp20-build :
177+ name : Build with the C++20 standard
178+ needs : lint
179+ runs-on : ubuntu-22.04
180+ timeout-minutes : 60
181+
182+ steps :
183+ - name : checkout
184+ uses : actions/checkout@v3
185+ - name : Install deps
186+ run : |
187+ sudo apt-get update -y
188+ sudo apt-get install -y libcurl4-openssl-dev libssl-dev \
189+ protobuf-compiler libprotobuf-dev libboost-dev \
190+ libboost-dev libboost-program-options-dev \
191+ libzstd-dev libsnappy-dev libgmock-dev libgtest-dev
192+ - name : CMake
193+ run : cmake -B build -DBUILD_PERF_TOOLS=ON -DCMAKE_CXX_STANDARD=20
194+ - name : Build
195+ run : |
196+ cmake --build build -j8 --target pulsarShared pulsarStatic
197+ cmake --build build -j8
198+
32199 cpp-build-windows :
33200 timeout-minutes : 120
34201 name : Build CPP Client on ${{ matrix.name }}
202+ needs : unit-tests
35203 runs-on : ${{ matrix.os }}
36204 env :
37205 VCPKG_ROOT : ' ${{ github.workspace }}/vcpkg'
@@ -149,6 +317,7 @@ jobs:
149317 package :
150318 name : Build ${{matrix.pkg.name}} ${{matrix.cpu.platform}}
151319 runs-on : ubuntu-22.04
320+ needs : [lint, unit-tests]
152321 timeout-minutes : 500
153322
154323 strategy :
@@ -189,11 +358,33 @@ jobs:
189358
190359 # TODO: verify the pre-built package works without linking issue
191360
361+ cpp-build-macos :
362+ timeout-minutes : 120
363+ name : Build CPP Client on macOS with static dependencies
364+ runs-on : macos-14
365+ needs : lint
366+ steps :
367+ - name : checkout
368+ uses : actions/checkout@v3
369+ with :
370+ fetch-depth : 0
371+ submodules : recursive
372+
373+ - name : Restore vcpkg installed cache
374+ uses : actions/cache@v4
375+ with :
376+ path : build-osx/vcpkg_installed
377+ key : vcpkg-${{ runner.os }}-arm64-${{ hashFiles('vcpkg.json', 'CMakeLists.txt', 'vcpkg-triplets/**') }}
378+ restore-keys : vcpkg-${{ runner.os }}-arm64-
379+
380+ - name : Build libraries
381+ run : ./pkg/mac/build-static-library.sh
382+
192383 # Job that will be required to complete and depends on all the other jobs
193384 check-completion :
194385 name : Check Completion
195386 runs-on : ubuntu-latest
196- needs : [cpp-build-windows, package]
387+ needs : [formatting-check, wireshark-dissector-build, lint, unit-tests, cpp20-build, cpp-build-windows, package, cpp-build-macos ]
197388
198389 steps :
199390 - run : true
0 commit comments