Skip to content

Commit 907b90c

Browse files
Revert "chore(@turbo/repository): no longer release glibc version (#10062)"
This reverts commit 2b86fc8.
1 parent 5563f6a commit 907b90c

File tree

6 files changed

+98
-39
lines changed

6 files changed

+98
-39
lines changed

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

+30
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,30 @@ 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+
2650
- host: ubuntu-latest
2751
target: x86_64-unknown-linux-musl
2852
container: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-alpine
@@ -126,7 +150,9 @@ jobs:
126150
run: |
127151
mv native-packages/turbo-library-aarch64-apple-darwin/@turbo/repository.darwin-arm64.node packages/turbo-repository/npm/darwin-arm64/
128152
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/
129154
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/
130156
mv native-packages/turbo-library-x86_64-unknown-linux-musl/@turbo/repository.linux-x64-musl.node packages/turbo-repository/npm/linux-x64-musl/
131157
mv native-packages/turbo-library-aarch64-pc-windows-msvc/@turbo/repository.win32-arm64-msvc.node packages/turbo-repository/npm/win32-arm64-msvc/
132158
mv native-packages/turbo-library-x86_64-pc-windows-msvc/@turbo/repository.win32-x64-msvc.node packages/turbo-repository/npm/win32-x64-msvc/
@@ -141,7 +167,9 @@ jobs:
141167
mkdir tarballs
142168
npm pack packages/turbo-repository/npm/darwin-arm64
143169
npm pack packages/turbo-repository/npm/darwin-x64
170+
npm pack packages/turbo-repository/npm/linux-arm64-gnu
144171
npm pack packages/turbo-repository/npm/linux-arm64-musl
172+
npm pack packages/turbo-repository/npm/linux-x64-gnu
145173
npm pack packages/turbo-repository/npm/linux-x64-musl
146174
npm pack packages/turbo-repository/npm/win32-arm64-msvc
147175
npm pack packages/turbo-repository/npm/win32-x64-msvc
@@ -166,7 +194,9 @@ jobs:
166194
TAG="canary"
167195
npm publish -ddd --tag ${TAG} --access public turbo-repository-darwin-arm64-${VERSION}.tgz
168196
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
169198
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
170200
npm publish -ddd --tag ${TAG} --access public turbo-repository-linux-x64-musl-${VERSION}.tgz
171201
npm publish -ddd --tag ${TAG} --access public turbo-repository-win32-arm64-msvc-${VERSION}.tgz
172202
npm publish -ddd --tag ${TAG} --access public turbo-repository-win32-x64-msvc-${VERSION}.tgz

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

+1-21
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
os:
2323
- name: ubuntu
2424
runner: ubuntu-latest
25-
target: x86_64-unknown-linux-musl
2625
- name: macos
2726
runner: macos-latest
2827
node-version:
@@ -51,31 +50,12 @@ jobs:
5150
github-token: "${{ secrets.GITHUB_TOKEN }}"
5251
node-version: ${{ matrix.node-version }}
5352

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-
6353
- name: Install Global Turbo
6454
uses: ./.github/actions/install-global-turbo
6555

6656
- 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 != '' }}
7657
# Manually set TURBO_API to an empty string to override Hetzner env
7758
run: |
78-
turbo run test --filter "turborepo-repository" --color
59+
TURBO_API= turbo run test --filter "turborepo-repository" --color --env-mode=strict
7960
env:
8061
NODE_VERSION: ${{ matrix.node-version }}
81-
CARGO_BUILD_TARGET: ${{ matrix.os.target }}

packages/turbo-repository/js/index.js

+60-9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,44 @@ 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+
}
1351

1452
// TODO: find-up to turbo-repository? This currently only works from turbo-repository/js/dist
1553
const localPath = join(__dirname, "..", "..", "native", "@turbo");
@@ -50,15 +88,28 @@ switch (platform) {
5088
}
5189
break;
5290
case "linux":
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}`);
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+
}
62113
}
63114
break;
64115
default:

packages/turbo-repository/js/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
"optionalDependencies": {
1818
"@turbo/repository-darwin-x64": "0.0.1-canary.12",
1919
"@turbo/repository-darwin-arm64": "0.0.1-canary.12",
20+
"@turbo/repository-linux-x64-gnu": "0.0.1-canary.12",
21+
"@turbo/repository-linux-arm64-gnu": "0.0.1-canary.12",
2022
"@turbo/repository-linux-x64-musl": "0.0.1-canary.12",
2123
"@turbo/repository-linux-arm64-musl": "0.0.1-canary.12",
2224
"@turbo/repository-win32-x64-msvc": "0.0.1-canary.12",
23-
"@turbo/repository-win32-arm64-msvc": "0.0.1-canary.12",
24-
"@turbo/repository-linux-arm64-gnu": "0.0.1-canary.12",
25-
"@turbo/repository-linux-x64-gnu": "0.0.1-canary.12"
25+
"@turbo/repository-win32-arm64-msvc": "0.0.1-canary.12"
2626
}
2727
}

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": false,
27+
"defaults": true,
2828
"additional": [
2929
"x86_64-apple-darwin",
3030
"aarch64-apple-darwin",
31-
"x86_64-unknown-linux-musl",
32-
"aarch64-unknown-linux-musl",
31+
"x86_64-unknown-linux-gnu",
32+
"aarch64-unknown-linux-gnu",
3333
"x86_64-pc-windows-msvc",
3434
"aarch64-pc-windows-msvc"
3535
]

packages/turbo-repository/turbo.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
"tasks": {
55
"build": {
66
"dependsOn": ["cli#rust-src"],
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
7+
"env": ["NODE_VERSION"]
108
},
119
"test": {
1210
"dependsOn": ["build"]

0 commit comments

Comments
 (0)