pulsar-client 1.13.2 → 1.14.0-rc.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.
Files changed (68) hide show
  1. package/index.d.ts +17 -0
  2. package/package.json +1 -1
  3. package/pulsar-client-1.14.0-rc.1.tgz +0 -0
  4. package/src/Client.cc +2 -1
  5. package/src/Client.h +1 -0
  6. package/src/ConsumerConfig.cc +66 -0
  7. package/.clang-format +0 -26
  8. package/.eslintignore +0 -21
  9. package/.eslintrc.json +0 -22
  10. package/.github/PULL_REQUEST_TEMPLATE.md +0 -85
  11. package/.github/workflows/ci-build-release-napi.yml +0 -211
  12. package/.github/workflows/ci-pr-validation.yml +0 -334
  13. package/build-support/download-release-artifacts.py +0 -77
  14. package/build-support/generate-source-archive.sh +0 -28
  15. package/build-support/pulsar-test-container-start.sh +0 -43
  16. package/build-support/pulsar-test-service-start.sh +0 -39
  17. package/build-support/pulsar-test-service-stop.sh +0 -32
  18. package/build-support/sign-files.sh +0 -32
  19. package/build-support/stage-release.sh +0 -44
  20. package/docs/release-process.md +0 -291
  21. package/examples/certificate/private-key.client-rsa.pem +0 -27
  22. package/examples/certificate/public-key.client-rsa.pem +0 -9
  23. package/examples/consumer-schema.js +0 -66
  24. package/examples/consumer.js +0 -46
  25. package/examples/consumer_listener.js +0 -44
  26. package/examples/consumer_tls_auth.js +0 -51
  27. package/examples/consummer_token_auth.js +0 -50
  28. package/examples/consummer_token_auth_supplier.js +0 -56
  29. package/examples/custom_logger.js +0 -60
  30. package/examples/encryption-consumer.js +0 -47
  31. package/examples/encryption-producer.js +0 -50
  32. package/examples/encryption-reader.js +0 -44
  33. package/examples/producer-schema.js +0 -76
  34. package/examples/producer.js +0 -48
  35. package/examples/producer_tls_auth.js +0 -52
  36. package/examples/producer_token_auth.js +0 -48
  37. package/examples/producer_token_auth_supplier.js +0 -53
  38. package/examples/reader.js +0 -43
  39. package/examples/reader_listener.js +0 -37
  40. package/license-checker-config.json +0 -43
  41. package/license-header.txt +0 -16
  42. package/perf/perf_consumer.js +0 -103
  43. package/perf/perf_producer.js +0 -118
  44. package/pkg/linux/Dockerfile_linux_glibc +0 -31
  45. package/pkg/linux/Dockerfile_linux_musl +0 -32
  46. package/pkg/linux/build-napi-inside-docker.sh +0 -31
  47. package/pkg/linux/download-cpp-client.sh +0 -65
  48. package/pkg/load_test.js +0 -34
  49. package/pkg/mac/download-cpp-client.sh +0 -36
  50. package/pkg/windows/download-cpp-client.bat +0 -12
  51. package/tests/certificate/private-key.client-rsa.pem +0 -27
  52. package/tests/certificate/public-key.client-rsa.pem +0 -9
  53. package/tests/certificate/server.crt +0 -20
  54. package/tests/certificate/server.key +0 -28
  55. package/tests/client.test.js +0 -122
  56. package/tests/conf/standalone.conf +0 -308
  57. package/tests/consumer.test.js +0 -434
  58. package/tests/docker-load-test.sh +0 -35
  59. package/tests/end_to_end.test.js +0 -1447
  60. package/tests/http_utils.js +0 -45
  61. package/tests/load-test.sh +0 -43
  62. package/tests/producer.test.js +0 -160
  63. package/tests/reader.test.js +0 -175
  64. package/tests/run-unit-tests.sh +0 -35
  65. package/tsconfig.json +0 -22
  66. package/tslint.json +0 -9
  67. package/tstest.ts +0 -408
  68. package/typedoc.json +0 -15
package/index.d.ts CHANGED
@@ -103,6 +103,7 @@ export interface ConsumerConfig {
103
103
  regexSubscriptionMode?: RegexSubscriptionMode;
104
104
  deadLetterPolicy?: DeadLetterPolicy;
105
105
  batchReceivePolicy?: ConsumerBatchReceivePolicy;
106
+ keySharedPolicy?: KeySharedPolicy;
106
107
  }
