Skip to content

Commit 755dafb

Browse files
committed
Add windows package build
1 parent 3e36c0b commit 755dafb

File tree

5 files changed

+87
-5
lines changed

5 files changed

+87
-5
lines changed

.semaphore/semaphore.yml

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ global_job_config:
2929
- cd deps/librdkafka
3030
- git fetch origin
3131
- cd ../../
32-
- export MKL_DEBUG=1
32+
- cache clear
3333

3434
blocks:
3535
- name: "Linux amd64 (musl): Build and test"
@@ -303,13 +303,90 @@ blocks:
303303
- ls build/stage/${SEMAPHORE_GIT_TAG_NAME}/${ARTIFACT_KEY}
304304
- artifact push workflow "build/stage/${SEMAPHORE_GIT_TAG_NAME}/${ARTIFACT_KEY}" --destination "releases/${SEMAPHORE_GIT_TAG_NAME}/${ARTIFACT_KEY}"
305305

306+
- name: "Windows x64: Release"
307+
dependencies: [ ]
308+
# run:
309+
# when: "tag =~ '^v[0-9]\\.'"
310+
task:
311+
agent:
312+
machine:
313+
type: s1-prod-windows
314+
env_vars:
315+
# Disable vcpkg telemetry
316+
- name: VCPKG_DISABLE_METRICS
317+
value: 'yes'
318+
- name: ARCHITECTURE
319+
value: "x64"
320+
- name: PLATFORM
321+
value: "win32"
322+
- name: LIBC
323+
value: "unknown"
324+
prologue:
325+
commands:
326+
# The semaphore agent already comes with an installed version of node. We, however, need to use a different
327+
# version of node for the release (as many as we need to cover all the different ABIs).
328+
# The node installer does not allow us to downgrade, so we need to uninstall the current version.
329+
# The method below isn't particularly robust (as it depends on the particular format of the URL), but it
330+
# works and can be easily fixed if it breaks (the node --version in the below jobs can be checked if there are
331+
# any issues in the build).
332+
- $env:InstalledMajor = (Get-Command node).Version.Major
333+
- $env:InstalledMinor = (Get-Command node).Version.Minor
334+
- $env:InstalledBuild = (Get-Command node).Version.Build
335+
- $env:InstalledVersion = "v${env:InstalledMajor}.${env:InstalledMinor}.${env:InstalledBuild}"
336+
- echo "https://nodejs.org/dist/${env:InstalledVersion}/node-${env:InstalledVersion}-x64.msi"
337+
- Invoke-WebRequest "https://nodejs.org/dist/${env:InstalledVersion}/node-${env:InstalledVersion}-x64.msi" -OutFile node_old.msi
338+
- msiexec /qn /l* node-old-log.txt /uninstall node_old.msi
339+
- cat .\node-old-log.txt
340+
jobs:
341+
- name: "Release: LTS:18"
342+
commands:
343+
- Invoke-WebRequest "https://nodejs.org/download/release/v18.19.0/node-v18.19.0-x64.msi" -OutFile node.msi
344+
- msiexec /qn /l* node-log.txt /i node.msi
345+
- cat .\node-log.txt
346+
- node --version
347+
- pip install setuptools
348+
- $env:NODE_ABI = 108
349+
- $env:ARTIFACT_KEY = "confluent-kafka-javascript-${env:SEMAPHORE_GIT_TAG_NAME}-node-v${env:NODE_ABI}-${env:PLATFORM}-${env:LIBC}-${env:ARCHITECTURE}.tar.gz"
350+
- echo "$env:ARTIFACT_KEY"
351+
- npm install # node-pre-gyp will fallback to build here, because new tag implies no release yet.
352+
- npx node-pre-gyp package
353+
- ls "build/stage/${env:SEMAPHORE_GIT_TAG_NAME}/${env:ARTIFACT_KEY}"
354+
- artifact push workflow "build/stage/${env:SEMAPHORE_GIT_TAG_NAME}/${env:ARTIFACT_KEY}" --destination "releases/${env:SEMAPHORE_GIT_TAG_NAME}/${env:ARTIFACT_KEY}"
355+
- name: "Release: LTS:20"
356+
commands:
357+
- Invoke-WebRequest "https://nodejs.org/dist/v20.11.0/node-v20.11.0-x64.msi" -OutFile node.msi
358+
- msiexec /qn /l* node-log.txt /i node.msi
359+
- node --version
360+
- pip install setuptools
361+
- $env:NODE_ABI = 115
362+
- $env:ARTIFACT_KEY = "confluent-kafka-javascript-${env:SEMAPHORE_GIT_TAG_NAME}-node-v${env:NODE_ABI}-${env:PLATFORM}-${env:LIBC}-${env:ARCHITECTURE}.tar.gz"
363+
- echo "$env:ARTIFACT_KEY"
364+
- npm install # node-pre-gyp will fallback to build here, because new tag implies no release yet.
365+
- npx node-pre-gyp package
366+
- ls "build/stage/${env:SEMAPHORE_GIT_TAG_NAME}/${env:ARTIFACT_KEY}"
367+
- artifact push workflow "build/stage/${env:SEMAPHORE_GIT_TAG_NAME}/${env:ARTIFACT_KEY}" --destination "releases/${env:SEMAPHORE_GIT_TAG_NAME}/${env:ARTIFACT_KEY}"
368+
- name: "Release: latest: 21"
369+
commands:
370+
- Invoke-WebRequest "https://nodejs.org/dist/v21.6.1/node-v21.6.1-x64.msi" -OutFile node.msi
371+
- msiexec /qn /l* node-log.txt /i node.msi
372+
- node --version
373+
- pip install setuptools
374+
- $env:NODE_ABI = 120
375+
- $env:ARTIFACT_KEY = "confluent-kafka-javascript-${env:SEMAPHORE_GIT_TAG_NAME}-node-v${env:NODE_ABI}-${env:PLATFORM}-${env:LIBC}-${env:ARCHITECTURE}.tar.gz"
376+
- echo "$env:ARTIFACT_KEY"
377+
- npm install # node-pre-gyp will fallback to build here, because new tag implies no release yet.
378+
- npx node-pre-gyp package
379+
- ls "build/stage/${env:SEMAPHORE_GIT_TAG_NAME}/${env:ARTIFACT_KEY}"
380+
- artifact push workflow "build/stage/${env:SEMAPHORE_GIT_TAG_NAME}/${env:ARTIFACT_KEY}" --destination "releases/${env:SEMAPHORE_GIT_TAG_NAME}/${env:ARTIFACT_KEY}"
381+
306382
- name: 'Packaging: tar all release artifacts'
307383
dependencies:
308384
- 'Linux amd64: Release'
309385
- 'Linux arm64: Release'
310386
- 'Linux amd64 musl: Release'
311387
- 'Linux arm64 musl: Release'
312388
- 'macOS arm64/m1: Release'
389+
- 'Windows x64: Release'
313390
run:
314391
when: "tag =~ '^v[0-9]\\.'"
315392
task:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The following configurations are supported for this early access preview:
3434
Installation on any of these platforms is meant to be seamless, without any C/C++ compilation required. It can be installed from GitHub:
3535

