Skip to content

Commit bd32964

Browse files
update build.yaml
1 parent e2a3088 commit bd32964

File tree

1 file changed

+25
-50
lines changed

1 file changed

+25
-50
lines changed

.github/workflows/build.yaml

Lines changed: 25 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1+
---
12
name: Ensure parseable builds on all release targets
2-
33
on:
44
pull_request:
55
paths-ignore:
6-
- "docs/**"
7-
- "helm/**"
8-
- "assets/**"
6+
- docs/**
7+
- helm/**
8+
- assets/**
99
- "**.md"
10-
1110
jobs:
1211
# Default build without Kafka
1312
build-default:
@@ -30,15 +29,12 @@ jobs:
3029
# Windows build
3130
- os: windows-latest
3231
target: x86_64-pc-windows-msvc
33-
3432
steps:
3533
- uses: actions/checkout@v4
36-
3734
- name: Setup Rust toolchain
3835
uses: dtolnay/rust-toolchain@stable
3936
with:
4037
targets: ${{ matrix.target }}
41-
4238
- name: Cache dependencies
4339
uses: actions/cache@v4
4440
with:
@@ -47,14 +43,12 @@ jobs:
4743
~/.cargo/git
4844
target
4945
key: ${{ runner.os }}-cargo-${{ matrix.target }}-default-${{ hashFiles('**/Cargo.lock') }}
50-
5146
- name: Build
5247
uses: actions-rs/cargo@v1
5348
with:
5449
use-cross: ${{ runner.os == 'Linux' }}
5550
command: build
5651
args: --target ${{ matrix.target }} --release
57-
5852
# Kafka build for supported platforms
5953
build-kafka:
6054
name: Build Kafka ${{matrix.target}}
@@ -68,10 +62,8 @@ jobs:
6862
target: x86_64-unknown-linux-gnu
6963
- os: macos-latest
7064
target: aarch64-apple-darwin
71-
7265
steps:
7366
- uses: actions/checkout@v4
74-
7567
# Linux-specific dependencies
7668
- name: Install Linux dependencies
7769
if: runner.os == 'Linux'
@@ -90,7 +82,6 @@ jobs:
9082
python3 \
9183
gcc-aarch64-linux-gnu \
9284
g++-aarch64-linux-gnu
93-
9485
# Install cross-compilation specific packages
9586
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then
9687
sudo apt-get install -y \
@@ -101,7 +92,6 @@ jobs:
10192
libssl-dev:arm64 \
10293
pkg-config-aarch64-linux-gnu
10394
fi
104-
10595
# macOS-specific dependencies
10696
- name: Install macOS dependencies
10797
if: runner.os == 'macOS'
@@ -115,67 +105,52 @@ jobs:
115105
116106
cyrus-sasl \
117107
python3
118-
119108
- name: Setup Rust toolchain
120109
uses: dtolnay/rust-toolchain@stable
121110
with:
122111
targets: ${{ matrix.target }}
123-
124112
- name: Cache dependencies
125113
uses: actions/cache@v4
126114
with:
127115
path: |
128116
~/.cargo/registry
129117
~/.cargo/git
130118
target
131-
key: ${{ runner.os }}-cargo-${{ matrix.target }}-kafka-${{ hashFiles('**/Cargo.lock') }}
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
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'
150123
run: |
151124
cargo fetch
152-
153125
# Find the rdkafka-sys package directory
154126
RDKAFKA_SYS_DIR=$(find ~/.cargo/registry/src -name "rdkafka-sys-*" -type d | head -n 1)
155127
echo "Found rdkafka-sys at: $RDKAFKA_SYS_DIR"
156-
157128
# Find the librdkafka CMakeLists.txt file
158129
CMAKE_FILE="$RDKAFKA_SYS_DIR/librdkafka/CMakeLists.txt"
159-
160130
if [ -f "$CMAKE_FILE" ]; then
161131
echo "Found CMakeLists.txt at: $CMAKE_FILE"
162-
163132
# Make a backup of the original file
164133
cp "$CMAKE_FILE" "$CMAKE_FILE.bak"
165-
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
172-
134+
# Replace the minimum required version
135+
sed -i 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE"
173136
echo "Modified CMakeLists.txt - before and after comparison:"
174137
diff "$CMAKE_FILE.bak" "$CMAKE_FILE" || true
175138
else
176139
echo "Could not find librdkafka CMakeLists.txt file!"
177140
exit 1
178141
fi
179-
180-
# Now run the actual build
181-
cargo build --target ${{ matrix.target }} --features kafka --release
142+
- name: Build with Kafka
143+
uses: actions-rs/cargo@v1
144+
with:
145+
use-cross: ${{ runner.os == 'Linux' }}
146+
command: build
147+
args: --target ${{ matrix.target }} --features kafka --release
148+
env:
149+
LIBRDKAFKA_SSL_VENDORED: 1
150+
PKG_CONFIG_ALLOW_CROSS: "1"
151+
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
152+
SASL2_DIR: /usr/lib/aarch64-linux-gnu
153+
OPENSSL_DIR: /usr/lib/aarch64-linux-gnu
154+
OPENSSL_ROOT_DIR: /usr/lib/aarch64-linux-gnu
155+
OPENSSL_STATIC: "1"
156+
SASL2_STATIC: "0"

0 commit comments

Comments
 (0)