Skip to content

Commit eb08eaf

Browse files
committed
feat: merge upstream
2 parents 272246b + aba2011 commit eb08eaf

15 files changed

Lines changed: 4089 additions & 57 deletions

.github/workflows/npm-publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Publish node-rdkafka
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
publish-npm:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
submodules: recursive
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
registry-url: https://registry.npmjs.org/
21+
cache: "npm"
22+
- run: npm ci
23+
- run: npm publish
24+
env:
25+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build & Test
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
pull_request:
7+
branches: ["master"]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
node: [14, 16, 18, 19]
14+
os: [ubuntu-22.04]
15+
include:
16+
# single mac test due to minute multipliers
17+
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions
18+
- node: 18
19+
os: macos-12
20+
# single windows test due to node.js 14 node-gyp / vs 2022 issues
21+
- node: 18
22+
os: windows-2022
23+
runs-on: ${{ matrix.os }}
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
submodules: recursive
28+
- name: Install Node ${{ matrix.node }} in ${{ runner.os }}
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: ${{ matrix.node }}
32+
cache: "npm"
33+
- name: Install Windows packages
34+
if: runner.os == 'Windows'
35+
run: ./win_install.ps1
36+
- name: Build
37+
run: npm ci
38+
# skipping on windows for now due to Make / mocha exit code issues
39+
- name: Test
40+
if: runner.os != 'Windows'
41+
run: npm test

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,9 @@ Steps to update:
220220
1. Run end to end tests: `npm run test:e2e`. This requires running kafka & zookeeper locally.
221221
222222
1. Update the version numbers referenced in the [`README.md`](https://github.com/Blizzard/node-rdkafka/blob/master/README.md) file to the new version.
223+
224+
## Publishing new npm version
225+
226+
1. Increment the `version` in `package.json` and merge that change in.
227+
228+
1. Create a new github release. Set the tag & release title to the same string as `version` in `package.json`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Windows build **is not** compiled from `librdkafka` source but it is rather link
6767
>>>>>>> 52b40e99abc811b2c4be1d3e62dd021e4bb1f6d4
6868
6969
Requirements:
70-
* [node-gyp for Windows](https://github.com/nodejs/node-gyp#on-windows) (the easies way to get it: `npm install --global --production windows-build-tools`, if your node version is 6.x or below, please use `npm install --global --production windows-build-tools@3.1.0`)
70+
* [node-gyp for Windows](https://github.com/nodejs/node-gyp#on-windows)
7171

7272
**Note:** I _still_ do not recommend using `node-rdkafka` in production on Windows. This feature was in high demand and is provided to help develop, but we do not test against Windows, and windows support may lag behind Linux/Mac support because those platforms are the ones used to develop this library. Contributors are welcome if any Windows issues are found :)
7373

binding.gyp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
}
4444
],
4545
'cflags_cc' : [
46-
'-std=c++14'
46+
'-std=c++17'
4747
],
4848
'msvs_settings': {
4949
'VCLinkerTool': {
@@ -122,7 +122,7 @@
122122
'OS=="linux"',
123123
{
124124
'cflags_cc' : [
125-
'-std=c++14'
125+
'-std=c++17'
126126
],
127127
'cflags_cc!': [
128128
'-fno-rtti'
@@ -140,7 +140,7 @@
140140
],
141141
'OTHER_CPLUSPLUSFLAGS': [
142142
'-I/usr/local/opt/openssl/include',
143-
'-std=c++14'
143+
'-std=c++17'
144144
],
145145
},
146146
}

ci/update-version.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function parseVersion(tag) {
1111
const { major, minor, prerelease, patch } = semver.parse(tag);
1212

1313
// Describe will give is commits since last tag
14-
const [ commitsSinceTag, hash ] = prerelease[0] ? prerelease[0].split('-') : [
14+
const [commitsSinceTag, hash] = prerelease[0] ? prerelease[0].split('-') : [
1515
1,
1616
process.env.TRAVIS_COMMIT || ''
1717
];
@@ -84,19 +84,23 @@ function getBranch(cb) {
8484
}
8585

8686
function getPackageVersion(tag, branch) {
87-
let baseVersion = `v${tag.major}.${tag.minor}.${tag.patch}`;
87+
const baseVersion = `v${tag.major}.${tag.minor}.${tag.patch}`;
8888

89-
if (tag.commit === 0 && branch === 'master') {
90-
return baseVersion;
91-
}
89+
console.log(`Package version is "${baseVersion}"`);
9290

93-
baseVersion += '-';
91+
// never publish with an suffix
92+
// fixes https://github.com/Blizzard/node-rdkafka/issues/981
93+
// baseVersion += '-';
9494

95-
if (branch !== 'master') {
96-
baseVersion += (tag.commit + 1 + '.' + branch);
97-
} else {
98-
baseVersion += (tag.commit + 1);
99-
}
95+
// if (tag.commit === 0 && branch === 'master') {
96+
// return baseVersion;
97+
// }
98+
99+
// if (branch !== 'master') {
100+
// baseVersion += (tag.commit + 1 + '.' + branch);
101+
// } else {
102+
// baseVersion += (tag.commit + 1);
103+
// }
100104

101105
return baseVersion;
102106
}

lib/kafka-consumer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ KafkaConsumer.prototype.unsubscribe = function() {
385385
* is fetched.
386386
*/
387387
KafkaConsumer.prototype.consume = function(number, cb) {
388-
var timeoutMs = this._consumeTimeout || DEFAULT_CONSUME_TIME_OUT;
388+
var timeoutMs = this._consumeTimeout !== undefined ? this._consumeTimeout : DEFAULT_CONSUME_TIME_OUT;
389389
var self = this;
390390

391391
if ((number && typeof number === 'number') || (number && cb)) {

0 commit comments

Comments
 (0)