karafka-rdkafka 0.21.0-aarch64-linux-gnu

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.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/.github/CODEOWNERS +3 -0
  3. data/.github/FUNDING.yml +1 -0
  4. data/.github/workflows/ci_linux_alpine_x86_64_musl.yml +197 -0
  5. data/.github/workflows/ci_linux_alpine_x86_64_musl_complementary.yml +264 -0
  6. data/.github/workflows/ci_linux_debian_x86_64_gnu.yml +271 -0
  7. data/.github/workflows/ci_linux_debian_x86_64_gnu_complementary.yml +334 -0
  8. data/.github/workflows/ci_linux_ubuntu_aarch64_gnu.yml +271 -0
  9. data/.github/workflows/ci_linux_ubuntu_aarch64_gnu_complementary.yml +295 -0
  10. data/.github/workflows/ci_linux_ubuntu_x86_64_gnu.yml +281 -0
  11. data/.github/workflows/ci_linux_ubuntu_x86_64_gnu_complementary.yml +294 -0
  12. data/.github/workflows/ci_macos_arm64.yml +284 -0
  13. data/.github/workflows/push_linux_aarch64_gnu.yml +65 -0
  14. data/.github/workflows/push_linux_x86_64_gnu.yml +65 -0
  15. data/.github/workflows/push_linux_x86_64_musl.yml +79 -0
  16. data/.github/workflows/push_macos_arm64.yml +54 -0
  17. data/.github/workflows/push_ruby.yml +37 -0
  18. data/.github/workflows/trigger-wiki-refresh.yml +30 -0
  19. data/.github/workflows/verify-action-pins.yml +16 -0
  20. data/.gitignore +16 -0
  21. data/.rspec +3 -0
  22. data/.ruby-gemset +1 -0
  23. data/.ruby-version +1 -0
  24. data/.yardopts +2 -0
  25. data/CHANGELOG.md +344 -0
  26. data/Gemfile +5 -0
  27. data/MIT-LICENSE +22 -0
  28. data/README.md +78 -0
  29. data/Rakefile +96 -0
  30. data/dist/cyrus-sasl-2.1.28.tar.gz +0 -0
  31. data/dist/krb5-1.21.3.tar.gz +0 -0
  32. data/dist/openssl-3.0.16.tar.gz +0 -0
  33. data/dist/zlib-1.3.1.tar.gz +0 -0
  34. data/dist/zstd-1.5.7.tar.gz +0 -0
  35. data/docker-compose-ssl.yml +35 -0
  36. data/docker-compose.yml +25 -0
  37. data/ext/README.md +19 -0
  38. data/ext/Rakefile +131 -0
  39. data/ext/build_common.sh +376 -0
  40. data/ext/build_linux_aarch64_gnu.sh +326 -0
  41. data/ext/build_linux_x86_64_gnu.sh +317 -0
  42. data/ext/build_linux_x86_64_musl.sh +773 -0
  43. data/ext/build_macos_arm64.sh +557 -0
  44. data/ext/generate-ssl-certs.sh +109 -0
  45. data/ext/librdkafka.so +0 -0
  46. data/karafka-rdkafka.gemspec +65 -0
  47. data/lib/rdkafka/abstract_handle.rb +116 -0
  48. data/lib/rdkafka/admin/acl_binding_result.rb +51 -0
  49. data/lib/rdkafka/admin/config_binding_result.rb +30 -0
  50. data/lib/rdkafka/admin/config_resource_binding_result.rb +18 -0
  51. data/lib/rdkafka/admin/create_acl_handle.rb +28 -0
  52. data/lib/rdkafka/admin/create_acl_report.rb +24 -0
  53. data/lib/rdkafka/admin/create_partitions_handle.rb +30 -0
  54. data/lib/rdkafka/admin/create_partitions_report.rb +6 -0
  55. data/lib/rdkafka/admin/create_topic_handle.rb +32 -0
  56. data/lib/rdkafka/admin/create_topic_report.rb +24 -0
  57. data/lib/rdkafka/admin/delete_acl_handle.rb +30 -0
  58. data/lib/rdkafka/admin/delete_acl_report.rb +23 -0
  59. data/lib/rdkafka/admin/delete_groups_handle.rb +28 -0
  60. data/lib/rdkafka/admin/delete_groups_report.rb +24 -0
  61. data/lib/rdkafka/admin/delete_topic_handle.rb +32 -0
  62. data/lib/rdkafka/admin/delete_topic_report.rb +24 -0
  63. data/lib/rdkafka/admin/describe_acl_handle.rb +30 -0
  64. data/lib/rdkafka/admin/describe_acl_report.rb +24 -0
  65. data/lib/rdkafka/admin/describe_configs_handle.rb +33 -0
  66. data/lib/rdkafka/admin/describe_configs_report.rb +48 -0
  67. data/lib/rdkafka/admin/incremental_alter_configs_handle.rb +33 -0
  68. data/lib/rdkafka/admin/incremental_alter_configs_report.rb +48 -0
  69. data/lib/rdkafka/admin.rb +832 -0
  70. data/lib/rdkafka/bindings.rb +583 -0
  71. data/lib/rdkafka/callbacks.rb +415 -0
  72. data/lib/rdkafka/config.rb +395 -0
  73. data/lib/rdkafka/consumer/headers.rb +79 -0
  74. data/lib/rdkafka/consumer/message.rb +86 -0
  75. data/lib/rdkafka/consumer/partition.rb +57 -0
  76. data/lib/rdkafka/consumer/topic_partition_list.rb +190 -0
  77. data/lib/rdkafka/consumer.rb +663 -0
  78. data/lib/rdkafka/error.rb +201 -0
  79. data/lib/rdkafka/helpers/oauth.rb +58 -0
  80. data/lib/rdkafka/helpers/time.rb +14 -0
  81. data/lib/rdkafka/metadata.rb +115 -0
  82. data/lib/rdkafka/native_kafka.rb +139 -0
  83. data/lib/rdkafka/producer/delivery_handle.rb +48 -0
  84. data/lib/rdkafka/producer/delivery_report.rb +45 -0
  85. data/lib/rdkafka/producer/partitions_count_cache.rb +216 -0
  86. data/lib/rdkafka/producer.rb +497 -0
  87. data/lib/rdkafka/version.rb +7 -0
  88. data/lib/rdkafka.rb +54 -0
  89. data/renovate.json +92 -0
  90. data/spec/integrations/ssl_stress_spec.rb +121 -0
  91. data/spec/lib/rdkafka/abstract_handle_spec.rb +117 -0
  92. data/spec/lib/rdkafka/admin/create_acl_handle_spec.rb +56 -0
  93. data/spec/lib/rdkafka/admin/create_acl_report_spec.rb +18 -0
  94. data/spec/lib/rdkafka/admin/create_topic_handle_spec.rb +54 -0
  95. data/spec/lib/rdkafka/admin/create_topic_report_spec.rb +16 -0
  96. data/spec/lib/rdkafka/admin/delete_acl_handle_spec.rb +85 -0
  97. data/spec/lib/rdkafka/admin/delete_acl_report_spec.rb +72 -0
  98. data/spec/lib/rdkafka/admin/delete_topic_handle_spec.rb +54 -0
  99. data/spec/lib/rdkafka/admin/delete_topic_report_spec.rb +16 -0
  100. data/spec/lib/rdkafka/admin/describe_acl_handle_spec.rb +85 -0
  101. data/spec/lib/rdkafka/admin/describe_acl_report_spec.rb +73 -0
  102. data/spec/lib/rdkafka/admin_spec.rb +982 -0
  103. data/spec/lib/rdkafka/bindings_spec.rb +198 -0
  104. data/spec/lib/rdkafka/callbacks_spec.rb +20 -0
  105. data/spec/lib/rdkafka/config_spec.rb +258 -0
  106. data/spec/lib/rdkafka/consumer/headers_spec.rb +73 -0
  107. data/spec/lib/rdkafka/consumer/message_spec.rb +139 -0
  108. data/spec/lib/rdkafka/consumer/partition_spec.rb +57 -0
  109. data/spec/lib/rdkafka/consumer/topic_partition_list_spec.rb +248 -0
  110. data/spec/lib/rdkafka/consumer_spec.rb +1343 -0
  111. data/spec/lib/rdkafka/error_spec.rb +95 -0
  112. data/spec/lib/rdkafka/metadata_spec.rb +79 -0
  113. data/spec/lib/rdkafka/native_kafka_spec.rb +130 -0
  114. data/spec/lib/rdkafka/producer/delivery_handle_spec.rb +60 -0
  115. data/spec/lib/rdkafka/producer/delivery_report_spec.rb +25 -0
  116. data/spec/lib/rdkafka/producer/partitions_count_cache_spec.rb +359 -0
  117. data/spec/lib/rdkafka/producer_spec.rb +1527 -0
  118. data/spec/spec_helper.rb +230 -0
  119. metadata +320 -0
