karafka-rdkafka 0.20.0.rc3-x86_64-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 (99) 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_x86_64_gnu.yml +248 -0
  5. data/.github/workflows/ci_macos_arm64.yml +301 -0
  6. data/.github/workflows/push_linux_x86_64_gnu.yml +60 -0
  7. data/.github/workflows/push_ruby.yml +37 -0
  8. data/.github/workflows/verify-action-pins.yml +16 -0
  9. data/.gitignore +15 -0
  10. data/.rspec +2 -0
  11. data/.ruby-gemset +1 -0
  12. data/.ruby-version +1 -0
  13. data/.yardopts +2 -0
  14. data/CHANGELOG.md +323 -0
  15. data/Gemfile +5 -0
  16. data/MIT-LICENSE +22 -0
  17. data/README.md +177 -0
  18. data/Rakefile +96 -0
  19. data/docker-compose.yml +25 -0
  20. data/ext/README.md +19 -0
  21. data/ext/Rakefile +131 -0
  22. data/ext/build_common.sh +361 -0
  23. data/ext/build_linux_x86_64_gnu.sh +306 -0
  24. data/ext/build_macos_arm64.sh +550 -0
  25. data/ext/librdkafka.so +0 -0
  26. data/karafka-rdkafka.gemspec +61 -0
  27. data/lib/rdkafka/abstract_handle.rb +116 -0
  28. data/lib/rdkafka/admin/acl_binding_result.rb +51 -0
  29. data/lib/rdkafka/admin/config_binding_result.rb +30 -0
  30. data/lib/rdkafka/admin/config_resource_binding_result.rb +18 -0
  31. data/lib/rdkafka/admin/create_acl_handle.rb +28 -0
  32. data/lib/rdkafka/admin/create_acl_report.rb +24 -0
  33. data/lib/rdkafka/admin/create_partitions_handle.rb +30 -0
  34. data/lib/rdkafka/admin/create_partitions_report.rb +6 -0
  35. data/lib/rdkafka/admin/create_topic_handle.rb +32 -0
  36. data/lib/rdkafka/admin/create_topic_report.rb +24 -0
  37. data/lib/rdkafka/admin/delete_acl_handle.rb +30 -0
  38. data/lib/rdkafka/admin/delete_acl_report.rb +23 -0
  39. data/lib/rdkafka/admin/delete_groups_handle.rb +28 -0
  40. data/lib/rdkafka/admin/delete_groups_report.rb +24 -0
  41. data/lib/rdkafka/admin/delete_topic_handle.rb +32 -0
  42. data/lib/rdkafka/admin/delete_topic_report.rb +24 -0
  43. data/lib/rdkafka/admin/describe_acl_handle.rb +30 -0
  44. data/lib/rdkafka/admin/describe_acl_report.rb +24 -0
  45. data/lib/rdkafka/admin/describe_configs_handle.rb +33 -0
  46. data/lib/rdkafka/admin/describe_configs_report.rb +48 -0
  47. data/lib/rdkafka/admin/incremental_alter_configs_handle.rb +33 -0
  48. data/lib/rdkafka/admin/incremental_alter_configs_report.rb +48 -0
  49. data/lib/rdkafka/admin.rb +832 -0
  50. data/lib/rdkafka/bindings.rb +582 -0
  51. data/lib/rdkafka/callbacks.rb +415 -0
  52. data/lib/rdkafka/config.rb +398 -0
  53. data/lib/rdkafka/consumer/headers.rb +79 -0
  54. data/lib/rdkafka/consumer/message.rb +86 -0
  55. data/lib/rdkafka/consumer/partition.rb +57 -0
  56. data/lib/rdkafka/consumer/topic_partition_list.rb +190 -0
  57. data/lib/rdkafka/consumer.rb +663 -0
  58. data/lib/rdkafka/error.rb +201 -0
  59. data/lib/rdkafka/helpers/oauth.rb +58 -0
  60. data/lib/rdkafka/helpers/time.rb +14 -0
  61. data/lib/rdkafka/metadata.rb +115 -0
  62. data/lib/rdkafka/native_kafka.rb +139 -0
  63. data/lib/rdkafka/producer/delivery_handle.rb +48 -0
  64. data/lib/rdkafka/producer/delivery_report.rb +45 -0
  65. data/lib/rdkafka/producer/partitions_count_cache.rb +216 -0
  66. data/lib/rdkafka/producer.rb +492 -0
  67. data/lib/rdkafka/version.rb +7 -0
  68. data/lib/rdkafka.rb +54 -0
  69. data/renovate.json +92 -0
  70. data/spec/rdkafka/abstract_handle_spec.rb +117 -0
  71. data/spec/rdkafka/admin/create_acl_handle_spec.rb +56 -0
  72. data/spec/rdkafka/admin/create_acl_report_spec.rb +18 -0
  73. data/spec/rdkafka/admin/create_topic_handle_spec.rb +54 -0
  74. data/spec/rdkafka/admin/create_topic_report_spec.rb +16 -0
  75. data/spec/rdkafka/admin/delete_acl_handle_spec.rb +85 -0
  76. data/spec/rdkafka/admin/delete_acl_report_spec.rb +72 -0
  77. data/spec/rdkafka/admin/delete_topic_handle_spec.rb +54 -0
  78. data/spec/rdkafka/admin/delete_topic_report_spec.rb +16 -0
  79. data/spec/rdkafka/admin/describe_acl_handle_spec.rb +85 -0
  80. data/spec/rdkafka/admin/describe_acl_report_spec.rb +73 -0
  81. data/spec/rdkafka/admin_spec.rb +769 -0
  82. data/spec/rdkafka/bindings_spec.rb +222 -0
  83. data/spec/rdkafka/callbacks_spec.rb +20 -0
  84. data/spec/rdkafka/config_spec.rb +258 -0
  85. data/spec/rdkafka/consumer/headers_spec.rb +73 -0
  86. data/spec/rdkafka/consumer/message_spec.rb +139 -0
  87. data/spec/rdkafka/consumer/partition_spec.rb +57 -0
  88. data/spec/rdkafka/consumer/topic_partition_list_spec.rb +248 -0
  89. data/spec/rdkafka/consumer_spec.rb +1299 -0
  90. data/spec/rdkafka/error_spec.rb +95 -0
  91. data/spec/rdkafka/metadata_spec.rb +79 -0
  92. data/spec/rdkafka/native_kafka_spec.rb +130 -0
  93. data/spec/rdkafka/producer/delivery_handle_spec.rb +60 -0
  94. data/spec/rdkafka/producer/delivery_report_spec.rb +25 -0
  95. data/spec/rdkafka/producer/partitions_count_cache_spec.rb +359 -0
  96. data/spec/rdkafka/producer/partitions_count_spec.rb +359 -0
  97. data/spec/rdkafka/producer_spec.rb +1234 -0
  98. data/spec/spec_helper.rb +181 -0
  99. metadata +244 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8d2a5aa11f12382418392f01e4ec107949661fec05506f0201346f126525c434
