Skip to content

Commit fb4523b

Browse files
Fix the broken CI due to the regression of 4.0.1 and some deprecated image and links (#235)
Fixes #234 1. Downgrade the Pulsar image to 4.0.0 2. Upgrade the macOS runner image from 12 to 14 Since the Boost download link is broken now, this PR also fixes the wheel build process by reusing the pre-built libraries to install pulsar-client-cpp on Linux and macOS. Specially, it links the `libpulsarwithdeps.a` instead of `libpulsar.a` and all 3rd-party libraries on macOS.
1 parent 43792ea commit fb4523b

15 files changed

+148
-836
lines changed

.github/workflows/ci-build-release-wheels.yaml

+2-25
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
uses: docker/setup-qemu-action@v2
5959

6060
- uses: docker/setup-buildx-action@v2
61-
- run: build-support/copy-deps-versionfile.sh
6261

6362
- name: Build Manylinux Docker image
6463
uses: docker/build-push-action@v3
@@ -95,7 +94,7 @@ jobs:
9594

9695
mac-wheels:
9796
name: Wheel MacOS Universal2 - Py ${{matrix.py.version}}
98-
runs-on: macos-12
97+
runs-on: macos-14
9998
timeout-minutes: 300
10099

101100
strategy:
@@ -112,30 +111,8 @@ jobs:
112111
- name: checkout
113112
uses: actions/checkout@v3
114113

115-
- name: Dependencies cache
116-
uses: actions/cache@v3
117-
id: cache-deps
118-
with:
119-
path: .pulsar-mac-build/deps/install
120-
key: ${{matrix.py.version_long}}-${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pkg/mac/*') }}
121-
122-
- name: Build dependencies
123-
if: steps.cache-deps.outputs.cache-hit != 'true'
124-
run: pkg/mac/build-dependencies.sh ${{matrix.py.version}} ${{matrix.py.version_long}}
125-
126-
- name: Pulsar C++ cache
127-
uses: actions/cache@v3
128-
id: cache-cpp
129-
with:
130-
path: .pulsar-mac-build/cpp/install
131-
key: ${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pulsar-client-cpp-version.txt') }}-${{ hashFiles('pkg/mac/*') }}
132-
133-
- name: Build Pulsar C++ client
134-
if: steps.cache-cpp.outputs.cache-hit != 'true'
135-
run: pkg/mac/build-pulsar-cpp.sh
136-
137114
- name: Build and test Mac wheels
138-
run: pkg/mac/build-mac-wheels.sh ${{matrix.py.version}}
115+
run: pkg/mac/build-mac-wheels.sh ${{matrix.py.version}} ${{matrix.py.version_long}}
139116

140117
- name: Upload artifacts
141118
uses: actions/upload-artifact@v3

.github/workflows/ci-pr-validation.yaml

+3-28
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ jobs:
127127
uses: docker/setup-qemu-action@v2
128128

129129
- uses: docker/setup-buildx-action@v2
130-
- run: build-support/copy-deps-versionfile.sh
131130

132131
- name: Build Manylinux Docker image
133132
uses: docker/build-push-action@v3
@@ -157,7 +156,7 @@ jobs:
157156
mac-wheels:
158157
name: Wheel MacOS Universal2 - Py ${{matrix.py.version}}
159158
needs: unit-tests
160-
runs-on: macos-12
159+
runs-on: macos-14
161160
timeout-minutes: 300
162161

163162
strategy:
@@ -169,33 +168,9 @@ jobs:
169168
- name: checkout
170169
uses: actions/checkout@v3
171170

172-
- name: Dependencies cache
173-
uses: actions/cache@v3
174-
id: cache-deps
175-
with:
176-
path: .pulsar-mac-build/deps/install
177-
key: ${{matrix.py.version_long}}-${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pkg/mac/*') }}
178-
179-
- name: Install Python deps
180-
run: pip3 install -U pyyaml
181-
182-
- name: Build dependencies
183-
if: steps.cache-deps.outputs.cache-hit != 'true'
184-
run: pkg/mac/build-dependencies.sh ${{matrix.py.version}} ${{matrix.py.version_long}}
185-
186-
- name: Pulsar C++ cache
187-
uses: actions/cache@v3
188-
id: cache-cpp
189-
with:
190-
path: .pulsar-mac-build/cpp/install
191-
key: ${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pulsar-client-cpp-version.txt') }}-${{ hashFiles('pkg/mac/*') }}
192-
193-
- name: Build Pulsar C++ client
194-
if: steps.cache-cpp.outputs.cache-hit != 'true'
195-
run: pkg/mac/build-pulsar-cpp.sh
196-
197171
- name: Build and test Mac wheels
198-
run: pkg/mac/build-mac-wheels.sh ${{matrix.py.version}}
172+
run: |
173+
pkg/mac/build-mac-wheels.sh ${{matrix.py.version}} ${{matrix.py.version_long}}
199174
200175
windows-wheels:
201176
name: "Python ${{ matrix.python.version }} Wheel on Windows x64"

CMakeLists.txt

+4-40
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@ if (MSVC)
3838
endif ()
3939

4040
if (LINK_STATIC)
41-
if (MSVC)
42-
find_library(PULSAR_LIBRARY NAMES pulsarWithDeps.lib)
43-
else ()
44-
find_library(PULSAR_LIBRARY NAMES libpulsar.a)
45-
endif ()
41+
find_library(PULSAR_LIBRARY NAMES pulsarwithdeps pulsarWithDeps.lib)
4642
add_definitions("-DPULSAR_STATIC")
47-
else()
43+
else ()
4844
find_library(PULSAR_LIBRARY NAMES pulsar libpulsar)
4945
endif()
5046
message(STATUS "PULSAR_LIBRARY: ${PULSAR_LIBRARY}")
@@ -88,43 +84,11 @@ set(PYTHON_WRAPPER_LIBS ${PYTHON_WRAPPER_LIBS} Python3::Module)
8884
message(STATUS "All libraries: ${PYTHON_WRAPPER_LIBS}")
8985

9086
if (LINK_STATIC AND NOT MSVC)
91-
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
92-
93-
# We need to include all the static libs individually because we cannot easily create a universal2 libpulsar.a
94-
# with all the deps included.
95-
find_package(OpenSSL REQUIRED)
96-
message("OPENSSL_LIBRARIES: " ${OPENSSL_LIBRARIES})
97-
98-
find_package(Protobuf REQUIRED)
99-
message("Protobuf_LIBRARIES: " ${Protobuf_LIBRARIES})
100-
101-
find_package(curl REQUIRED)
102-
message("CURL_LIBRARIES: " ${CURL_LIBRARIES})
103-
104-
find_package(zlib)
105-
message("ZLIB_LIBRARIES: " ${ZLIB_LIBRARIES})
106-
107-
find_library(LIB_ZSTD NAMES libzstd.a)
108-
message(STATUS "ZStd: ${LIB_ZSTD}")
109-
find_library(LIB_SNAPPY NAMES libsnappy.a)
110-
message(STATUS "LIB_SNAPPY: ${LIB_SNAPPY}")
111-
112-
set(PYTHON_WRAPPER_LIBS ${PYTHON_WRAPPER_LIBS}
113-
${OPENSSL_LIBRARIES}
114-
${Protobuf_LIBRARIES}
115-
${ZLIB_LIBRARIES}
116-
${LIB_ZSTD}
117-
${LIB_SNAPPY}
118-
${CURL_LIBRARIES}
119-
)
120-
12187
if (APPLE)
12288
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
123-
target_link_libraries(_pulsar -Wl,-all_load ${PYTHON_WRAPPER_LIBS})
89+
target_link_libraries(_pulsar ${PYTHON_WRAPPER_LIBS})
12490
else ()
125-
if (NOT MSVC)
126-
set (CMAKE_SHARED_LINKER_FLAGS " -static-libgcc -static-libstdc++")
127-
endif()
91+
set (CMAKE_SHARED_LINKER_FLAGS " -static-libgcc -static-libstdc++")
12892
target_link_libraries(_pulsar ${PYTHON_WRAPPER_LIBS})
12993
endif ()
13094
elseif (LINK_STATIC) # MSVC

build-support/copy-deps-versionfile.sh

-30
This file was deleted.

build-support/dep-url.sh

-23
Original file line numberDiff line numberDiff line change
@@ -38,38 +38,15 @@ download_dependency() {
3838
VERSION=$(grep $DEP $DEP_FILE | sed 's/://' | awk '{print $2}')
3939

4040
case $DEP in
41-
"cmake")
42-
URL=https://github.com/Kitware/CMake/releases/download/v${VERSION}/cmake-${VERSION}-linux-${ARCH}.tar.gz
43-
;;
4441
"pulsar-cpp")
4542
URL=$(pulsar_cpp_base_url $VERSION)/apache-pulsar-client-cpp-${VERSION}.tar.gz
4643
;;
4744
"pybind11")
4845
URL=https://github.com/pybind/pybind11/archive/refs/tags/v${VERSION}.tar.gz
4946
;;
50-
"boost")
51-
VERSION_UNDERSCORE=$(echo $VERSION | sed 's/\./_/g')
52-
URL=https://boostorg.jfrog.io/artifactory/main/release/${VERSION}/source/boost_${VERSION_UNDERSCORE}.tar.gz
53-
;;
54-
"protobuf")
55-
URL=https://github.com/google/protobuf/releases/download/v${VERSION}/protobuf-cpp-${VERSION}.tar.gz
56-
;;
57-
"zlib")
58-
URL=https://github.com/madler/zlib/archive/v${VERSION}.tar.gz
59-
;;
60-
"zstd")
61-
URL=https://github.com/facebook/zstd/releases/download/v${VERSION}/zstd-${VERSION}.tar.gz
62-
;;
63-
"snappy")
64-
URL=https://github.com/google/snappy/archive/refs/tags/${VERSION}.tar.gz
65-
;;
6647
"openssl")
6748
URL=https://github.com/openssl/openssl/archive/OpenSSL_$(echo $VERSION | sed 's/\./_/g').tar.gz
6849
;;
69-
"curl")
70-
VERSION_UNDERSCORE=$(echo $VERSION | sed 's/\./_/g')
71-
URL=https://github.com/curl/curl/releases/download/curl-${VERSION_UNDERSCORE}/curl-${VERSION}.tar.gz
72-
;;
7350
*)
7451
echo "Unknown dependency $DEP for version $VERSION"
7552
exit 1

build-support/pulsar-test-service-start.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cd $SRC_DIR
2525

2626
./build-support/pulsar-test-service-stop.sh
2727

28-
CONTAINER_ID=$(docker run -i --user $(id -u) -p 8080:8080 -p 6650:6650 -p 8443:8443 -p 6651:6651 --rm --detach apachepulsar/pulsar:latest sleep 3600)
28+
CONTAINER_ID=$(docker run -i --user $(id -u) -p 8080:8080 -p 6650:6650 -p 8443:8443 -p 6651:6651 --rm --detach apachepulsar/pulsar:4.0.0 sleep 3600)
2929
echo $CONTAINER_ID > .tests-container-id.txt
3030

3131
docker cp tests/test-conf $CONTAINER_ID:/pulsar/test-conf

dependencies.yaml

+1-7
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@
1717
# under the License.
1818
#
1919

20-
cmake: 3.24.2
2120
pulsar-cpp: 3.5.1
2221
pybind11: 2.10.1
23-
boost: 1.80.0
24-
protobuf: 3.20.0
25-
zlib: 1.2.13
26-
zstd: 1.5.2
27-
snappy: 1.1.9
22+
# The OpenSSL dependency is only used when building Python from source
2823
openssl: 1.1.1q
29-
curl: 8.4.0

pkg/build-wheel-inside-docker.sh

+29-9
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,39 @@
2121
set -e -x
2222

2323
cd /pulsar-client-python
24+
source build-support/dep-url.sh
2425

25-
PYBIND11_VERSION=$(./build-support/dep-version.py pybind11)
26-
curl -L -O https://github.com/pybind/pybind11/archive/refs/tags/v${PYBIND11_VERSION}.tar.gz
27-
tar zxf v${PYBIND11_VERSION}.tar.gz
28-
rm -rf pybind11
29-
mv pybind11-${PYBIND11_VERSION} pybind11
26+
# Build cpp wheels
27+
PULSAR_CPP_VERSION=$(cat ./dependencies.yaml | grep pulsar-cpp | awk '{print $2}')
3028

31-
rm -f CMakeCache.txt CMakeFiles
29+
if [ $CPP_BINARY_TYPE == "rpm" ]; then
30+
if [ $ARCH == "aarch64" ]; then
31+
RPM_ROOT_DIR=$(pulsar_cpp_base_url $PULSAR_CPP_VERSION)/rpm-arm64/aarch64
32+
else
33+
RPM_ROOT_DIR=$(pulsar_cpp_base_url $PULSAR_CPP_VERSION)/rpm-x86_64/x86_64
34+
fi
35+
curl -O -L $RPM_ROOT_DIR/apache-pulsar-client-$PULSAR_CPP_VERSION-1.$ARCH.rpm
36+
curl -O -L $RPM_ROOT_DIR/apache-pulsar-client-devel-$PULSAR_CPP_VERSION-1.$ARCH.rpm
37+
curl -O -L $RPM_ROOT_DIR/apache-pulsar-client-debuginfo-$PULSAR_CPP_VERSION-1.$ARCH.rpm
38+
rpm -ivh *.rpm
39+
else # apk
40+
if [ $ARCH == "aarch64" ]; then
41+
APK_ROOT_DIR=$(pulsar_cpp_base_url $PULSAR_CPP_VERSION)/apk-arm64/aarch64
42+
else
43+
APK_ROOT_DIR=$(pulsar_cpp_base_url $PULSAR_CPP_VERSION)/apk-x86_64/x86_64
44+
fi
45+
curl -O -L $APK_ROOT_DIR/apache-pulsar-client-$PULSAR_CPP_VERSION-r0.apk
46+
curl -O -L $APK_ROOT_DIR/apache-pulsar-client-dev-$PULSAR_CPP_VERSION-r0.apk
47+
apk add --allow-untrusted *.apk
48+
fi
3249

33-
cmake . \
34-
-DCMAKE_BUILD_TYPE=Release
50+
download_dependency $PWD/dependencies.yaml pybind11
51+
rm -rf pybind11
52+
mv pybind11-* pybind11
3553

36-
make -j4
54+
cmake -B build -DCMAKE_BUILD_TYPE=Release
55+
cmake --build build -j8
56+
mv build/lib_pulsar.so .
3757

3858
./setup.py bdist_wheel
3959

0 commit comments

Comments
 (0)