@@ -0,0 +1,281 @@
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 Ubuntu 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: 45
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@2a7b30092b0caf9c046252510f9273b4875f3db9 # v1.254.0
82
+ with:
83
+ ruby-version: ${{matrix.ruby}}
84
+ bundler-cache: false
85
+ - name: Start Kafka with Docker Compose
86
+ run: |
87
+ ./ext/generate-ssl-certs.sh
88
+ docker compose -f docker-compose-ssl.yml up -d
89
+ echo "Waiting for Kafka to be ready..."
90
+
91
+ sleep 10
92
+
93
+ echo "=== Container status ==="
94
+ docker compose ps kafka
95
+
96
+ for i in {1..30}; do
97
+ echo "=== Attempt $i/30 ==="
98
+
99
+ echo "Testing kafka-topics command..."
100
+ if docker compose exec -T kafka kafka-topics --bootstrap-server localhost:9092 --list >/dev/null 2>&1; then
101
+ echo "Kafka topics command succeeded!"
102
+ break
103
+ else
104
+ echo "Kafka topics command failed (exit code: $?)"
105
+ fi
106
+
107
+ echo "Sleeping 2 seconds..."
108
+ sleep 2
109
+ done
110
+ - name: Install dependencies
111
+ env:
112
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
113
+ run: |
114
+ # Only install gems that aren't Ruby-version specific
115
+ bundle install
116
+ - name: Build gem with mini_portile
117
+ run: |
118
+ set -e
119
+ cd ext && bundle exec rake
120
+ cd ..
121
+ - name: Run all specs in PLAINTEXT
122
+ env:
123
+ GITHUB_COVERAGE: ${{matrix.coverage}}
124
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
125
+ continue-on-error: ${{ matrix.continue-on-error || false }}
126
+ run: |
127
+ bundle exec rspec
128
+
129
+ - name: Run all specs in SSL
130
+ env:
131
+ GITHUB_COVERAGE: ${{matrix.coverage}}
132
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
133
+ KAFKA_SSL_ENABLED: "true"
134
+ continue-on-error: ${{ matrix.continue-on-error || false }}
135
+ run: |
136
+ bundle exec rspec
137
+
138
+ build_precompiled:
139
+ timeout-minutes: 30
140
+ # We precompile on older Ubuntu and check compatibility by running specs since we aim to
141
+ # release only one precompiled version for all supported Ubuntu versions
142
+ # This is why we do not want Renovate to update it automatically
143
+ runs-on: ubuntu-22.04 # renovate: ignore
144
+ steps:
145
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
146
+ with:
147
+ fetch-depth: 0
148
+ - name: Install build dependencies
149
+ run: |
150
+ sudo apt-get update
151
+ sudo apt-get install -y --no-install-recommends \
152
+ build-essential \
153
+ gcc \
154
+ g++ \
155
+ make \
156
+ tar \
157
+ gzip \
158
+ wget \
159
+ curl \
160
+ file \
161
+ pkg-config \
162
+ autoconf \
163
+ automake \
164
+ libtool \
165
+ python3 \
166
+ git \
167
+ ca-certificates \
168
+ patch \
169
+ libsasl2-dev \
170
+ libssl-dev \
171
+ zlib1g-dev \
172
+ libzstd-dev \
173
+ bison \
174
+ flex \
175
+ perl \
176
+ binutils-dev
177
+ - name: Cache build-tmp directory
178
+ uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
179
+ with:
180
+ path: ext/build-tmp
181
+ key: build-tmp-${{ runner.os }}-${{ hashFiles('ext/*.sh', 'ext/Rakefile') }}-v2
182
+ - name: Build precompiled librdkafka.so
183
+ run: |
184
+ cd ext
185
+ ./build_linux_x86_64_gnu.sh
186
+ - name: Upload precompiled library
187
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
188
+ with:
189
+ name: librdkafka-precompiled-linux
190
+ path: ext/
191
+ retention-days: 1
192
+
193
+ specs_precompiled:
194
+ timeout-minutes: 30
195
+ needs: build_precompiled
196
+ strategy:
197
+ fail-fast: false
198
+ matrix:
199
+ ruby:
200
+ - '3.5.0-preview1'
201
+ - '3.4'
202
+ - '3.3'
203
+ - '3.2'
204
+ - '3.1'
205
+ ubuntu-version: ['22.04', '24.04']
206
+ include:
207
+ - ruby: '3.4'
208
+ ubuntu-version: '24.04'
209
+ coverage: 'true'
210
+
211
+ runs-on: ubuntu-${{ matrix.ubuntu-version }}
212
+ steps:
213
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
214
+ with:
215
+ fetch-depth: 0
216
+ - name: Download precompiled library
217
+ uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
218
+ with:
219
+ name: librdkafka-precompiled-linux
220
+ path: ext/
221
+ - name: Set up Ruby
222
+ uses: ruby/setup-ruby@2a7b30092b0caf9c046252510f9273b4875f3db9 # v1.254.0
223
+ with:
224
+ ruby-version: ${{ matrix.ruby }}
225
+ bundler-cache: false
226
+ - name: Start Kafka with Docker Compose
227
+ run: |
228
+ docker compose -f docker-compose.yml up -d
229
+ echo "Waiting for Kafka to be ready..."
230
+
231
+ sleep 10
232
+
233
+ echo "=== Container status ==="
234
+ docker compose ps kafka
235
+ for i in {1..30}; do
236
+ echo "=== Attempt $i/30 ==="
237
+
238
+ echo "Testing kafka-topics command..."
239
+ if docker compose exec -T kafka kafka-topics --bootstrap-server localhost:9092 --list >/dev/null 2>&1; then
240
+ echo "Kafka topics command succeeded!"
241
+ break
242
+ else
243
+ echo "Kafka topics command failed (exit code: $?)"
244
+ fi
245
+
246
+ echo "Sleeping 2 seconds..."
247
+ sleep 2
248
+ done
249
+ - name: Install bundle with precompiled library
250
+ env:
251
+ GITHUB_COVERAGE: ${{ matrix.coverage }}
252
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
253
+ run: |
254
+ bundle install
255
+ echo "Bundle install completed with precompiled library"
256
+ - name: Remove build dependencies to test static linking
257
+ continue-on-error: true
258
+ run: |
259
+ echo "Removing build dependencies to verify precompiled library is truly self-contained..."
260
+
261
+ # Remove packages one by one to avoid dependency conflicts
262
+ packages_to_remove="build-essential gcc g++ make patch tar wget libsasl2-dev libssl-dev zlib1g-dev libzstd-dev"
263
+
264
+ for package in $packages_to_remove; do
265
+ if dpkg -l | grep -q "^ii.*$package "; then
266
+ echo "Removing $package..."
267
+ sudo dpkg --remove --force-depends $package 2>/dev/null || echo "Could not remove $package"
268
+ else
269
+ echo "$package is not installed"
270
+ fi
271
+ done
272
+
273
+ echo "Build dependencies removal completed"
274
+ echo "Remaining build tools:"
275
+ which gcc g++ make 2>/dev/null || echo "No build tools found in PATH (good!)"
276
+ - name: Run specs with precompiled library and PLAINTEXT
277
+ env:
278
+ GITHUB_COVERAGE: ${{ matrix.coverage }}
279
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
280
+ run: |
281
+ bundle exec rspec
@@ -0,0 +1,294 @@
1
+ # CI Strategy: Complementary Testing for Ubuntu Precompiled Binaries and Extended Compatibility
2
+ #
3
+ # This workflow runs complementary tests that don't need to block PRs but are essential
4
+ # for catching regressions in precompiled binary distribution, edge case Ruby versions,
5
+ # and system library compatibility. It complements the main CI by testing scenarios
6
+ # that are stable-but-critical on a nightly schedule.
7
+ #
8
+ # WHY COMPLEMENTARY TESTING:
9
+ # - Precompiled binary testing is stable (rarely breaks from code changes)
10
+ # - Edge Ruby versions (3.1, 3.5-preview, JRuby) need testing but shouldn't block PRs
11
+ # - Integration specs test OS library compatibility, which changes with system updates
12
+ # - These tests catch regressions from external changes (system libs, Ruby updates)
13
+ # - Running every 3 days to prevent these slower tests from blocking PR velocity
14
+ # - Manual triggering allows testing workflow changes before they go into schedule
15
+ #
16
+ # PRECOMPILED BINARY TESTING (build_precompiled + specs_precompiled):
17
+ # - Tests static library distribution works across Ubuntu versions
18
+ # - Validates precompiled libraries don't have unexpected system dependencies
19
+ # - Ensures binary compatibility between different Ubuntu LTS versions
20
+ # - Tests SSL/TLS connectivity with precompiled binaries
21
+ # - Validates that removing build tools doesn't break precompiled usage
22
+ #
23
+ # EXTENDED COMPATIBILITY TESTING:
24
+ # - Edge case Ruby versions: 3.1, 3.5.0-preview1, JRuby-10.0
25
+ # - Integration specs testing system library compatibility
26
+ # - Both compilation and precompiled flows for comprehensive coverage
27
+ # - Cross-platform compatibility validation
28
+ #
29
+ # SCHEDULING STRATEGY:
30
+ # - Runs every 3 days at 2 AM to catch system/library changes from base image updates
31
+ # - Triggers on workflow file changes to validate CI modifications
32
+ # - Manual dispatch available for ad-hoc regression testing
33
+ # - Separate artifact naming prevents interference with main CI
34
+ #
35
+ # This approach ensures comprehensive coverage while keeping PR CI fast and focused
36
+ # on code-related issues rather than infrastructure/system regressions.
37
+
38
+ name: CI Linux Complementary Ubuntu x86_64 GNU
39
+
40
+ concurrency:
41
+ group: ${{ github.workflow }}-${{ github.ref }}
42
+ cancel-in-progress: true
43
+
44
+ on:
45
+ schedule:
46
+ - cron: '0 2 */3 * *'
47
+ workflow_dispatch:
48
+ push:
49
+ paths:
50
+ - '.github/workflows/ci_linux_ubuntu_x86_64_gnu_complementary.yml'
51
+ branches: [ main, master ]
52
+ pull_request:
53
+ paths:
54
+ - '.github/workflows/ci_linux_ubuntu_x86_64_gnu_complementary.yml'
55
+ branches: [ main, master ]
56
+
57
+ permissions:
58
+ contents: read
59
+
60
+ env:
61
+ BUNDLE_RETRY: 6
62
+ BUNDLE_JOBS: 4
63
+
64
+ jobs:
65
+ build_precompiled:
66
+ timeout-minutes: 30
67
+ # We precompile on older Ubuntu and check compatibility by running specs since we aim to
68
+ # release only one precompiled version for all supported Ubuntu versions
69
+ # This is why we do not want Renovate to update it automatically
70
+ runs-on: ubuntu-22.04 # renovate: ignore
71
+ steps:
72
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
73
+ with:
74
+ fetch-depth: 0
75
+ - name: Install build dependencies
76
+ run: |
77
+ sudo apt-get update
78
+ sudo apt-get install -y --no-install-recommends \
79
+ build-essential \
80
+ gcc \
81
+ g++ \
82
+ make \
83
+ tar \
84
+ gzip \
85
+ wget \
86
+ curl \
87
+ file \
88
+ pkg-config \
89
+ autoconf \
90
+ automake \
91
+ libtool \
92
+ python3 \
93
+ git \
94
+ ca-certificates \
95
+ patch \
96
+ libsasl2-dev \
97
+ libssl-dev \
98
+ zlib1g-dev \
99
+ libzstd-dev \
100
+ bison \
101
+ flex \
102
+ perl \
103
+ binutils-dev
104
+ - name: Cache build-tmp directory
105
+ uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
106
+ with:
107
+ path: ext/build-tmp
108
+ key: build-tmp-${{ runner.os }}-${{ hashFiles('ext/*.sh', 'ext/Rakefile') }}-v2
109
+ - name: Build precompiled librdkafka.so
110
+ run: |
111
+ cd ext
112
+ ./build_linux_x86_64_gnu.sh
113
+ - name: Upload precompiled library
114
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
115
+ with:
116
+ name: librdkafka-precompiled-ubuntu-complementary
117
+ path: ext/
118
+ retention-days: 1
119
+
120
+ specs_install:
121
+ timeout-minutes: 50
122
+ strategy:
123
+ fail-fast: false
124
+ matrix:
125
+ ruby:
126
+ - '3.5.0-preview1'
127
+ - '3.4'
128
+ - '3.3'
129
+ - '3.2'
130
+ - '3.1'
131
+ - 'jruby-10.0'
132
+ ubuntu-version: ['22.04', '24.04']
133
+ include:
134
+ - ruby: '3.4'
135
+ coverage: 'true'
136
+ - ruby: 'jruby-10.0'
137
+ continue-on-error: true
138
+ runs-on: ubuntu-${{ matrix.ubuntu-version }}
139
+ steps:
140
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
141
+ with:
142
+ fetch-depth: 0
143
+ - name: Set up Ruby
144
+ uses: ruby/setup-ruby@2a7b30092b0caf9c046252510f9273b4875f3db9 # v1.254.0
145
+ with:
146
+ ruby-version: ${{matrix.ruby}}
147
+ bundler-cache: false
148
+ - name: Start Kafka with Docker Compose
149
+ run: |
150
+ ./ext/generate-ssl-certs.sh
151
+ docker compose -f docker-compose-ssl.yml up -d
152
+ echo "Waiting for Kafka to be ready..."
153
+
154
+ sleep 10
155
+
156
+ echo "=== Container status ==="
157
+ docker compose ps kafka
158
+
159
+ for i in {1..30}; do
160
+ echo "=== Attempt $i/30 ==="
161
+
162
+ echo "Testing kafka-topics command..."
163
+ if docker compose exec -T kafka kafka-topics --bootstrap-server localhost:9092 --list >/dev/null 2>&1; then
164
+ echo "Kafka topics command succeeded!"
165
+ break
166
+ else
167
+ echo "Kafka topics command failed (exit code: $?)"
168
+ fi
169
+
170
+ echo "Sleeping 2 seconds..."
171
+ sleep 2
172
+ done
173
+ - name: Install dependencies
174
+ env:
175
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
176
+ continue-on-error: ${{ matrix.continue-on-error || false }}
177
+ run: |
178
+ bundle install
179
+ - name: Build gem with mini_portile
180
+ continue-on-error: ${{ matrix.continue-on-error || false }}
181
+ run: |
182
+ set -e
183
+ cd ext && bundle exec rake
184
+ cd ..
185
+ - name: Run all specs in SSL (compiled flow)
186
+ env:
187
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
188
+ KAFKA_SSL_ENABLED: "true"
189
+ continue-on-error: ${{ matrix.continue-on-error || false }}
190
+ run: |
191
+ bundle exec rspec
192
+
193
+ - name: Run integration specs (compiled flow)
194
+ continue-on-error: ${{ matrix.continue-on-error || false }}
195
+ run: |
196
+ for file in $(ls spec/integrations/*_spec.rb); do
197
+ echo "Running $file with Ruby ${{ matrix.ruby }}";
198
+ bundle exec ruby "$file" || exit 1;
199
+ done
200
+
201
+ specs_precompiled:
202
+ timeout-minutes: 30
203
+ needs: build_precompiled
204
+ strategy:
205
+ fail-fast: false
206
+ matrix:
207
+ ruby:
208
+ - '3.5.0-preview1'
209
+ - '3.4'
210
+ - '3.3'
211
+ - '3.2'
212
+ - '3.1'
213
+ ubuntu-version: ['22.04', '24.04']
214
+
215
+ runs-on: ubuntu-${{ matrix.ubuntu-version }}
216
+ steps:
217
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
218
+ with:
219
+ fetch-depth: 0
220
+ - name: Download precompiled library
221
+ uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
222
+ with:
223
+ name: librdkafka-precompiled-ubuntu-complementary
224
+ path: ext/
225
+ - name: Set up Ruby
226
+ uses: ruby/setup-ruby@2a7b30092b0caf9c046252510f9273b4875f3db9 # v1.254.0
227
+ with:
228
+ ruby-version: ${{ matrix.ruby }}
229
+ bundler-cache: false
230
+ - name: Start Kafka with Docker Compose
231
+ run: |
232
+ ./ext/generate-ssl-certs.sh
233
+ docker compose -f docker-compose-ssl.yml up -d
234
+ echo "Waiting for Kafka to be ready..."
235
+
236
+ sleep 10
237
+
238
+ echo "=== Container status ==="
239
+ docker compose ps kafka
240
+ for i in {1..30}; do
241
+ echo "=== Attempt $i/30 ==="
242
+
243
+ echo "Testing kafka-topics command..."
244
+ if docker compose exec -T kafka kafka-topics --bootstrap-server localhost:9092 --list >/dev/null 2>&1; then
245
+ echo "Kafka topics command succeeded!"
246
+ break
247
+ else
248
+ echo "Kafka topics command failed (exit code: $?)"
249
+ fi
250
+
251
+ echo "Sleeping 2 seconds..."
252
+ sleep 2
253
+ done
254
+ - name: Install bundle with precompiled library
255
+ env:
256
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
257
+ run: |
258
+ bundle install
259
+ echo "Bundle install completed with precompiled library"
260
+ - name: Remove build dependencies to test static linking
261
+ continue-on-error: true
262
+ run: |
263
+ echo "Removing build dependencies to verify precompiled library is truly self-contained..."
264
+
265
+ # Remove packages one by one to avoid dependency conflicts
266
+ packages_to_remove="build-essential gcc g++ make patch tar wget libsasl2-dev libssl-dev zlib1g-dev libzstd-dev"
267
+
268
+ for package in $packages_to_remove; do
269
+ if dpkg -l | grep -q "^ii.*$package "; then
270
+ echo "Removing $package..."
271
+ sudo dpkg --remove --force-depends $package 2>/dev/null || echo "Could not remove $package"
272
+ else
273
+ echo "$package is not installed"
274
+ fi
275
+ done
276
+
277
+ echo "Build dependencies removal completed"
278
+ echo "Remaining build tools:"
279
+ which gcc g++ make 2>/dev/null || echo "No build tools found in PATH (good!)"
280
+ - name: Run specs with precompiled library and SSL
281
+ env:
282
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
283
+ KAFKA_SSL_ENABLED: "true"
284
+ run: |
285
+ bundle exec rspec
286
+
287
+ - name: Run integration specs (precompiled flow)
288
+ env:
289
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
290
+ run: |
291
+ for file in $(ls spec/integrations/*_spec.rb); do
292
+ echo "Running $file with Ruby ${{ matrix.ruby }} (precompiled)";
293
+ bundle exec ruby "$file" || exit 1;
294
+ done