-
-
Notifications
You must be signed in to change notification settings - Fork 162
192 lines (169 loc) · 5.75 KB
/
build.yaml
File metadata and controls
192 lines (169 loc) · 5.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: Ensure parseable builds on all release targets
on:
pull_request:
paths-ignore:
- docs/**
- helm/**
- assets/**
- "**.md"
jobs:
# Default build without Kafka
build-default:
name: Build Default ${{matrix.target}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux builds - x86_64 native, aarch64 cross-compile
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
use_cross: false
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
use_cross: true
# macOS build - aarch64 only (M1/M2)
- os: macos-latest
target: aarch64-apple-darwin
use_cross: false
# Windows build
- os: windows-latest
target: x86_64-pc-windows-msvc
use_cross: false
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install GCC 11 on Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gcc-11 g++-11
- name: Install cross
if: matrix.use_cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.target }}-default-${{ hashFiles('**/Cargo.lock') }}
- name: Build with cross
if: matrix.use_cross
env:
CROSS_NO_WARNINGS: "0"
run: cross build --target ${{ matrix.target }} --release
- name: Build native
if: ${{ !matrix.use_cross }}
env:
CC: ${{ runner.os == 'Linux' && 'gcc-11' || '' }}
CXX: ${{ runner.os == 'Linux' && 'g++-11' || '' }}
run: cargo build --target ${{ matrix.target }} --release
# Kafka build for x86_64 Linux only
build-kafka:
name: Build Kafka x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
gcc-11 \
g++-11 \
build-essential \
pkg-config \
cmake \
clang \
zlib1g-dev \
libzstd-dev \
liblz4-dev \
libssl-dev \
libsasl2-dev \
python3
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-x86_64-unknown-linux-gnu-kafka-${{ hashFiles('**/Cargo.lock') }}
- name: Find and fix librdkafka CMakeLists.txt
run: |
cargo fetch
RDKAFKA_SYS_DIR=$(find ~/.cargo/registry/src -name "rdkafka-sys-*" -type d | head -n 1)
echo "Found rdkafka-sys at: $RDKAFKA_SYS_DIR"
CMAKE_FILE="$RDKAFKA_SYS_DIR/librdkafka/CMakeLists.txt"
if [ -f "$CMAKE_FILE" ]; then
echo "Found CMakeLists.txt at: $CMAKE_FILE"
cp "$CMAKE_FILE" "$CMAKE_FILE.bak"
sed -i 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE"
echo "Modified CMakeLists.txt - before and after comparison:"
diff "$CMAKE_FILE.bak" "$CMAKE_FILE" || true
else
echo "Could not find librdkafka CMakeLists.txt file!"
exit 1
fi
- name: Build with Kafka
env:
CC: gcc-11
CXX: g++-11
LIBRDKAFKA_SSL_VENDORED: "1"
run: cargo build --target x86_64-unknown-linux-gnu --features kafka --release
# Kafka build for aarch64 macOS
build-kafka-mac:
name: Build Kafka aarch64-apple-darwin
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install macOS dependencies
run: |
brew install \
llvm \
pkg-config \
zstd \
lz4 \
openssl@3.0 \
cyrus-sasl \
python3
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-aarch64-apple-darwin-kafka-${{ hashFiles('**/Cargo.lock') }}
- name: Find and fix librdkafka CMakeLists.txt
run: |
cargo fetch
RDKAFKA_SYS_DIR=$(find ~/.cargo/registry/src -name "rdkafka-sys-*" -type d | head -n 1)
echo "Found rdkafka-sys at: $RDKAFKA_SYS_DIR"
CMAKE_FILE="$RDKAFKA_SYS_DIR/librdkafka/CMakeLists.txt"
if [ -f "$CMAKE_FILE" ]; then
echo "Found CMakeLists.txt at: $CMAKE_FILE"
cp "$CMAKE_FILE" "$CMAKE_FILE.bak"
sed -i '' 's/cmake_minimum_required(VERSION 3.2)/cmake_minimum_required(VERSION 3.5)/' "$CMAKE_FILE"
echo "Modified CMakeLists.txt - before and after comparison:"
diff "$CMAKE_FILE.bak" "$CMAKE_FILE" || true
else
echo "Could not find librdkafka CMakeLists.txt file!"
exit 1
fi
- name: Build with Kafka
env:
LIBRDKAFKA_SSL_VENDORED: "1"
run: cargo build --target aarch64-apple-darwin --features kafka --release