4
+ data.tar.gz: b55416183eeed99b3440c9d8f65d13748fce7cb3d315984e5b6fccb0e2b20b0a
5
+ SHA512:
6
+ metadata.gz: e91fe7846b57967aeef2bce1cd3bf72e3ee206cfdb4ed50099684cbef1b1a347420cdda5d3002429d6ab0e94b78cc8a28864a6a6e1886f9223b60145706fbac0
7
+ data.tar.gz: d22c1226b32a671145323e52a9e22edb94aaa4e9188791912958d104f93e27a15e6b16883ba5f36e3beccaf9132e5155a67db5c2728381ec59b72220ba171ce1
@@ -0,0 +1,3 @@
1
+ /.github @mensfeld
2
+ /.github/workflows/ @mensfeld
3
+ /.github/actions/ @mensfeld
@@ -0,0 +1 @@
1
+ custom: ['https://karafka.io/#become-pro']
@@ -0,0 +1,248 @@
1
+ name: CI Linux x86_64 GNU
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.ref }}
4
+ cancel-in-progress: true
5
+
6
+ on:
7
+ pull_request:
8
+ branches: [ main, master ]
9
+ push:
10
+ branches: [ main, master ]
11
+ schedule:
12
+ - cron: '0 1 * * *'
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ env:
18
+ BUNDLE_RETRY: 6
19
+ BUNDLE_JOBS: 4
20
+
21
+ jobs:
22
+ build_install:
23
+ timeout-minutes: 30
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27
+ with:
28
+ fetch-depth: 0
29
+ - name: Install package dependencies
30
+ run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
31
+ - name: Set up Ruby
32
+ uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
33
+ with:
34
+ ruby-version: '3.4' # Use one Ruby version for building
35
+ bundler-cache: false
36
+ - name: Build gem with mini_portile
37
+ run: |
38
+ set -e
39
+ bundle install
40
+ cd ext && bundle exec rake
41
+ cd ..
42
+ - name: Upload built gem and bundle
43
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
44
+ with:
45
+ name: rdkafka-built-gem
46
+ path: |
47
+ vendor/bundle/
48
+ .bundle/
49
+ ext/
50
+ lib/
51
+ retention-days: 1
52
+
53
+ specs_install:
54
+ timeout-minutes: 30
55
+ runs-on: ubuntu-latest
56
+ needs: build_install
57
+ strategy:
58
+ fail-fast: false
59
+ matrix:
60
+ ruby:
61
+ - '3.5.0-preview1'
62
+ - '3.4'
63
+ - '3.3'
64
+ - '3.2'
65
+ - '3.1'
66
+ - 'jruby-10.0'
67
+ include:
68
+ - ruby: '3.4'
69
+ coverage: 'true'
70
+ - ruby: 'jruby-10.0'
71
+ continue-on-error: true
72
+ steps:
73
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
74
+ with:
75
+ fetch-depth: 0
76
+ - name: Download built gem
77
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
78
+ with:
79
+ name: rdkafka-built-gem
80
+ path: ./
81
+ - name: Set up Ruby
82
+ uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
83
+ with:
84
+ ruby-version: ${{matrix.ruby}}
85
+ bundler-cache: false
86
+ - name: Start Kafka with Docker Compose
87
+ run: |
88
+ docker compose 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 remaining 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: Run all specs
117
+ env:
118
+ GITHUB_COVERAGE: ${{matrix.coverage}}
119
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
120
+ continue-on-error: ${{ matrix.continue-on-error || false }}
121
+ run: |
122
+ bundle exec rspec
123
+
124
+ build_precompiled:
125
+ timeout-minutes: 30
126
+ runs-on: ubuntu-latest
127
+ steps:
128
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
129
+ with:
130
+ fetch-depth: 0
131
+ - name: Install build dependencies
132
+ run: |
133
+ sudo apt-get update
134
+ sudo apt-get install -y --no-install-recommends \
135
+ build-essential \
136
+ gcc \
137
+ make \
138
+ patch \
139
+ tar \
140
+ wget \
141
+ ca-certificates \
142
+ libsasl2-dev \
143
+ libssl-dev \
144
+ zlib1g-dev \
145
+ libzstd-dev
146
+ - name: Cache build-tmp directory
147
+ uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
148
+ with:
149
+ path: ext/build-tmp
150
+ key: build-tmp-${{ runner.os }}-${{ hashFiles('ext/*.sh', 'ext/Rakefile') }}-v2
151
+ - name: Build precompiled librdkafka.so
152
+ run: |
153
+ cd ext
154
+ ./build_linux_x86_64_gnu.sh
155
+ - name: Upload precompiled library
156
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
157
+ with:
158
+ name: librdkafka-precompiled-linux
159
+ path: ext/
160
+ retention-days: 1
161
+
162
+ specs_precompiled:
163
+ timeout-minutes: 30
164
+ runs-on: ubuntu-latest
165
+ needs: build_precompiled
166
+ strategy:
167
+ fail-fast: false
168
+ matrix:
169
+ ruby:
170
+ - '3.5.0-preview1'
171
+ - '3.4'
172
+ - '3.3'
173
+ - '3.2'
174
+ - '3.1'
175
+ include:
176
+ - ruby: '3.4'
177
+ coverage: 'true'
178
+ steps:
179
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
180
+ with:
181
+ fetch-depth: 0
182
+ - name: Download precompiled library
183
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
184
+ with:
185
+ name: librdkafka-precompiled-linux
186
+ path: ext/
187
+ - name: Set up Ruby
188
+ uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
189
+ with:
190
+ ruby-version: ${{ matrix.ruby }}
191
+ bundler-cache: false
192
+ - name: Start Kafka with Docker Compose
193
+ run: |
194
+ docker compose up -d
195
+ echo "Waiting for Kafka to be ready..."
196
+
197
+ sleep 10
198
+
199
+ echo "=== Container status ==="
200
+ docker compose ps kafka
201
+
202
+ for i in {1..30}; do
203
+ echo "=== Attempt $i/30 ==="
204
+
205
+ echo "Testing kafka-topics command..."
206
+ if docker compose exec -T kafka kafka-topics --bootstrap-server localhost:9092 --list >/dev/null 2>&1; then
207
+ echo "Kafka topics command succeeded!"
208
+ break
209
+ else
210
+ echo "Kafka topics command failed (exit code: $?)"
211
+ fi
212
+
213
+ echo "Sleeping 2 seconds..."
214
+ sleep 2
215
+ done
216
+ - name: Install bundle with precompiled library
217
+ env:
218
+ GITHUB_COVERAGE: ${{ matrix.coverage }}
219
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
220
+ run: |
221
+ bundle install
222
+ echo "Bundle install completed with precompiled library"
223
+ - name: Remove build dependencies to test static linking
224
+ continue-on-error: true
225
+ run: |
226
+ echo "Removing build dependencies to verify precompiled library is truly self-contained..."
227
+
228
+ # Remove packages one by one to avoid dependency conflicts
229
+ packages_to_remove="build-essential gcc g++ make patch tar wget libsasl2-dev libssl-dev zlib1g-dev libzstd-dev"
230
+
231
+ for package in $packages_to_remove; do
232
+ if dpkg -l | grep -q "^ii.*$package "; then
233
+ echo "Removing $package..."
234
+ sudo dpkg --remove --force-depends $package 2>/dev/null || echo "Could not remove $package"
235
+ else
236
+ echo "$package is not installed"
237
+ fi
238
+ done
239
+
240
+ echo "Build dependencies removal completed"
241
+ echo "Remaining build tools:"
242
+ which gcc g++ make 2>/dev/null || echo "No build tools found in PATH (good!)"
243
+ - name: Run specs with precompiled library
244
+ env:
245
+ GITHUB_COVERAGE: ${{ matrix.coverage }}
246
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
247
+ run: |
248
+ bundle exec rspec
@@ -0,0 +1,301 @@
1
+ name: CI macOS ARM64
2
+ concurrency:
3
+ group: ${{ github.workflow }}-${{ github.ref }}
4
+ cancel-in-progress: true
5
+ on:
6
+ pull_request:
7
+ branches: [ main, master ]
8
+ push:
9
+ branches: [ main, master ]
10
+ schedule:
11
+ - cron: '0 1 * * *'
12
+ permissions:
13
+ contents: read
14
+ env:
15
+ BUNDLE_RETRY: 6
16
+ BUNDLE_JOBS: 4
17
+ # Renovate can track and update this version
18
+ CONFLUENT_VERSION: "8.0.0"
19
+ jobs:
20
+ build_install:
21
+ timeout-minutes: 30
22
+ runs-on: macos-latest
23
+ steps:
24
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25
+ with:
26
+ fetch-depth: 0
27
+ - name: Install Bash 4+ and Kerberos
28
+ run: |
29
+ brew install bash
30
+ brew list krb5 &>/dev/null || brew install krb5
31
+ echo "/opt/homebrew/bin" >> $GITHUB_PATH
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
34
+ with:
35
+ ruby-version: '3.4' # Use one Ruby version for building
36
+ bundler-cache: false
37
+ - name: Build gem with mini_portile
38
+ run: |
39
+ set -e
40
+ bundle install
41
+ cd ext && bundle exec rake
42
+ cd ..
43
+ - name: Upload built gem and bundle
44
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
45
+ with:
46
+ name: rdkafka-built-gem-macos
47
+ path: |
48
+ vendor/bundle/
49
+ .bundle/
50
+ ext/
51
+ lib/
52
+ retention-days: 1
53
+
54
+ specs_install:
55
+ timeout-minutes: 30
56
+ runs-on: macos-latest
57
+ needs: build_install
58
+ strategy:
59
+ fail-fast: false
60
+ matrix:
61
+ ruby:
62
+ - '3.5.0-preview1'
63
+ - '3.4'
64
+ - '3.3'
65
+ - '3.2'
66
+ - '3.1'
67
+ include:
68
+ - ruby: '3.4'
69
+ coverage: 'true'
70
+ steps:
71
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
72
+ with:
73
+ fetch-depth: 0
74
+ - name: Download built gem
75
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
76
+ with:
77
+ name: rdkafka-built-gem-macos
78
+ path: ./
79
+ - name: Install Bash 4+ and Kerberos
80
+ run: |
81
+ brew install bash
82
+ brew list krb5 &>/dev/null || brew install krb5
83
+ echo "/opt/homebrew/bin" >> $GITHUB_PATH
84
+ - name: Set up Ruby
85
+ uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
86
+ with:
87
+ ruby-version: ${{matrix.ruby}}
88
+ bundler-cache: false
89
+ - name: Install and Start Confluent Community Kafka (KRaft)
90
+ run: |
91
+ brew install openjdk@17
92
+ export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"
93
+ export JAVA_HOME="/opt/homebrew/opt/openjdk@17"
94
+
95
+ curl -O "https://packages.confluent.io/archive/8.0/confluent-community-${CONFLUENT_VERSION}.tar.gz"
96
+ tar -xzf "confluent-community-${CONFLUENT_VERSION}.tar.gz"
97
+
98
+ export CONFLUENT_HOME="$(pwd)/confluent-${CONFLUENT_VERSION}"
99
+ export PATH="$CONFLUENT_HOME/bin:$PATH"
100
+ cd "$CONFLUENT_HOME"
101
+
102
+ # Find the correct server config
103
+ KRAFT_CONFIG=""
104
+ for config in "etc/kafka/kraft/server.properties" "config/kraft/server.properties" "etc/kafka/server.properties"; do
105
+ if [ -f "$config" ]; then
106
+ KRAFT_CONFIG="$config"
107
+ echo "Found config: $KRAFT_CONFIG"
108
+ break
109
+ fi
110
+ done
111
+
112
+ if [ -z "$KRAFT_CONFIG" ]; then
113
+ echo "❌ No server config found"
114
+ exit 1
115
+ fi
116
+
117
+ # Configure KRaft for single-node setup
118
+ cat >> "$KRAFT_CONFIG" << 'EOF'
119
+
120
+ # KRaft mode configuration for single-node setup
121
+ process.roles=broker,controller
122
+ node.id=1
123
+ controller.quorum.voters=1@127.0.0.1:9093
124
+ listeners=PLAINTEXT://127.0.0.1:9092,CONTROLLER://127.0.0.1:9093
125
+ controller.listener.names=CONTROLLER
126
+ inter.broker.listener.name=PLAINTEXT
127
+ log.dirs=/tmp/kraft-combined-logs
128
+
129
+ # Enable simple ACL authorization for testing
130
+ authorizer.class.name=org.apache.kafka.metadata.authorizer.StandardAuthorizer
131
+ super.users=User:ANONYMOUS
132
+ allow.everyone.if.no.acl.found=true
133
+ EOF
134
+
135
+ echo "Updated KRaft configuration"
136
+
137
+ CLUSTER_ID=$(bin/kafka-storage random-uuid)
138
+ bin/kafka-storage format -t "$CLUSTER_ID" -c "$KRAFT_CONFIG"
139
+ bin/kafka-server-start "$KRAFT_CONFIG" &
140
+
141
+ sleep 20
142
+
143
+ for i in {1..30}; do
144
+ if bin/kafka-topics --bootstrap-server 127.0.0.1:9092 --list >/dev/null 2>&1; then
145
+ echo "✅ Confluent Community ${CONFLUENT_VERSION} (KRaft) is ready!"
146
+ break
147
+ fi
148
+ [ $i -eq 30 ] && { echo "❌ Kafka failed to start"; exit 1; }
149
+ sleep 2
150
+ done
151
+ - name: Install remaining dependencies
152
+ env:
153
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
154
+ run: |
155
+ # Only install gems that aren't Ruby-version specific
156
+ bundle install
157
+ - name: Run all specs
158
+ env:
159
+ GITHUB_COVERAGE: ${{matrix.coverage}}
160
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
161
+ run: |
162
+ bundle exec rspec
163
+
164
+ build_precompiled:
165
+ timeout-minutes: 45
166
+ runs-on: macos-latest
167
+ steps:
168
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
169
+ with:
170
+ fetch-depth: 0
171
+ - name: Install Bash 4+ and Kerberos
172
+ run: |
173
+ brew install bash
174
+ brew list krb5 &>/dev/null || brew install krb5
175
+ echo "/opt/homebrew/bin" >> $GITHUB_PATH
176
+ - name: Cache build-tmp directory
177
+ uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
178
+ with:
179
+ path: ext/build-tmp-macos
180
+ key: build-tmp-${{ runner.os }}-${{ hashFiles('ext/*.sh', 'ext/Rakefile') }}-v2
181
+ - name: Build precompiled librdkafka for macOS ARM64
182
+ run: |
183
+ cd ext
184
+ /opt/homebrew/bin/bash ./build_macos_arm64.sh
185
+ - name: Upload precompiled library
186
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
187
+ with:
188
+ name: librdkafka-precompiled-macos
189
+ path: ext/
190
+ retention-days: 1
191
+
192
+ specs_precompiled:
193
+ timeout-minutes: 30
194
+ runs-on: macos-latest
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
+ include:
206
+ - ruby: '3.4'
207
+ coverage: 'true'
208
+ steps:
209
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
210
+ with:
211
+ fetch-depth: 0
212
+ - name: Download precompiled library
213
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
214
+ with:
215
+ name: librdkafka-precompiled-macos
216
+ path: ext/
217
+ - name: Set up Ruby
218
+ uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
219
+ with:
220
+ ruby-version: ${{ matrix.ruby }}
221
+ bundler-cache: false
222
+ - name: Install Bash 4+ and Kerberos
223
+ run: |
224
+ brew install bash
225
+ brew list krb5 &>/dev/null || brew install krb5
226
+ echo "/opt/homebrew/bin" >> $GITHUB_PATH
227
+ - name: Install and Start Confluent Community Kafka (KRaft)
228
+ run: |
229
+ brew install openjdk@17
230
+ export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"
231
+ export JAVA_HOME="/opt/homebrew/opt/openjdk@17"
232
+
233
+ curl -O "https://packages.confluent.io/archive/8.0/confluent-community-${CONFLUENT_VERSION}.tar.gz"
234
+ tar -xzf "confluent-community-${CONFLUENT_VERSION}.tar.gz"
235
+
236
+ export CONFLUENT_HOME="$(pwd)/confluent-${CONFLUENT_VERSION}"
237
+ export PATH="$CONFLUENT_HOME/bin:$PATH"
238
+ cd "$CONFLUENT_HOME"
239
+
240
+ # Find the correct server config
241
+ KRAFT_CONFIG=""
242
+ for config in "etc/kafka/kraft/server.properties" "config/kraft/server.properties" "etc/kafka/server.properties"; do
243
+ if [ -f "$config" ]; then
244
+ KRAFT_CONFIG="$config"
245
+ echo "Found config: $KRAFT_CONFIG"
246
+ break
247
+ fi
248
+ done
249
+
250
+ if [ -z "$KRAFT_CONFIG" ]; then
251
+ echo "❌ No server config found"
252
+ exit 1
253
+ fi
254
+
255
+ # Configure KRaft for single-node setup
256
+ cat >> "$KRAFT_CONFIG" << 'EOF'
257
+
258
+ # KRaft mode configuration for single-node setup
259
+ process.roles=broker,controller
260
+ node.id=1
261
+ controller.quorum.voters=1@127.0.0.1:9093
262
+ listeners=PLAINTEXT://127.0.0.1:9092,CONTROLLER://127.0.0.1:9093
263
+ controller.listener.names=CONTROLLER
264
+ inter.broker.listener.name=PLAINTEXT
265
+ log.dirs=/tmp/kraft-combined-logs
266
+
267
+ # Enable simple ACL authorization for testing
268
+ authorizer.class.name=org.apache.kafka.metadata.authorizer.StandardAuthorizer
269
+ super.users=User:ANONYMOUS
270
+ allow.everyone.if.no.acl.found=true
271
+ EOF
272
+
273
+ echo "Updated KRaft configuration"
274
+
275
+ CLUSTER_ID=$(bin/kafka-storage random-uuid)
276
+ bin/kafka-storage format -t "$CLUSTER_ID" -c "$KRAFT_CONFIG"
277
+ bin/kafka-server-start "$KRAFT_CONFIG" &
278
+
279
+ sleep 20
280
+
281
+ for i in {1..30}; do
282
+ if bin/kafka-topics --bootstrap-server 127.0.0.1:9092 --list >/dev/null 2>&1; then
283
+ echo "✅ Confluent Community ${CONFLUENT_VERSION} (KRaft) is ready!"
284
+ break
285
+ fi
286
+ [ $i -eq 30 ] && { echo "❌ Kafka failed to start"; exit 1; }
287
+ sleep 2
288
+ done
289
+ - name: Install bundle with precompiled library
290
+ env:
291
+ GITHUB_COVERAGE: ${{ matrix.coverage }}
292
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
293
+ run: |
294
+ bundle install
295
+ echo "Bundle install completed with precompiled library"
296
+ - name: Run specs with precompiled library
297
+ env:
298
+ GITHUB_COVERAGE: ${{ matrix.coverage }}
299
+ RDKAFKA_EXT_PATH: ${{ github.workspace }}/ext
300
+ run: |
301
+ bundle exec rspec
@@ -0,0 +1,60 @@
1
+ name: Push Linux x86_64 GNU Platform Gem
2
+ on:
3
+ push:
4
+ tags:
5
+ - v*
6
+ permissions:
7
+ contents: read
8
+ env:
9
+ BUNDLE_RETRY: 6
10
+ BUNDLE_JOBS: 4
11
+ jobs:
12
+ push:
13
+ if: github.repository_owner == 'karafka'
14
+ timeout-minutes: 30
15
+ runs-on: ubuntu-latest
16
+ environment: deployment
17
+ permissions:
18
+ contents: write
19
+ id-token: write
20
+ steps:
21
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22
+ with:
23
+ fetch-depth: 0
24
+ - name: Install build dependencies
25
+ run: |
26
+ sudo apt-get update
27
+ sudo apt-get install -y --no-install-recommends \
28
+ build-essential \
29
+ gcc \
30
+ make \
31
+ patch \
32
+ tar \
33
+ wget \
34
+ ca-certificates \
35
+ libsasl2-dev \
36
+ libssl-dev \
37
+ zlib1g-dev \
38
+ libzstd-dev
39
+ - name: Cache build-tmp directory
40
+ uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
41
+ with:
42
+ path: ext/build-tmp
43
+ key: build-tmp-${{ runner.os }}-${{ hashFiles('ext/*.sh') }}
44
+ - name: Set up Ruby
45
+ uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
46
+ with:
47
+ ruby-version: '3.4'
48
+ bundler-cache: false
49
+ - name: Build precompiled librdkafka.so
50
+ run: |
51
+ cd ext
52
+ ./build_linux_x86_64_gnu.sh
53
+ - name: Configure trusted publishing credentials
54
+ uses: rubygems/configure-rubygems-credentials@v1.0.0
55
+ - name: Build and push platform-specific gem
56
+ run: |
57
+ gem build *.gemspec
58
+ gem push *.gem
59
+ env:
60
+ RUBY_PLATFORM: 'x86_64-linux-gnu'
@@ -0,0 +1,37 @@
1
+ name: Push Ruby Platform Gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ push:
13
+ if: github.repository_owner == 'karafka'
14
+ runs-on: ubuntu-latest
15
+ environment: deployment
16
+
17
+ permissions:
18
+ contents: write
19
+ id-token: write
20
+
21
+ steps:
22
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
28
+ with:
29
+ bundler-cache: false
30
+
31
+ - name: Build rdkafka-ruby
32
+ run: |
33
+ set -e
34
+ bundle install
35
+ cd ext && bundle exec rake
36
+
37
+ - uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
@@ -0,0 +1,16 @@
1
+ name: Verify Action Pins
2
+ on:
3
+ pull_request:
4
+ paths:
5
+ - '.github/workflows/**'
6
+ jobs:
7
+ verify:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
11
+ - name: Check SHA pins
12
+ run: |
13
+ if grep -E -r "uses: .*/.*@(v[0-9]+|main|master)($|[[:space:]]|$)" --include="*.yml" --include="*.yaml" .github/workflows/ | grep -v "#"; then
14
+ echo "::error::Actions should use SHA pins, not tags or branch names"
15
+ exit 1
16
+ fi
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ # Ignore bundler config.
2
+ /.bundle
3
+
4
+ Gemfile.lock
5
+ ext/ports
6
+ ext/tmp
7
+ ext/librdkafka.*
8
+ ext/build-tmp
9
+ *.gem
10
+ .yardoc
11
+ doc
12
+ coverage
13
+ vendor
14
+ .idea/
15
+ out/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --format documentation