107
108
 
108
109
  export class Consumer {
@@ -194,6 +195,18 @@ export interface ConsumerBatchReceivePolicy {
194
195
  timeoutMs?: number;
195
196
  }
196
197
 
198
+ export interface ConsumerKeyShareStickyRange {
199
+ start: number;
200
+ end: number;
201
+ }
202
+ export type ConsumerKeyShareStickyRanges = ConsumerKeyShareStickyRange[];
203
+
204
+ export interface KeySharedPolicy {
205
+ keyShareMode?: ConsumerKeyShareMode;
206
+ allowOutOfOrderDelivery?: boolean;
207
+ stickyRanges?: ConsumerKeyShareStickyRanges;
208
+ }
209
+
197
210
  export class AuthenticationTls {
198
211
  constructor(params: { certificatePath: string, privateKeyPath: string });
199
212
  }
@@ -296,6 +309,10 @@ export type ConsumerCryptoFailureAction =
296
309
  'DISCARD' |
297
310
  'CONSUME';
298
311
 
312
+ export type ConsumerKeyShareMode =
313
+ 'AutoSplit' |
314
+ 'Sticky';
315
+
299
316
  export type RegexSubscriptionMode =
300
317
  'PersistentOnly' |
301
318
  'NonPersistentOnly' |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulsar-client",
3
- "version": "1.13.2",
3
+ "version": "1.14.0-rc.2",
4
4
  "description": "Pulsar Node.js client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
Binary file
package/src/Client.cc CHANGED
@@ -144,7 +144,8 @@ Client::Client(const Napi::CallbackInfo &info) : Napi::ObjectWrap<Client>(info)
144
144
  if (clientConfig.Has(CFG_AUTH) && clientConfig.Get(CFG_AUTH).IsObject()) {
145
145
  Napi::Object obj = clientConfig.Get(CFG_AUTH).ToObject();
146
146
  if (obj.Has(CFG_AUTH_PROP) && obj.Get(CFG_AUTH_PROP).IsObject()) {
147
- Authentication *auth = Authentication::Unwrap(obj.Get(CFG_AUTH_PROP).ToObject());
147
+ this->authRef_ = Napi::Persistent(obj.Get(CFG_AUTH_PROP).As<Napi::Object>());
148
+ Authentication *auth = Authentication::Unwrap(this->authRef_.Value());
148
149
  pulsar_client_configuration_set_auth(cClientConfig.get(), auth->GetCAuthentication());
149
150
  }
150
151
  }
package/src/Client.h CHANGED
@@ -54,6 +54,7 @@ class Client : public Napi::ObjectWrap<Client> {
54
54
  std::shared_ptr<pulsar_client_t> cClient;
55
55
  std::shared_ptr<pulsar_client_configuration_t> cClientConfig;
56
56
  pulsar_logger_level_t logLevel = pulsar_logger_level_t::pulsar_INFO;
57
+ Napi::ObjectReference authRef_;
57
58
 
58
59
  Napi::Value CreateProducer(const Napi::CallbackInfo &info);
59
60
  Napi::Value Subscribe(const Napi::CallbackInfo &info);
@@ -21,6 +21,7 @@
21
21
  #include "Consumer.h"
22
22
  #include "SchemaInfo.h"
23
23
  #include "Message.h"
24
+ #include "pulsar/ConsumerConfiguration.h"
24
25
  #include <pulsar/c/consumer_configuration.h>
25
26
  #include <pulsar/c/consumer.h>
26
27
  #include <map>
@@ -55,6 +56,10 @@ static const std::string CFG_BATCH_RECEIVE_POLICY = "batchReceivePolicy";
55
56
  static const std::string CFG_BATCH_RECEIVE_POLICY_MAX_NUM_MESSAGES = "maxNumMessages";
56
57
  static const std::string CFG_BATCH_RECEIVE_POLICY_MAX_NUM_BYTES = "maxNumBytes";
57
58
  static const std::string CFG_BATCH_RECEIVE_POLICY_TIMEOUT_MS = "timeoutMs";
59
+ static const std::string CFG_KEY_SHARED_POLICY = "keySharedPolicy";
60
+ static const std::string CFG_KEY_SHARED_POLICY_MODE = "keyShareMode";
61
+ static const std::string CFG_KEY_SHARED_POLICY_ALLOW_OUT_OF_ORDER = "allowOutOfOrderDelivery";
62
+ static const std::string CFG_KEY_SHARED_POLICY_STICKY_RANGES = "stickyRanges";
58
63
 
59
64
  static const std::map<std::string, pulsar_consumer_type> SUBSCRIPTION_TYPE = {
60
65
  {"Exclusive", pulsar_ConsumerExclusive},
@@ -76,6 +81,15 @@ static const std::map<std::string, pulsar_consumer_crypto_failure_action> CONSUM
76
81
  {"CONSUME", pulsar_ConsumerConsume},
77
82
  };
78
83
 
84
+ static const std::map<std::string, pulsar::KeySharedMode> CONSUMER_KEY_SHARED_POLICY_MODE = {
85
+ {"AutoSplit", pulsar::KeySharedMode::AUTO_SPLIT},
86
+ {"Sticky", pulsar::KeySharedMode::STICKY},
87
+ };
88
+
89
+ struct _pulsar_consumer_configuration {
90
+ pulsar::ConsumerConfiguration consumerConfiguration;
91
+ };
92
+
79
93
  void FinalizeListenerCallback(Napi::Env env, MessageListenerCallback *cb, void *) { delete cb; }
80
94
 
81
95
  ConsumerConfig::ConsumerConfig()
@@ -324,6 +338,58 @@ void ConsumerConfig::InitConfig(std::shared_ptr<ThreadSafeDeferred> deferred,
324
338
  return;
325
339
  }
326
340
  }
341
+
342
+ if (consumerConfig.Has(CFG_KEY_SHARED_POLICY) && consumerConfig.Get(CFG_KEY_SHARED_POLICY).IsObject()) {
343
+ Napi::Object propObj = consumerConfig.Get(CFG_KEY_SHARED_POLICY).ToObject();
344
+ pulsar::KeySharedPolicy cppKeySharedPolicy;
345
+
346
+ if (propObj.Has(CFG_KEY_SHARED_POLICY_MODE) && propObj.Get(CFG_KEY_SHARED_POLICY_MODE).IsString()) {
347
+ std::string keyShareModeStr = propObj.Get(CFG_KEY_SHARED_POLICY_MODE).ToString().Utf8Value();
348
+ if (CONSUMER_KEY_SHARED_POLICY_MODE.count(keyShareModeStr)) {
349
+ cppKeySharedPolicy.setKeySharedMode(CONSUMER_KEY_SHARED_POLICY_MODE.at(keyShareModeStr));
350
+ }
351
+ }
352
+
353
+ if (propObj.Has(CFG_KEY_SHARED_POLICY_ALLOW_OUT_OF_ORDER) &&
354
+ propObj.Get(CFG_KEY_SHARED_POLICY_ALLOW_OUT_OF_ORDER).IsBoolean()) {
355
+ bool allowOutOfOrderDelivery = propObj.Get(CFG_KEY_SHARED_POLICY_ALLOW_OUT_OF_ORDER).ToBoolean();
356
+ cppKeySharedPolicy.setAllowOutOfOrderDelivery(allowOutOfOrderDelivery);
357
+ }
358
+
359
+ if (propObj.Has(CFG_KEY_SHARED_POLICY_STICKY_RANGES) &&
360
+ propObj.Get(CFG_KEY_SHARED_POLICY_STICKY_RANGES).IsArray()) {
361
+ Napi::Array rangesArray = propObj.Get(CFG_KEY_SHARED_POLICY_STICKY_RANGES).As<Napi::Array>();
362
+ pulsar::StickyRanges stickyRanges;
363
+ for (uint32_t i = 0; i < rangesArray.Length(); i++) {
364
+ if (rangesArray.Get(i).IsObject()) {
365
+ Napi::Object rangeObj = rangesArray.Get(i).ToObject();
366
+ if (rangeObj.Has("start") && rangeObj.Has("end") && rangeObj.Get("start").IsNumber() &&
367
+ rangeObj.Get("end").IsNumber()) {
368
+ int start = rangeObj.Get("start").ToNumber().Int32Value();
369
+ int end = rangeObj.Get("end").ToNumber().Int32Value();
370
+ if (start > end) {
371
+ std::string error = "Invalid sticky range at index " + std::to_string(i) + ": start (" +
372
+ std::to_string(start) + ") > end (" + std::to_string(end) + ")";
373
+ deferred->Reject(error);
374
+ return;
375
+ }
376
+ stickyRanges.emplace_back(start, end);
377
+ } else {
378
+ std::string error = "Invalid sticky range format at index " + std::to_string(i) +
379
+ ": missing 'start'/'end' or invalid type, should be number type";
380
+ deferred->Reject(error);
381
+ return;
382
+ }
383
+ } else {
384
+ std::string error = "Sticky range element at index " + std::to_string(i) + " is not an object";
385
+ deferred->Reject(error);
386
+ return;
387
+ }
388
+ }
389
+ cppKeySharedPolicy.setStickyRanges(stickyRanges);
390
+ }
391
+ this->cConsumerConfig.get()->consumerConfiguration.setKeySharedPolicy(cppKeySharedPolicy);
392
+ }
327
393
  }