3636
```bash
37-
$ npm install "git+ssh://[email protected]/confluentinc/confluent-kafka-javascript.git#v0.1.7-devel"
37+
$ npm install "git+ssh://[email protected]/confluentinc/confluent-kafka-javascript.git#v0.1.8-devel"
3838
```
3939

4040
Yarn and pnpm support is experimental.

deps/windows-install.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
import os
55
import glob
66

7+
# Note: we're using the key 'librdkafka_win' for now since NuGet packages are not
8+
# available for librdkafka on master. This will be changed to 'librdkafka' once
9+
# we're out of early access, and we use the latest version of librdkafka rather
10+
# than master.
711
with open('../package.json') as f:
8-
librdkafkaVersion = json.load(f)['librdkafka']
12+
librdkafkaVersion = json.load(f)['librdkafka_win']
913
librdkafkaWinSufix = '7' if librdkafkaVersion == '0.11.5' else '';
1014

1115
depsPrecompiledDir = '../deps/precompiled'

lib/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var util = require('util');
1414
var Kafka = require('../librdkafka.js');
1515
var assert = require('assert');
1616

17-
const bindingVersion = 'v0.1.7-devel';
17+
const bindingVersion = 'v0.1.8-devel';
1818

1919
var LibrdKafkaError = require('./error');
2020

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "confluent-kafka-javascript",
3-
"version": "v0.1.7-devel",
3+
"version": "v0.1.8-devel",
44
"description": "Node.js bindings for librdkafka",
55
"librdkafka": "master",
6+
"librdkafka_win": "2.3.0",
67
"main": "lib/index.js",
78
"types": "types/index.d.ts",
89
"scripts": {

0 commit comments

Comments
 (0)