Skip to content

Commit 6271644

Browse files
benasher44claude
andcommitted
Fix native CI failures
Three issues surfaced on the first CI run: - WASM CI (ci.yml) broke because `native` was added to pnpm-workspace.yaml but the committed pnpm-lock.yaml has no native importer, so the frozen-lockfile install failed. The native package is standalone (npm + make, with unpublished platform optionalDependencies) and doesn't belong in the pnpm WASM monorepo. Remove it from the workspace. - glibc Linux jobs ran the Alpine `apk add` step and failed: the matrix derived musl from `!!v.libc`, but glibc platforms now carry `libc: ["glibc"]`. Detect musl via `(v.libc||[]).includes('musl')`. - musl builds wrote to prebuilds/linux-x64 (no suffix) because the Makefile's `ldd --version` parsing didn't detect musl in node:20-alpine, while the JS loader correctly looked in linux-x64-musl. Detect musl via the presence of /lib/ld-musl-*, make PLATFORM_KEY overridable, and pin it from the CI matrix (make build PLATFORM_KEY=<platform>). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 326e25d commit 6271644

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

.github/workflows/native-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
platform: key,
2424
runner: v.runner,
2525
container: v.container || '',
26-
musl: !!v.libc,
26+
musl: (v.libc || []).includes('musl'),
2727
}));
2828
console.log(JSON.stringify(matrix));
2929
")
@@ -57,7 +57,7 @@ jobs:
5757

5858
- name: Build native addon
5959
working-directory: native
60-
run: make build
60+
run: make build PLATFORM_KEY=${{ matrix.platform }}
6161

6262
- name: Build TypeScript
6363
working-directory: native

.github/workflows/native-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
platform: key,
3636
runner: v.runner,
3737
container: v.container || '',
38-
musl: !!v.libc,
38+
musl: (v.libc || []).includes('musl'),
3939
}));
4040
console.log(JSON.stringify(matrix));
4141
")

native/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ else
2222
NODE_ARCH := $(ARCH)
2323
endif
2424

25-
MUSL := $(shell ldd --version 2>&1 | grep -c musl 2>/dev/null || echo 0)
26-
ifeq ($(MUSL),1)
25+
# Detect musl libc (Alpine) by the presence of its dynamic loader.
26+
# More reliable than parsing `ldd --version`, which varies across distros.
27+
ifneq ($(wildcard /lib/ld-musl-*),)
2728
PLATFORM_SUFFIX := -musl
2829
else
2930
PLATFORM_SUFFIX :=
3031
endif
3132

32-
PLATFORM_KEY := $(PLATFORM)-$(NODE_ARCH)$(PLATFORM_SUFFIX)
33+
# PLATFORM_KEY can be overridden (e.g. `make build PLATFORM_KEY=linux-x64-musl`)
34+
# so CI can pin the output dir to the known target instead of relying on detection.
35+
PLATFORM_KEY ?= $(PLATFORM)-$(NODE_ARCH)$(PLATFORM_SUFFIX)
3336
CACHE_DIR := .cache/$(PLATFORM_KEY)
3437
LIBPG_QUERY_DIR := $(CACHE_DIR)/libpg_query
3538

pnpm-workspace.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
packages:
22
- 'parser'
33
- 'full'
4-
- 'native'
54
- 'versions/18'
65
- 'versions/17'
76
- 'versions/16'

0 commit comments

Comments
 (0)