Skip to content

Commit 6bd241f

Browse files
chore(@turbo/repository): no longer release glibc version (#10062)
### Description libgit2 doesn't like cross compilation so lets stop trying to do it ### Testing Instructions https://github.com/vercel/turborepo/actions/runs/13596017421
1 parent 3f43384 commit 6bd241f

File tree

6 files changed

+36
-97
lines changed

6 files changed

+36
-97
lines changed

.github/workflows/turborepo-library-release.yml

-30
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,6 @@ jobs:
2323
- host: macos-latest
2424
target: x86_64-apple-darwin
2525

26-
- host: ubuntu-latest
27-
target: aarch64-unknown-linux-gnu
28-
setup: |
29-
sudo apt update
30-
sudo apt install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross xz-utils
31-
mkdir zig
32-
curl --show-error --location https://ziglang.org/builds/zig-linux-x86_64-0.14.0-dev.3028+cdc9d65b0.tar.xz | tar -J -xf - -C zig --strip-components 1
33-
export PATH=$PATH:$(pwd)/zig
34-
echo "$(pwd)/zig" >> $GITHUB_PATH
35-
36-
- host: ubuntu-latest
37-
target: x86_64-unknown-linux-gnu
38-
container: amazon/aws-lambda-nodejs:20
39-
install: |
40-
microdnf install -y gcc gcc-c++ git tar xz
41-
curl https://sh.rustup.rs -sSf | bash -s -- -y
42-
43-
mkdir ../zig
44-
curl --show-error --location https://ziglang.org/builds/zig-linux-x86_64-0.14.0-dev.3028+cdc9d65b0.tar.xz | tar -J -xf - -C ../zig --strip-components 1
45-
export PATH=$PATH:$(pwd)/../zig
46-
echo "$(pwd)/../zig" >> $GITHUB_PATH
47-
setup: |
48-
pnpm install
49-
5026
- host: ubuntu-latest
5127
target: x86_64-unknown-linux-musl
5228
container: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-alpine
@@ -150,9 +126,7 @@ jobs:
150126
run: |
151127
mv native-packages/turbo-library-aarch64-apple-darwin/@turbo/repository.darwin-arm64.node packages/turbo-repository/npm/darwin-arm64/
152128
mv native-packages/turbo-library-x86_64-apple-darwin/@turbo/repository.darwin-x64.node packages/turbo-repository/npm/darwin-x64/
153-
mv native-packages/turbo-library-aarch64-unknown-linux-gnu/@turbo/repository.linux-arm64-gnu.node packages/turbo-repository/npm/linux-arm64-gnu/
154129
mv native-packages/turbo-library-aarch64-unknown-linux-musl/@turbo/repository.linux-arm64-musl.node packages/turbo-repository/npm/linux-arm64-musl/
155-
mv native-packages/turbo-library-x86_64-unknown-linux-gnu/@turbo/repository.linux-x64-gnu.node packages/turbo-repository/npm/linux-x64-gnu/
156130
mv native-packages/turbo-library-x86_64-unknown-linux-musl/@turbo/repository.linux-x64-musl.node packages/turbo-repository/npm/linux-x64-musl/
157131
mv native-packages/turbo-library-aarch64-pc-windows-msvc/@turbo/repository.win32-arm64-msvc.node packages/turbo-repository/npm/win32-arm64-msvc/
158132
mv native-packages/turbo-library-x86_64-pc-windows-msvc/@turbo/repository.win32-x64-msvc.node packages/turbo-repository/npm/win32-x64-msvc/
@@ -167,9 +141,7 @@ jobs:
167141
mkdir tarballs
168142
npm pack packages/turbo-repository/npm/darwin-arm64
169143
npm pack packages/turbo-repository/npm/darwin-x64
170-
npm pack packages/turbo-repository/npm/linux-arm64-gnu
171144
npm pack packages/turbo-repository/npm/linux-arm64-musl
172-
npm pack packages/turbo-repository/npm/linux-x64-gnu
173145
npm pack packages/turbo-repository/npm/linux-x64-musl
174146
npm pack packages/turbo-repository/npm/win32-arm64-msvc
175147
npm pack packages/turbo-repository/npm/win32-x64-msvc
@@ -194,9 +166,7 @@ jobs:
194166
TAG="canary"
195167
npm publish -ddd --tag ${TAG} --access public turbo-repository-darwin-arm64-${VERSION}.tgz
196168
npm publish -ddd --tag ${TAG} --access public turbo-repository-darwin-x64-${VERSION}.tgz
197-
npm publish -ddd --tag ${TAG} --access public turbo-repository-linux-arm64-gnu-${VERSION}.tgz
198169
npm publish -ddd --tag ${TAG} --access public turbo-repository-linux-arm64-musl-${VERSION}.tgz
199-
npm publish -ddd --tag ${TAG} --access public turbo-repository-linux-x64-gnu-${VERSION}.tgz
200170
npm publish -ddd --tag ${TAG} --access public turbo-repository-linux-x64-musl-${VERSION}.tgz
201171
npm publish -ddd --tag ${TAG} --access public turbo-repository-win32-arm64-msvc-${VERSION}.tgz
202172
npm publish -ddd --tag ${TAG} --access public turbo-repository-win32-x64-msvc-${VERSION}.tgz

.github/workflows/turborepo-native-lib-test.yml

+21-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
os:
2323
- name: ubuntu
2424
runner: ubuntu-latest
25+
target: x86_64-unknown-linux-musl
2526
- name: macos
2627
runner: macos-latest
2728
node-version:
@@ -50,12 +51,31 @@ jobs:
5051
github-token: "${{ secrets.GITHUB_TOKEN }}"
5152
node-version: ${{ matrix.node-version }}
5253

54+
# If we're on Linux we need to force musl as that's what napi uses to decide the target
55+
- name: Setup compile target
56+
if: ${{ matrix.os.target != '' }}
57+
run: |
58+
sudo apt-get update
59+
sudo apt-get install -y build-essential clang lldb llvm libclang-dev curl musl-tools
60+
rustup show active-toolchain
61+
rustup target add ${{ matrix.os.target }}
62+
5363
- name: Install Global Turbo
5464
uses: ./.github/actions/install-global-turbo
5565

5666
- name: Run tests
67+
if: ${{ matrix.os.target == '' }}
68+
# Manually set TURBO_API to an empty string to override Hetzner env
69+
run: |
70+
turbo run test --filter "turborepo-repository" --color
71+
env:
72+
NODE_VERSION: ${{ matrix.node-version }}
73+
74+
- name: Run tests
75+
if: ${{ matrix.os.target != '' }}
5776
# Manually set TURBO_API to an empty string to override Hetzner env
5877
run: |
59-
TURBO_API= turbo run test --filter "turborepo-repository" --color --env-mode=strict
78+
turbo run test --filter "turborepo-repository" --color
6079
env:
6180
NODE_VERSION: ${{ matrix.node-version }}
81+
CARGO_BUILD_TARGET: ${{ matrix.os.target }}

packages/turbo-repository/js/index.js

+9-60
Original file line numberDiff line numberDiff line change
@@ -10,44 +10,6 @@ const { join } = require("path");
1010
const { platform, arch } = process;
1111

1212
let nativeBinding = null;
13-
let localFileExisted = false;
14-
let loadError = null;
15-
16-
function isMusl() {
17-
// For Node 10
18-
if (!process.report || typeof process.report.getReport !== "function") {
19-
try {
20-
const lddPath = require("child_process")
21-
.execSync("which ldd")
22-
.toString()
23-
.trim();
24-
return readFileSync(lddPath, "utf8").includes("musl");
25-
} catch (e) {
26-
return true;
27-
}
28-
} else {
29-
const orig = process.report.excludeNetwork;
30-
process.report.excludeNetwork = true;
31-
const { glibcVersionRuntime } = process.report.getReport().header;
32-
process.report.excludeNetwork = orig;
33-
if (typeof glibcVersionRuntime === "string") {
34-
try {
35-
// We support glibc v2.26+
36-
let [major, minor] = glibcVersionRuntime.split(".", 2);
37-
if (parseInt(major, 10) !== 2) {
38-
return true;
39-
}
40-
if (parseInt(minor, 10) < 26) {
41-
return true;
42-
}
43-
return false;
44-
} catch (e) {
45-
return true;
46-
}
47-
}
48-
return !glibcVersionRuntime;
49-
}
50-
}
5113

5214
// TODO: find-up to turbo-repository? This currently only works from turbo-repository/js/dist
5315
const localPath = join(__dirname, "..", "..", "native", "@turbo");
@@ -88,28 +50,15 @@ switch (platform) {
8850
}
8951
break;
9052
case "linux":
91-
if (isMusl()) {
92-
switch (arch) {
93-
case "x64":
94-
suffix = "linux-x64-musl";
95-
break;
96-
case "arm64":
97-
suffix = "linux-arm64-musl";
98-
break;
99-
default:
100-
throw new Error(`Unsupported architecture on Linux: ${arch}`);
101-
}
102-
} else {
103-
switch (arch) {
104-
case "x64":
105-
suffix = "linux-x64-gnu";
106-
break;
107-
case "arm64":
108-
suffix = "linux-arm64-gnu";
109-
break;
110-
default:
111-
throw new Error(`Unsupported architecture on Linux: ${arch}`);
112-
}
53+
switch (arch) {
54+
case "x64":
55+
suffix = "linux-x64-musl";
56+
break;
57+
case "arm64":
58+
suffix = "linux-arm64-musl";
59+
break;
60+
default:
61+
throw new Error(`Unsupported architecture on Linux: ${arch}`);
11362
}
11463
break;
11564
default:

packages/turbo-repository/js/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
"optionalDependencies": {
1818
"@turbo/repository-darwin-x64": "0.0.1-canary.11",
1919
"@turbo/repository-darwin-arm64": "0.0.1-canary.11",
20-
"@turbo/repository-linux-x64-gnu": "0.0.1-canary.11",
21-
"@turbo/repository-linux-arm64-gnu": "0.0.1-canary.11",
2220
"@turbo/repository-linux-x64-musl": "0.0.1-canary.11",
2321
"@turbo/repository-linux-arm64-musl": "0.0.1-canary.11",
2422
"@turbo/repository-win32-x64-msvc": "0.0.1-canary.11",

packages/turbo-repository/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
"napi": {
2525
"name": "@turbo/repository",
2626
"triples": {
27-
"defaults": true,
27+
"defaults": false,
2828
"additional": [
2929
"x86_64-apple-darwin",
3030
"aarch64-apple-darwin",
31-
"x86_64-unknown-linux-gnu",
32-
"aarch64-unknown-linux-gnu",
31+
"x86_64-unknown-linux-musl",
32+
"aarch64-unknown-linux-musl",
3333
"x86_64-pc-windows-msvc",
3434
"aarch64-pc-windows-msvc"
3535
]

packages/turbo-repository/turbo.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"tasks": {
55
"build": {
66
"dependsOn": ["cli#rust-src"],
7-
"env": ["NODE_VERSION"]
7+
"env": ["NODE_VERSION", "CARGO_BUILD_TARGET"],
8+
// napi swallow compile errors so we cannot cache as we might save a failure
9+
"cache": false
810
},
911
"test": {
1012
"dependsOn": ["build"]

0 commit comments

Comments
 (0)