From 93ec7287623eb76bccae3f21cdc7e356239d3218 Mon Sep 17 00:00:00 2001 From: Attila Szegedi Date: Mon, 4 May 2026 17:40:44 +0200 Subject: [PATCH] feat(ci): build and ship Windows x64 prebuilds Adds win32-x64 to the action-prebuildify "only" filter on both build and release workflows. Two supporting fixes for the Windows artifact pipeline: - scripts/copy-artifacts.js now preserves the .exe extension on Windows when copying Rust [[bin]] outputs (e.g. crashtracker-receiver), so the file remains executable after CreateProcess. - load.js's binary-finder appends .exe on Windows when looking up binaries (both in build/Release and in prebuilds/win32-x64), so callers like libdatadog.find('crashtracker-receiver', true) resolve to the right file. Upstream libdd-crashtracker (libdatadog v29) already supports Windows via its collector_windows feature; the receiver binary is a no-op stub on non-unix targets but still needs to be a real .exe for the in-process collector path to accept the receiver path. --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- load.js | 5 +++-- scripts/copy-artifacts.js | 4 +++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d49c42a..705d712 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: cache: false min-node-version: 18 rust: true - only: darwin-arm64,darwin-x64,linux-arm64,linux-x64 + only: darwin-arm64,darwin-x64,linux-arm64,linux-x64,windows-x64 # Need this, now that libdatadog packages libunwind as a submodule prebuild: '(command -v apk >/dev/null && apk add autoconf automake libtool) || (command -v apt-get >/dev/null && apt-get update && apt-get install -y autoconf automake libtool) || true' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6abf54..1734f68 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: cache: false min-node-version: 18 rust: true - only: darwin-arm64,darwin-x64,linux-arm64,linux-x64 + only: darwin-arm64,darwin-x64,linux-arm64,linux-x64,windows-x64 publish: runs-on: ubuntu-latest diff --git a/load.js b/load.js index 69cdca5..ae18c07 100644 --- a/load.js +++ b/load.js @@ -10,6 +10,7 @@ const PLATFORM = os.platform() const ARCH = process.arch const LIBC = PLATFORM === 'linux' ? (existsSync('/etc/alpine-release') ? 'musl' : 'glibc') : '' const ABI = process.versions.modules +const EXE_SUFFIX = PLATFORM === 'win32' ? '.exe' : '' const inWebpack = typeof __webpack_require__ === 'function' const runtimeRequire = inWebpack ? __non_webpack_require__ : require @@ -52,7 +53,7 @@ function find (name, binary = false) { // Only apply hyphen-to-underscore conversion for .node libraries, not binaries const transformedName = binary ? name : name.replaceAll('-', '_') - const filename = binary ? transformedName : `${transformedName}.node` + const filename = binary ? `${transformedName}${EXE_SUFFIX}` : `${transformedName}.node` const build = `${root}/build/Release/${filename}` if (existsSync(build)) return build @@ -84,7 +85,7 @@ function findFolder (root) { function findFile (root, name, binary = false) { const files = readdirSync(root) - if (binary) return files.find(f => f === name) + if (binary) return files.find(f => f === `${name}${EXE_SUFFIX}`) return files.find(f => f === `${name}-${ABI}.node`) || files.find(f => f === `${name}-napi.node`) diff --git a/scripts/copy-artifacts.js b/scripts/copy-artifacts.js index e765123..83cd839 100644 --- a/scripts/copy-artifacts.js +++ b/scripts/copy-artifacts.js @@ -13,13 +13,15 @@ const lineReader = readline.createInterface({ input: fs.createReadStream(outPath), }) +const exeSuffix = process.platform === 'win32' ? '.exe' : '' + lineReader.on('line', function (line) { const { filenames, reason, target } = JSON.parse(line) if (reason !== 'compiler-artifact') return if (!target.src_path.startsWith(cratesPath)) return - const filename = target.kind[0] === 'bin' ? target.name : `${target.name}.node` + const filename = target.kind[0] === 'bin' ? `${target.name}${exeSuffix}` : `${target.name}.node` const filePath = path.join(buildPath, filename) fs.mkdirSync(buildPath, { recursive: true })