Skip to content

Commit e2a3088

Browse files
fix build for kafka
1 parent a12d1f7 commit e2a3088

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

.github/workflows/build.yaml

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ jobs:
102102
pkg-config-aarch64-linux-gnu
103103
fi
104104
105-
106105
# macOS-specific dependencies
107106
- name: Install macOS dependencies
108107
if: runner.os == 'macOS'
@@ -130,10 +129,25 @@ jobs:
130129
~/.cargo/git
131130
target
132131
key: ${{ runner.os }}-cargo-${{ matrix.target }}-kafka-${{ hashFiles('**/Cargo.lock') }}
133-
134-
- name: Find and fix librdkafka CMakeLists.txt
132+
133+
- name: Build with Kafka
134+
uses: actions-rs/cargo@v1
135+
with:
136+
use-cross: ${{ runner.os == 'Linux' }}
137+
command: build
138+
args: --target ${{ matrix.target }} --features kafka --release
139+
env:
140+
LIBRDKAFKA_SSL_VENDORED: 1
141+
PKG_CONFIG_ALLOW_CROSS: "1"
142+
PKG_CONFIG_PATH: "/usr/lib/aarch64-linux-gnu/pkgconfig"
143+
SASL2_DIR: "/usr/lib/aarch64-linux-gnu"
144+
OPENSSL_DIR: "/usr/lib/aarch64-linux-gnu"
145+
OPENSSL_ROOT_DIR: "/usr/lib/aarch64-linux-gnu"
146+
OPENSSL_STATIC: "1"
147+
SASL2_STATIC: "0"
148+
# Add the fix as a pre-run script right before cargo build runs
149+
# This is a workaround since actions-rs/cargo doesn't support pre-commands
135150
run: |
136-
# Download the package first so it's in the registry
137151
cargo fetch
138152
139153
# Find the rdkafka-sys package directory
@@ -149,28 +163,19 @@ jobs:
149163
# Make a backup of the original file
150164
cp "$CMAKE_FILE" "$CMAKE_FILE.bak"
151165
152-
# Replace the minimum required version
153-
sed -i 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE"
166+
# Replace the minimum required version - with OS-specific syntax
167+
if [ "${{ runner.os }}" == "macOS" ]; then
168+
sed -i '' 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE"
169+
else
170+
sed -i 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE"
171+
fi
154172
155173
echo "Modified CMakeLists.txt - before and after comparison:"
156174
diff "$CMAKE_FILE.bak" "$CMAKE_FILE" || true
157175
else
158176
echo "Could not find librdkafka CMakeLists.txt file!"
159177
exit 1
160178
fi
161-
162-
- name: Build with Kafka
163-
uses: actions-rs/cargo@v1
164-
with:
165-
use-cross: ${{ runner.os == 'Linux' }}
166-
command: build
167-
args: --target ${{ matrix.target }} --features kafka --release
168-
env:
169-
LIBRDKAFKA_SSL_VENDORED: 1
170-
PKG_CONFIG_ALLOW_CROSS: "1"
171-
PKG_CONFIG_PATH: "/usr/lib/aarch64-linux-gnu/pkgconfig"
172-
SASL2_DIR: "/usr/lib/aarch64-linux-gnu"
173-
OPENSSL_DIR: "/usr/lib/aarch64-linux-gnu"
174-
OPENSSL_ROOT_DIR: "/usr/lib/aarch64-linux-gnu"
175-
OPENSSL_STATIC: "1"
176-
SASL2_STATIC: "0"
179+
180+
# Now run the actual build
181+
cargo build --target ${{ matrix.target }} --features kafka --release

0 commit comments

Comments
 (0)