rdkafka 0.21.0 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +3 -0
- data/.github/workflows/ci_linux_x86_64_gnu.yml +271 -0
- data/.github/workflows/ci_linux_x86_64_musl.yml +194 -0
- data/.github/workflows/ci_macos_arm64.yml +284 -0
- data/.github/workflows/push_linux_x86_64_gnu.yml +65 -0
- data/.github/workflows/push_linux_x86_64_musl.yml +79 -0
- data/.github/workflows/push_macos_arm64.yml +54 -0
- data/.github/workflows/push_ruby.yml +37 -0
- data/.github/workflows/verify-action-pins.yml +16 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +27 -0
- data/README.md +3 -2
- data/Rakefile +0 -2
- data/docker-compose.yml +1 -1
- data/ext/Rakefile +1 -1
- data/ext/build_common.sh +361 -0
- data/ext/build_linux_x86_64_gnu.sh +306 -0
- data/ext/build_linux_x86_64_musl.sh +763 -0
- data/ext/build_macos_arm64.sh +550 -0
- data/lib/rdkafka/bindings.rb +31 -5
- data/lib/rdkafka/config.rb +8 -4
- data/lib/rdkafka/consumer/headers.rb +14 -3
- data/lib/rdkafka/native_kafka.rb +8 -2
- data/lib/rdkafka/producer/partitions_count_cache.rb +216 -0
- data/lib/rdkafka/producer.rb +70 -41
- data/lib/rdkafka/version.rb +1 -1
- data/lib/rdkafka.rb +1 -0
- data/rdkafka.gemspec +27 -10
- data/renovate.json +87 -1
- data/spec/rdkafka/admin_spec.rb +229 -12
- data/spec/rdkafka/bindings_spec.rb +0 -33
- data/spec/rdkafka/config_spec.rb +17 -15
- data/spec/rdkafka/consumer/headers_spec.rb +26 -10
- data/spec/rdkafka/consumer_spec.rb +74 -15
- data/spec/rdkafka/metadata_spec.rb +2 -2
- data/spec/rdkafka/producer/partitions_count_cache_spec.rb +359 -0
- data/spec/rdkafka/producer_spec.rb +531 -8
- data/spec/spec_helper.rb +30 -7
- metadata +45 -87
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ci.yml +0 -83
- data/Guardfile +0 -19
- data/certs/cert.pem +0 -26
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bdfd8912cec56ebe8303d0ad14f3ab7ab2e5e0565e9418a6265a0e48172bc31
|
4
|
+
data.tar.gz: 646f8a174c1019a0417a571f5894c745701c5d670a0585beb40200a2ffe08193
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d0711b10d02a1c6792fb21206d7729c958fadc186da5b6d8382d69b0d98183cddf23c123ea1602dd890f39603cd44341b864726c4a737966148fffb7e5e5dbd
|
7
|
+
data.tar.gz: deeacf4c205c164d2bd2d786f4a512f62caf8aeda6d6fcc11c24d2d665f4b7bd0a7f44447dfa1ebffc1fe54e7a9cdf36c7bbd4ae71c01e167b46b36a298d7482
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1,271 @@
|
|
1
|
+
# CI Strategy: Comprehensive Testing of Build and Precompiled Flows
|
2
|
+
#
|
3
|
+
# This workflow tests both compilation-from-source and precompiled binary distribution
|
4
|
+
# strategies across multiple Ubuntu and Ruby versions to ensure broad compatibility and
|
5
|
+
# reliability.
|
6
|
+
#
|
7
|
+
# WHY WE TEST BOTH UBUNTU 22.04 AND 24.04:
|
8
|
+
# - Different system library versions (OpenSSL, zlib, libsasl2, libzstd, etc.)
|
9
|
+
# - Different GCC compiler versions that affect native extension compilation
|
10
|
+
# - Different glibc versions that can impact binary compatibility
|
11
|
+
# - Real-world deployment scenarios where users run on various Ubuntu LTS versions
|
12
|
+
# - Different Ruby versions
|
13
|
+
#
|
14
|
+
# COMPILATION FLOW (build_install + specs_install):
|
15
|
+
# - Tests that librdkafka compiles correctly from source on each Ubuntu version
|
16
|
+
# - Validates that mini_portile2 can successfully build native dependencies
|
17
|
+
# - Ensures Ruby native extensions link properly with system libraries
|
18
|
+
# - Verifies that the same codebase works across different toolchain versions
|
19
|
+
#
|
20
|
+
# PRECOMPILED FLOW (build_precompiled + specs_precompiled):
|
21
|
+
# - Tests our precompiled static libraries work on different Ubuntu versions
|
22
|
+
# - Validates that statically-linked binaries are truly portable across environments
|
23
|
+
# - Ensures precompiled libraries don't have unexpected system dependencies
|
24
|
+
# - Verifies that removing build tools doesn't break precompiled binary usage
|
25
|
+
#
|
26
|
+
# ARTIFACT ISOLATION:
|
27
|
+
# - Each Ubuntu version gets separate artifacts (rdkafka-built-gem-22.04, etc.)
|
28
|
+
# - Prevents cross-contamination of OS-specific compiled extensions
|
29
|
+
# - Ensures test accuracy by matching build and test environments
|
30
|
+
#
|
31
|
+
# This comprehensive approach catches issues that single-platform testing would miss,
|
32
|
+
# such as system library incompatibilities, compiler-specific bugs, or static linking
|
33
|
+
# problems that only manifest on specific Ubuntu versions.
|
34
|
+
|
35
|
+
name: CI Linux x86_64 GNU
|
36
|
+
|
37
|
+
concurrency:
|
38
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
39
|
+
cancel-in-progress: true
|
40
|
+
|
41
|
+
on:
|
42
|
+
pull_request:
|
43
|
+
branches: [ main, master ]
|
44
|
+
push:
|
45
|
+
branches: [ main, master ]
|
46
|
+
schedule:
|
47
|
+
- cron: '0 1 * * *'
|
48
|
+
|
49
|
+
permissions:
|
50
|
+
contents: read
|
51
|
+
|
52
|
+
env:
|
53
|
+
BUNDLE_RETRY: 6
|
54
|
+
BUNDLE_JOBS: 4
|
55
|
+
|
56
|
+
jobs:
|
57
|
+
specs_install:
|
58
|
+
timeout-minutes: 30
|
59
|
+
strategy:
|
60
|
+
fail-fast: false
|
61
|
+
matrix:
|
62
|
+
ruby:
|
63
|
+
- '3.5.0-preview1'
|
64
|
+
- '3.4'
|
65
|
+
- '3.3'
|
66
|
+
- '3.2'
|
67
|
+
- '3.1'
|
68
|
+
- 'jruby-10.0'
|
69
|
+
ubuntu-version: ['22.04', '24.04']
|
70
|
+
include:
|
71
|
+
- ruby: '3.4'
|
72
|
+
coverage: 'true'
|
73
|
+
- ruby: 'jruby-10.0'
|
74
|
+
continue-on-error: true
|
75
|
+
runs-on: ubuntu-${{ matrix.ubuntu-version }}
|
76
|
+
steps:
|
77
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
78
|
+
with:
|
79
|
+
fetch-depth: 0
|
80
|
+
- name: Set up Ruby
|
81
|
+
uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
|
82
|
+
with:
|
83
|
+
ruby-version: ${{matrix.ruby}}
|
84
|
+
bundler-cache: false
|
85
|
+
- name: Start Kafka with Docker Compose
|
86
|
+
run: |
|
87
|
+
docker compose up -d
|
88
|
+
echo "Waiting for Kafka to be ready..."
|
89
|
+
|
90
|
+
sleep 10
|
91
|
+
|
92
|
+
echo "=== Container status ==="
|
93
|
+
docker compose ps kafka
|
94
|
+
|
95
|
+
for i in {1..30}; do
|
96
|
+
echo "=== Attempt $i/30 ==="
|
97
|
+
|
98
|
+
echo "Testing kafka-topics command..."
|
99
|
+
if docker compose exec -T kafka kafka-topics --bootstrap-server localhost:9092 --list >/dev/null 2>&1; then
|
100
|
+
echo "Kafka topics command succeeded!"
|
101
|
+
break
|
102
|
+
else
|
103
|
+
echo "Kafka topics command failed (exit code: $?)"
|
104
|
+
fi
|
105
|
+
|
106
|
+
echo "Sleeping 2 seconds..."
|
107
|
+
sleep 2
|
108
|
+
done
|
109
|
+
- name: Install dependencies
|
110
|
+
env:
|
111
|
+
RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
|
112
|
+
run: |
|
113
|
+
# Only install gems that aren't Ruby-version specific
|
114
|
+
bundle install
|
115
|
+
- name: Build gem with mini_portile
|
116
|
+
run: |
|
117
|
+
set -e
|
118
|
+
cd ext && bundle exec rake
|
119
|
+
cd ..
|
120
|
+
- name: Run all specs
|
121
|
+
env:
|
122
|
+
GITHUB_COVERAGE: ${{matrix.coverage}}
|
123
|
+
RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
|
124
|
+
continue-on-error: ${{ matrix.continue-on-error || false }}
|
125
|
+
run: |
|
126
|
+
bundle exec rspec
|
127
|
+
|
128
|
+
build_precompiled:
|
129
|
+
timeout-minutes: 30
|
130
|
+
# We precompile on older Ubuntu and check compatibility by running specs since we aim to
|
131
|
+
# release only one precompiled version for all supported Ubuntu versions
|
132
|
+
# This is why we do not want Renovate to update it automatically
|
133
|
+
runs-on: ubuntu-22.04 # renovate: ignore
|
134
|
+
steps:
|
135
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
136
|
+
with:
|
137
|
+
fetch-depth: 0
|
138
|
+
- name: Install build dependencies
|
139
|
+
run: |
|
140
|
+
sudo apt-get update
|
141
|
+
sudo apt-get install -y --no-install-recommends \
|
142
|
+
build-essential \
|
143
|
+
gcc \
|
144
|
+
g++ \
|
145
|
+
make \
|
146
|
+
tar \
|
147
|
+
gzip \
|
148
|
+
wget \
|
149
|
+
curl \
|
150
|
+
file \
|
151
|
+
pkg-config \
|
152
|
+
autoconf \
|
153
|
+
automake \
|
154
|
+
libtool \
|
155
|
+
python3 \
|
156
|
+
git \
|
157
|
+
ca-certificates \
|
158
|
+
patch \
|
159
|
+
libsasl2-dev \
|
160
|
+
libssl-dev \
|
161
|
+
zlib1g-dev \
|
162
|
+
libzstd-dev \
|
163
|
+
bison \
|
164
|
+
flex \
|
165
|
+
perl \
|
166
|
+
binutils-dev
|
167
|
+
- name: Cache build-tmp directory
|
168
|
+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
169
|
+
with:
|
170
|
+
path: ext/build-tmp
|
171
|
+
key: build-tmp-${{ runner.os }}-${{ hashFiles('ext/*.sh', 'ext/Rakefile') }}-v2
|
172
|
+
- name: Build precompiled librdkafka.so
|
173
|
+
run: |
|
174
|
+
cd ext
|
175
|
+
./build_linux_x86_64_gnu.sh
|
176
|
+
- name: Upload precompiled library
|
177
|
+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
178
|
+
with:
|
179
|
+
name: librdkafka-precompiled-linux
|
180
|
+
path: ext/
|
181
|
+
retention-days: 1
|
182
|
+
|
183
|
+
specs_precompiled:
|
184
|
+
timeout-minutes: 30
|
185
|
+
needs: build_precompiled
|
186
|
+
strategy:
|
187
|
+
fail-fast: false
|
188
|
+
matrix:
|
189
|
+
ruby:
|
190
|
+
- '3.5.0-preview1'
|
191
|
+
- '3.4'
|
192
|
+
- '3.3'
|
193
|
+
- '3.2'
|
194
|
+
- '3.1'
|
195
|
+
ubuntu-version: ['22.04', '24.04']
|
196
|
+
include:
|
197
|
+
- ruby: '3.4'
|
198
|
+
ubuntu-version: '24.04'
|
199
|
+
coverage: 'true'
|
200
|
+
|
201
|
+
runs-on: ubuntu-${{ matrix.ubuntu-version }}
|
202
|
+
steps:
|
203
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
204
|
+
with:
|
205
|
+
fetch-depth: 0
|
206
|
+
- name: Download precompiled library
|
207
|
+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
208
|
+
with:
|
209
|
+
name: librdkafka-precompiled-linux
|
210
|
+
path: ext/
|
211
|
+
- name: Set up Ruby
|
212
|
+
uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
|
213
|
+
with:
|
214
|
+
ruby-version: ${{ matrix.ruby }}
|
215
|
+
bundler-cache: false
|
216
|
+
- name: Start Kafka with Docker Compose
|
217
|
+
run: |
|
218
|
+
docker compose up -d
|
219
|
+
echo "Waiting for Kafka to be ready..."
|
220
|
+
|
221
|
+
sleep 10
|
222
|
+
|
223
|
+
echo "=== Container status ==="
|
224
|
+
docker compose ps kafka
|
225
|
+
for i in {1..30}; do
|
226
|
+
echo "=== Attempt $i/30 ==="
|
227
|
+
|
228
|
+
echo "Testing kafka-topics command..."
|
229
|
+
if docker compose exec -T kafka kafka-topics --bootstrap-server localhost:9092 --list >/dev/null 2>&1; then
|
230
|
+
echo "Kafka topics command succeeded!"
|
231
|
+
break
|
232
|
+
else
|
233
|
+
echo "Kafka topics command failed (exit code: $?)"
|
234
|
+
fi
|
235
|
+
|
236
|
+
echo "Sleeping 2 seconds..."
|
237
|
+
sleep 2
|
238
|
+
done
|
239
|
+
- name: Install bundle with precompiled library
|
240
|
+
env:
|
241
|
+
GITHUB_COVERAGE: ${{ matrix.coverage }}
|
242
|
+
RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
|
243
|
+
run: |
|
244
|
+
bundle install
|
245
|
+
echo "Bundle install completed with precompiled library"
|
246
|
+
- name: Remove build dependencies to test static linking
|
247
|
+
continue-on-error: true
|
248
|
+
run: |
|
249
|
+
echo "Removing build dependencies to verify precompiled library is truly self-contained..."
|
250
|
+
|
251
|
+
# Remove packages one by one to avoid dependency conflicts
|
252
|
+
packages_to_remove="build-essential gcc g++ make patch tar wget libsasl2-dev libssl-dev zlib1g-dev libzstd-dev"
|
253
|
+
|
254
|
+
for package in $packages_to_remove; do
|
255
|
+
if dpkg -l | grep -q "^ii.*$package "; then
|
256
|
+
echo "Removing $package..."
|
257
|
+
sudo dpkg --remove --force-depends $package 2>/dev/null || echo "Could not remove $package"
|
258
|
+
else
|
259
|
+
echo "$package is not installed"
|
260
|
+
fi
|
261
|
+
done
|
262
|
+
|
263
|
+
echo "Build dependencies removal completed"
|
264
|
+
echo "Remaining build tools:"
|
265
|
+
which gcc g++ make 2>/dev/null || echo "No build tools found in PATH (good!)"
|
266
|
+
- name: Run specs with precompiled library
|
267
|
+
env:
|
268
|
+
GITHUB_COVERAGE: ${{ matrix.coverage }}
|
269
|
+
RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
|
270
|
+
run: |
|
271
|
+
bundle exec rspec
|
@@ -0,0 +1,194 @@
|
|
1
|
+
# Why We Build and Run Without Caching Native Extensions
|
2
|
+
#
|
3
|
+
# We intentionally compile the native librdkafka library fresh in each test job
|
4
|
+
# rather than caching or pre-building it for several reasons:
|
5
|
+
#
|
6
|
+
# 1. Architecture Compatibility
|
7
|
+
# - Pre-built native libraries (.so files) are architecture-specific
|
8
|
+
# - Can cause "Exec format error" when build/runtime environments differ
|
9
|
+
# - Building in the same container guarantees compatibility
|
10
|
+
#
|
11
|
+
# 2. Container Image Variations
|
12
|
+
# - Different Ruby Alpine images may have subtle differences in:
|
13
|
+
# * Base system libraries, compiler toolchains, musl libc versions
|
14
|
+
# - These differences can cause pre-built libraries to fail at runtime
|
15
|
+
#
|
16
|
+
# 3. Simplicity and Reliability
|
17
|
+
# - Single source of truth: everything builds and runs in same environment
|
18
|
+
# - No artifact management complexity or potential upload/download failures
|
19
|
+
# - Easier debugging when issues are contained in one job
|
20
|
+
#
|
21
|
+
# Trade-offs: Slightly longer CI times (~2-3 min per job) but much more reliable
|
22
|
+
# than dealing with architecture mismatches and artifact corruption issues.
|
23
|
+
|
24
|
+
name: CI Linux x86_64 musl
|
25
|
+
|
26
|
+
concurrency:
|
27
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
28
|
+
cancel-in-progress: true
|
29
|
+
|
30
|
+
on:
|
31
|
+
pull_request:
|
32
|
+
branches: [ main, master ]
|
33
|
+
push:
|
34
|
+
branches: [ main, master ]
|
35
|
+
schedule:
|
36
|
+
- cron: '0 1 * * *'
|
37
|
+
|
38
|
+
permissions:
|
39
|
+
contents: read
|
40
|
+
|
41
|
+
env:
|
42
|
+
BUNDLE_RETRY: 6
|
43
|
+
BUNDLE_JOBS: 4
|
44
|
+
|
45
|
+
jobs:
|
46
|
+
specs_install:
|
47
|
+
timeout-minutes: 30
|
48
|
+
runs-on: ubuntu-latest
|
49
|
+
strategy:
|
50
|
+
fail-fast: false
|
51
|
+
matrix:
|
52
|
+
include:
|
53
|
+
- ruby: '3.1'
|
54
|
+
alpine_version: '3.21'
|
55
|
+
- ruby: '3.2'
|
56
|
+
alpine_version: '3.21'
|
57
|
+
- ruby: '3.2'
|
58
|
+
alpine_version: '3.22'
|
59
|
+
- ruby: '3.3'
|
60
|
+
alpine_version: '3.21'
|
61
|
+
- ruby: '3.3'
|
62
|
+
alpine_version: '3.22'
|
63
|
+
- ruby: '3.4'
|
64
|
+
alpine_version: '3.21'
|
65
|
+
coverage: 'true'
|
66
|
+
- ruby: '3.4'
|
67
|
+
alpine_version: '3.22'
|
68
|
+
coverage: 'true'
|
69
|
+
steps:
|
70
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
71
|
+
with:
|
72
|
+
fetch-depth: 0
|
73
|
+
|
74
|
+
- name: Start Kafka with Docker Compose
|
75
|
+
run: |
|
76
|
+
docker compose up -d
|
77
|
+
echo "Waiting for Kafka to be ready..."
|
78
|
+
sleep 10
|
79
|
+
for i in {1..30}; do
|
80
|
+
if docker compose exec -T kafka kafka-topics --bootstrap-server localhost:9092 --list >/dev/null 2>&1; then
|
81
|
+
echo "Kafka topics command succeeded!"
|
82
|
+
break
|
83
|
+
fi
|
84
|
+
sleep 2
|
85
|
+
done
|
86
|
+
|
87
|
+
- name: Run all specs
|
88
|
+
env:
|
89
|
+
GITHUB_COVERAGE: ${{ matrix.coverage }}
|
90
|
+
run: |
|
91
|
+
docker run --rm \
|
92
|
+
--network host \
|
93
|
+
-v "${{ github.workspace }}:/workspace" \
|
94
|
+
-w /workspace \
|
95
|
+
-e "GITHUB_COVERAGE=${{ matrix.coverage }}" \
|
96
|
+
ruby:${{ matrix.ruby }}-alpine${{ matrix.alpine_version }} \
|
97
|
+
sh -c 'apk add --no-cache git curl ca-certificates build-base linux-headers \
|
98
|
+
pkgconf perl autoconf automake libtool bison flex file \
|
99
|
+
ruby-dev ruby-bundler bash zstd-dev zlib zlib-dev openssl-dev \
|
100
|
+
cyrus-sasl-dev cyrus-sasl cyrus-sasl-login \
|
101
|
+
cyrus-sasl-crammd5 cyrus-sasl-digestmd5 cyrus-sasl-gssapiv2 cyrus-sasl-scram \
|
102
|
+
krb5-libs openssl zlib zstd-libs && \
|
103
|
+
git config --global --add safe.directory /workspace && \
|
104
|
+
bundle config set --local path vendor/bundle && \
|
105
|
+
bundle install && \
|
106
|
+
cd ext && bundle exec rake && \
|
107
|
+
cd .. && \
|
108
|
+
bundle exec ruby -S rspec'
|
109
|
+
|
110
|
+
build_precompiled:
|
111
|
+
timeout-minutes: 45
|
112
|
+
runs-on: ubuntu-latest
|
113
|
+
container:
|
114
|
+
# Similar to GNU, we build on the oldest for ABI compatibility
|
115
|
+
image: alpine:3.18@sha256:de0eb0b3f2a47ba1eb89389859a9bd88b28e82f5826b6969ad604979713c2d4f # renovate: ignore
|
116
|
+
steps:
|
117
|
+
- name: Install dependencies
|
118
|
+
run: |
|
119
|
+
apk add --no-cache git curl ca-certificates build-base linux-headers \
|
120
|
+
pkgconf perl autoconf automake libtool bison flex file bash wget zstd-dev \
|
121
|
+
openssl-dev cyrus-sasl-dev cyrus-sasl cyrus-sasl-login \
|
122
|
+
cyrus-sasl-crammd5 cyrus-sasl-digestmd5 cyrus-sasl-gssapiv2 cyrus-sasl-scram \
|
123
|
+
krb5-libs openssl zlib zlib-dev zstd-libs
|
124
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
125
|
+
with:
|
126
|
+
fetch-depth: 0
|
127
|
+
- name: Configure git safe directory
|
128
|
+
run: git config --global --add safe.directory /__w/karafka-rdkafka/karafka-rdkafka
|
129
|
+
- name: Cache build-tmp directory
|
130
|
+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
|
131
|
+
with:
|
132
|
+
path: ext/build-tmp-musl
|
133
|
+
key: build-tmp-musl-${{ runner.os }}-${{ hashFiles('ext/*.sh', 'ext/Rakefile') }}-v2
|
134
|
+
- name: Build precompiled librdkafka.so
|
135
|
+
run: |
|
136
|
+
cd ext
|
137
|
+
bash ./build_linux_x86_64_musl.sh
|
138
|
+
- name: Upload precompiled library
|
139
|
+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
140
|
+
with:
|
141
|
+
name: librdkafka-precompiled-musl
|
142
|
+
path: ext/
|
143
|
+
retention-days: 1
|
144
|
+
|
145
|
+
specs_precompiled:
|
146
|
+
timeout-minutes: 30
|
147
|
+
runs-on: ubuntu-latest
|
148
|
+
needs: build_precompiled
|
149
|
+
strategy:
|
150
|
+
fail-fast: false
|
151
|
+
matrix:
|
152
|
+
ruby:
|
153
|
+
- '3.4'
|
154
|
+
- '3.3'
|
155
|
+
- '3.2'
|
156
|
+
- '3.1'
|
157
|
+
include:
|
158
|
+
- ruby: '3.4'
|
159
|
+
coverage: 'true'
|
160
|
+
steps:
|
161
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
162
|
+
with:
|
163
|
+
fetch-depth: 0
|
164
|
+
- name: Download precompiled library
|
165
|
+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
166
|
+
with:
|
167
|
+
name: librdkafka-precompiled-musl
|
168
|
+
path: ext/
|
169
|
+
- name: Start Kafka with Docker Compose
|
170
|
+
run: |
|
171
|
+
docker compose up -d
|
172
|
+
echo "Waiting for Kafka to be ready..."
|
173
|
+
sleep 10
|
174
|
+
|
175
|
+
for i in {1..30}; do
|
176
|
+
if docker compose exec -T kafka kafka-topics --bootstrap-server localhost:9092 --list >/dev/null 2>&1; then
|
177
|
+
echo "Kafka topics command succeeded!"
|
178
|
+
break
|
179
|
+
fi
|
180
|
+
sleep 2
|
181
|
+
done
|
182
|
+
- name: Run specs with precompiled library
|
183
|
+
env:
|
184
|
+
GITHUB_COVERAGE: ${{ matrix.coverage }}
|
185
|
+
RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
|
186
|
+
run: |
|
187
|
+
docker run --rm \
|
188
|
+
--network host \
|
189
|
+
-v "${{ github.workspace }}:/workspace" \
|
190
|
+
-w /workspace \
|
191
|
+
-e "GITHUB_COVERAGE=${{ matrix.coverage }}" \
|
192
|
+
-e "RDKAFKA_EXT_PATH=/workspace/ext" \
|
193
|
+
ruby:${{ matrix.ruby }}-alpine \
|
194
|
+
sh -c 'apk add --no-cache git build-base linux-headers bash && git config --global --add safe.directory /workspace && bundle config set --local path vendor/bundle && bundle install && bundle exec ruby -S rspec'
|