328
394
 
329
395
  ConsumerConfig::~ConsumerConfig() {
package/.clang-format DELETED
@@ -1,26 +0,0 @@
1
- #
2
- # Licensed to the Apache Software Foundation (ASF) under one
3
- # or more contributor license agreements. See the NOTICE file
4
- # distributed with this work for additional information
5
- # regarding copyright ownership. The ASF licenses this file
6
- # to you under the Apache License, Version 2.0 (the
7
- # "License"); you may not use this file except in compliance
8
- # with the License. You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing,
13
- # software distributed under the License is distributed on an
14
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- # KIND, either express or implied. See the License for the
16
- # specific language governing permissions and limitations
17
- # under the License.
18
- #
19
-
20
- BasedOnStyle: Google
21
- IndentWidth: 2
22
- ColumnLimit: 110
23
- SortIncludes: false
24
- BreakBeforeBraces: Custom
25
- BraceWrapping:
26
- AfterEnum: true
package/.eslintignore DELETED
@@ -1,21 +0,0 @@
1
- #
2
- # Licensed to the Apache Software Foundation (ASF) under one
3
- # or more contributor license agreements. See the NOTICE file
4
- # distributed with this work for additional information
5
- # regarding copyright ownership. The ASF licenses this file
6
- # to you under the Apache License, Version 2.0 (the
7
- # "License"); you may not use this file except in compliance
8
- # with the License. You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing,
13
- # software distributed under the License is distributed on an
14
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- # KIND, either express or implied. See the License for the
16
- # specific language governing permissions and limitations
17
- # under the License.
18
- #
19
-
20
- examples
21
- perf
package/.eslintrc.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "extends": ["airbnb-base","plugin:jest/recommended"],
3
- "rules": {
4
- "class-methods-use-this": "warn",
5
- "no-await-in-loop": "warn",
6
- "no-console": "off",
7
- "no-unused-vars": "warn"
8
- },
9
- "overrides": [
10
- {
11
- "files": ["tests/*.js"],
12
- "rules": {
13
- "no-await-in-loop": "off"
14
- }
15
- }
16
- ],
17
- "globals": {
18
- "describe": true,
19
- "test": true,
20
- "expect": true
21
- }
22
- }
@@ -1,85 +0,0 @@
1
- <!--
2
-
3
- Licensed to the Apache Software Foundation (ASF) under one
4
- or more contributor license agreements. See the NOTICE file
5
- distributed with this work for additional information
6
- regarding copyright ownership. The ASF licenses this file
7
- to you under the Apache License, Version 2.0 (the
8
- "License"); you may not use this file except in compliance
9
- with the License. You may obtain a copy of the License at
10
-
11
- http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- Unless required by applicable law or agreed to in writing,
14
- software distributed under the License is distributed on an
15
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- KIND, either express or implied. See the License for the
17
- specific language governing permissions and limitations
18
- under the License.
19
-
20
- -->
21
- <!--
22
- ### Contribution Checklist
23
-
24
- - PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://docs.google.com/document/d/1d8Pw6ZbWk-_pCKdOmdvx9rnhPiyuxwq60_TrD68d7BA/edit#heading=h.trs9rsex3xom)*.
25
-
26
- - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
27
-
28
- - Each pull request should address only one issue, not mix up code from multiple issues.
29
-
30
- - Each commit in the pull request has a meaningful commit message
31
-
32
- - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
33
- -->
34
-
35
- <!-- Either this PR fixes an issue, -->
36
-
37
- Fixes #<xyz>
38
-
39
- <!-- or this PR is one task of an issue -->
40
-
41
- Master Issue: #<xyz>
42
-
43
- ### Motivation
44
-
45
- <!-- Explain here the context, and why you're making that change. What is the problem you're trying to solve. -->
46
-
47
- ### Modifications
48
-
49
- <!-- Describe the modifications you've done. -->
50
-
51
- ### Verifying this change
52
-
53
- - [ ] Make sure that the change passes the CI checks.
54
-
55
- *(Please pick either of the following options)*
56
-
57
- This change is a trivial rework / code cleanup without any test coverage.
58
-
59
- *(or)*
60
-
61
- This change is already covered by existing tests, such as *(please describe tests)*.
62
-
63
- *(or)*
64
-
65
- This change added tests and can be verified as follows:
66
-
67
- *(example:)*
68
- - *Added integration tests for end-to-end deployment with large payloads (10MB)*
69
- - *Extended integration test for recovery after broker failure*
70
-
71
- ### Documentation
72
-
73
- <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
74
-
75
- - [ ] `doc-required`
76
- (Your PR needs to update docs and you will update later)
77
-
78
- - [ ] `doc-not-needed`
79
- (Please explain why)
80
-
81
- - [ ] `doc`
82
- (Your PR contains doc changes)
83
-
84
- - [ ] `doc-complete`
85
- (Docs have been already added)
@@ -1,211 +0,0 @@
1
- #
2
- # Licensed to the Apache Software Foundation (ASF) under one
3
- # or more contributor license agreements. See the NOTICE file
4
- # distributed with this work for additional information
5
- # regarding copyright ownership. The ASF licenses this file
6
- # to you under the Apache License, Version 2.0 (the
7
- # "License"); you may not use this file except in compliance
8
- # with the License. You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing,
13
- # software distributed under the License is distributed on an
14
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- # KIND, either express or implied. See the License for the
16
- # specific language governing permissions and limitations
17
- # under the License.
18
- #
19
- name: Build release napi
20
- on:
21
- workflow_dispatch:
22
- push:
23
- tags:
24
- - '*'
25
- env:
26
- FORCE_COLOR: 1
27
- concurrency:
28
- group: ${{ github.head_ref || github.run_id }}
29
- cancel-in-progress: true
30
- jobs:
31
- macos-napi:
32
- name: Build NAPI macos - Node ${{matrix.nodejs}} - ${{matrix.arch}}
33
- runs-on: ${{ matrix.os }}
34
- timeout-minutes: 3000
35
-
36
- strategy:
37
- fail-fast: false
38
- matrix:
39
- arch:
40
- - x64
41
- - arm64
42
- nodejs:
43
- - 18
44
- python:
45
- - "3.10"
46
- include:
47
- - arch: x64
48
- os: macos-13
49
- - arch: arm64
50
- # macos-14 is used for arm64
51
- os: macos-14
52
- steps:
53
- - uses: actions/checkout@v3
54
- - name: Use Node.js ${{ matrix.nodejs }}
55
- uses: actions/setup-node@v3
56
- with:
57
- node-version: ${{ matrix.nodejs }}
58
- cache: 'npm'
59
-
60
- - name: Use Python ${{ matrix.python }}
61
- uses: actions/setup-python@v3
62
- with:
63
- python-version: ${{ matrix.python }}
64
-
65
- - name: Build Node binaries lib
66
- run: |
67
- if [ "${{ matrix.arch }}" = "x64" ]; then
68
- export ARCH=x86_64
69
- else
70
- export ARCH=${{ matrix.arch }}
71
- fi
72
- pkg/mac/download-cpp-client.sh
73
- npm install --ignore-scripts
74
- npx node-pre-gyp configure --target_arch=${{ matrix.arch }}
75
- npx node-pre-gyp build --target_arch=${{ matrix.arch }}
76
-
77
- - name: Test loading Node binaries lib
78
- run: |
79
- node pkg/load_test.js
80
-
81
- - name: Package Node binaries lib
82
- run: |
83
- npx node-pre-gyp package --target_arch=${{ matrix.arch }}
84
-
85
- - name: Upload artifacts
86
- uses: actions/upload-artifact@v4
87
- with:
88
- name: macos-${{matrix.nodejs}}-${{matrix.arch}}
89
- path: build/stage/*/*.tar.gz
90
-
91
- linux-napi:
92
- name: Build NAPI ${{matrix.image}} - Node ${{matrix.nodejs}} - ${{matrix.cpu.platform}}
93
- runs-on: ubuntu-22.04
94
- timeout-minutes: 3000
95
-
96
- strategy:
97
- fail-fast: false
98
- matrix:
99
- image:
100
- - 'linux_glibc'
101
- - 'linux_musl'
102
- nodejs:
103
- - 18
104
- cpu:
105
- - {arch: 'x86_64', platform: 'x86_64'}
106
- - {arch: 'aarch64', platform: 'arm64'}
107
-
108
- steps:
109
- - name: checkout
110
- uses: actions/checkout@v3
111
-
112
- - name: Set up QEMU
113
- uses: docker/setup-qemu-action@v2
114
-
115
- - name: Setup Docker Buildx
116
- uses: docker/setup-buildx-action@v2
117
-
118
- - name: Build Linux Docker image
119
- uses: docker/build-push-action@v3
120
- with:
121
- file: ./pkg/linux/Dockerfile_${{matrix.image}}
122
- load: true
123
- tags: build:latest
124
- platforms: linux/${{matrix.cpu.arch}}
125
- build-args: |
126
- PLATFORM=${{matrix.cpu.platform}}
127
- ARCH=${{matrix.cpu.arch}}
128
- NODE_VERSION=${{matrix.nodejs}}
129
- cache-from: type=gha
130
- cache-to: type=gha,mode=max
131
-
132
- - name: Build and Test NAPI file
133
- run: |
134
- docker run -i -v $PWD:/pulsar-client-node build:latest \
135
- /pulsar-client-node/pkg/linux/build-napi-inside-docker.sh
136
-
137
- - name: Upload artifacts
138
- uses: actions/upload-artifact@v4
139
- with:
140
- name: ${{matrix.image}}-${{matrix.nodejs}}-${{matrix.cpu.platform}}
141
- path: build/stage/*/*.tar.gz
142
-
143
- windows-napi:
144
- name: Build NAPI windows - Node ${{matrix.nodejs}} - ${{matrix.arch}}
145
- runs-on: windows-2022
146
- timeout-minutes: 3000
147
-
148
- strategy:
149
- fail-fast: false
150
- matrix:
151
- arch:
152
- - x64
153
- - x86
154
- nodejs:
155
- - 18
156
- python:
157
- - "3.10"
158
- steps:
159
- - uses: actions/checkout@v3
160
- - name: Use Node.js ${{ matrix.nodejs }}
161
- uses: actions/setup-node@v3
162
- with:
163
- node-version: ${{ matrix.nodejs }}
164
- architecture: ${{ matrix.arch }}
165
- cache: 'npm'
166
-
167
- - name: Use Python ${{ matrix.python }}
168
- uses: actions/setup-python@v3
169
- with:
170
- python-version: ${{ matrix.python }}
171
-
172
- - name: Cache CPP Client
173
- id: cache-dependencies
174
- uses: actions/cache@v3
175
- with:
176
- path: pkg/windows/
177
- key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('pulsar-client-cpp.txt') }}
178
-
179
- - name: Add env vars
180
- shell: bash
181
- run: |
182
- if [ "${{ matrix.arch }}" = "x86" ]; then
183
- echo "TARGET=ia32" >> $GITHUB_ENV
184
- else
185
- echo "TARGET=${{ matrix.arch }}" >> $GITHUB_ENV
186
- fi
187
-
188
- - name: Download CPP Client
189
- if: steps.cache-dependencies.outputs.cache-hit != 'true'
190
- run: |
191
- pkg/windows/download-cpp-client.bat ${{ matrix.arch }}
192
-
193
- - name: Build Node binaries lib
194
- run: |
195
- npm install --ignore-scripts
196
- npx node-pre-gyp configure --target_arch=${{ env.TARGET }}
197
- npx node-pre-gyp build --target_arch=${{ env.TARGET }}
198
-
199
- - name: Test loading Node binaries lib
200
- run: |
201
- node pkg/load_test.js
202
-
203
- - name: Package Node binaries lib
204
- run: |
205
- npx node-pre-gyp package --target_arch=${{ env.TARGET }}
206
-
207
- - name: Upload artifacts
208
- uses: actions/upload-artifact@v4
209
- with:
210
- name: windows-${{matrix.nodejs}}-${{matrix.arch}}
211
- path: build/stage/*/*.tar.gz