Skip to content

Commit 3ab336e

Browse files
split dependency for macOS and linux
1 parent bd32964 commit 3ab336e

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

.github/workflows/build.yaml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
name: Ensure parseable builds on all release targets
32
on:
43
pull_request:
@@ -116,10 +115,9 @@ jobs:
116115
~/.cargo/registry
117116
~/.cargo/git
118117
target
119-
key: ${{ runner.os }}-cargo-${{ matrix.target }}-kafka-${{
120-
hashFiles('**/Cargo.lock') }}
121-
- name: Find and fix librdkafka CMakeLists.txt
122-
if: runner.os == 'Linux' || runner.os == 'macOS'
118+
key: ${{ runner.os }}-cargo-${{ matrix.target }}-kafka-${{ hashFiles('**/Cargo.lock') }}
119+
- name: Find and fix librdkafka CMakeLists.txt for Linux
120+
if: runner.os == 'Linux'
123121
run: |
124122
cargo fetch
125123
# Find the rdkafka-sys package directory
@@ -139,6 +137,27 @@ jobs:
139137
echo "Could not find librdkafka CMakeLists.txt file!"
140138
exit 1
141139
fi
140+
- name: Find and fix librdkafka CMakeLists.txt for macOS
141+
if: runner.os == 'macOS'
142+
run: |
143+
cargo fetch
144+
# Find the rdkafka-sys package directory
145+
RDKAFKA_SYS_DIR=$(find ~/.cargo/registry/src -name "rdkafka-sys-*" -type d | head -n 1)
146+
echo "Found rdkafka-sys at: $RDKAFKA_SYS_DIR"
147+
# Find the librdkafka CMakeLists.txt file
148+
CMAKE_FILE="$RDKAFKA_SYS_DIR/librdkafka/CMakeLists.txt"
149+
if [ -f "$CMAKE_FILE" ]; then
150+
echo "Found CMakeLists.txt at: $CMAKE_FILE"
151+
# Make a backup of the original file
152+
cp "$CMAKE_FILE" "$CMAKE_FILE.bak"
153+
# Replace the minimum required version - macOS requires '' after -i
154+
sed -i '' 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE"
155+
echo "Modified CMakeLists.txt - before and after comparison:"
156+
diff "$CMAKE_FILE.bak" "$CMAKE_FILE" || true
157+
else
158+
echo "Could not find librdkafka CMakeLists.txt file!"
159+
exit 1
160+
fi
142161
- name: Build with Kafka
143162
uses: actions-rs/cargo@v1
144163
with:
@@ -153,4 +172,4 @@ jobs:
153172
OPENSSL_DIR: /usr/lib/aarch64-linux-gnu
154173
OPENSSL_ROOT_DIR: /usr/lib/aarch64-linux-gnu
155174
OPENSSL_STATIC: "1"
156-
SASL2_STATIC: "0"
175+
SASL2_STATIC: "0"

0 commit comments

Comments
 (0)