From f789da2fc77595c245015b6669f903e86abbb6af Mon Sep 17 00:00:00 2001 From: RiskyMH Date: Fri, 11 Jul 2025 02:10:52 +1000 Subject: [PATCH 1/3] update published npm binaries add some missing README's, fix the package description, and hopefully make musl not downloaded for linux by default (unless its needed) --- .../npm/@oven/bun-linux-aarch64-musl/README.md | 5 +++++ .../npm/@oven/bun-linux-x64-musl-baseline/README.md | 7 +++++++ .../npm/@oven/bun-linux-x64-musl/README.md | 5 +++++ packages/bun-release/scripts/upload-npm.ts | 11 +++++++++-- packages/bun-release/src/platform.ts | 7 +++++-- 5 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 packages/bun-release/npm/@oven/bun-linux-aarch64-musl/README.md create mode 100644 packages/bun-release/npm/@oven/bun-linux-x64-musl-baseline/README.md create mode 100644 packages/bun-release/npm/@oven/bun-linux-x64-musl/README.md diff --git a/packages/bun-release/npm/@oven/bun-linux-aarch64-musl/README.md b/packages/bun-release/npm/@oven/bun-linux-aarch64-musl/README.md new file mode 100644 index 00000000000..454a5d25e4c --- /dev/null +++ b/packages/bun-release/npm/@oven/bun-linux-aarch64-musl/README.md @@ -0,0 +1,5 @@ +# Bun + +This is the Linux arm64 binary for Bun, a fast all-in-one JavaScript runtime. https://bun.com + +_Note: "musl" builds are for machines that use [musl](https://musl.libc.org/) instead of [glibc](https://www.gnu.org/software/libc/)._ diff --git a/packages/bun-release/npm/@oven/bun-linux-x64-musl-baseline/README.md b/packages/bun-release/npm/@oven/bun-linux-x64-musl-baseline/README.md new file mode 100644 index 00000000000..0ca6a5f9d8c --- /dev/null +++ b/packages/bun-release/npm/@oven/bun-linux-x64-musl-baseline/README.md @@ -0,0 +1,7 @@ +# Bun + +This is the Linux arm64 binary for Bun, a fast all-in-one JavaScript runtime. https://bun.com + +_Note: "Baseline" builds are for machines that do not support [AVX2](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) instructions._ + +_Note: "musl" builds are for machines that use [musl](https://musl.libc.org/) instead of [glibc](https://www.gnu.org/software/libc/)._ diff --git a/packages/bun-release/npm/@oven/bun-linux-x64-musl/README.md b/packages/bun-release/npm/@oven/bun-linux-x64-musl/README.md new file mode 100644 index 00000000000..dde740ce6b0 --- /dev/null +++ b/packages/bun-release/npm/@oven/bun-linux-x64-musl/README.md @@ -0,0 +1,5 @@ +# Bun + +This is the Linux x64 binary for Bun, a fast all-in-one JavaScript runtime. https://bun.com + +_Note: "musl" builds are for machines that use [musl](https://musl.libc.org/) instead of [glibc](https://www.gnu.org/software/libc/)._ diff --git a/packages/bun-release/scripts/upload-npm.ts b/packages/bun-release/scripts/upload-npm.ts index 57d731b1339..05c7f43350a 100644 --- a/packages/bun-release/scripts/upload-npm.ts +++ b/packages/bun-release/scripts/upload-npm.ts @@ -123,7 +123,7 @@ without *requiring* a postinstall script. async function buildModule( release: Awaited>, - { bin, exe, os, arch }: Platform, + { bin, exe, os, arch, abi }: Platform, ): Promise { const module = `${owner}/${bin}`; log("Building:", `${module}@${version}`); @@ -137,10 +137,16 @@ async function buildModule( mkdirSync(dirname(join(cwd, exe)), { recursive: true }); write(join(cwd, exe), await bun.async("arraybuffer")); chmod(join(cwd, exe), 0o755); + const osName = + { + darwin: "macOS", + win32: "windows", + linux: "linux", + }[os] || os; writeJson(join(cwd, "package.json"), { name: module, version: version, - description: "This is the macOS arm64 binary for Bun, a fast all-in-one JavaScript runtime.", + description: `This is the ${osName} ${arch} binary for Bun, a fast all-in-one JavaScript runtime.`, homepage: "https://bun.com", bugs: "https://github.com/oven-sh/issues", license: "MIT", @@ -148,6 +154,7 @@ async function buildModule( preferUnplugged: true, os: [os], cpu: [arch], + libc: abi ? [abi] : undefined, }); if (exists(".npmrc")) { copy(".npmrc", join(cwd, ".npmrc")); diff --git a/packages/bun-release/src/platform.ts b/packages/bun-release/src/platform.ts index 171c4c3b1fe..34d52caa9aa 100644 --- a/packages/bun-release/src/platform.ts +++ b/packages/bun-release/src/platform.ts @@ -10,12 +10,12 @@ export const avx2 = arch === "x64" && ((os === "linux" && isLinuxAVX2()) || (os === "darwin" && isDarwinAVX2()) || (os === "win32" && isWindowsAVX2())); -export const abi = os === "linux" && isLinuxMusl() ? "musl" : undefined; +export const abi = os === "linux" ? (isLinuxMusl() ? "musl" : "glibc") : undefined; export type Platform = { os: string; arch: string; - abi?: "musl"; + abi?: "musl" | "glibc"; avx2?: boolean; bin: string; exe: string; @@ -44,12 +44,14 @@ export const platforms: Platform[] = [ { os: "linux", arch: "arm64", + abi: "glibc", bin: "bun-linux-aarch64", exe: "bin/bun", }, { os: "linux", arch: "x64", + abi: "glibc", avx2: true, bin: "bun-linux-x64", exe: "bin/bun", @@ -57,6 +59,7 @@ export const platforms: Platform[] = [ { os: "linux", arch: "x64", + abi: "glibc", bin: "bun-linux-x64-baseline", exe: "bin/bun", }, From 09ac2930c21bee30b032f25603c651bba2e95159 Mon Sep 17 00:00:00 2001 From: RiskyMH Date: Fri, 11 Jul 2025 02:35:28 +1000 Subject: [PATCH 2/3] add test that was removed in #10157 --- .github/workflows/bun-release-test.yml | 51 +++++++++++++++++++ .../bun-linux-x64-musl-baseline/README.md | 2 +- packages/bun-release/scripts/upload-npm.ts | 13 +++-- 3 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/bun-release-test.yml diff --git a/.github/workflows/bun-release-test.yml b/.github/workflows/bun-release-test.yml new file mode 100644 index 00000000000..7d59066f7e6 --- /dev/null +++ b/.github/workflows/bun-release-test.yml @@ -0,0 +1,51 @@ +# This workflow tests bun-release's code and the packages to ensure that npm, +# yarn, and pnpm can install bun on all platforms. This does not test that bun +# itself works as it hardcodes 1.2.0 as the version to package. +name: bun-release-test +concurrency: release-test + +on: + pull_request: + paths: + - "packages/bun-release/**" + - ".github/workflows/bun-release-test.yml" + +jobs: + test-release-script: + name: Test Release Script + strategy: + matrix: + # https://docs.github.com/en/actions/how-tos/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job#choosing-github-hosted-runners + machine: [ + ubuntu-latest, # linux x64 + ubuntu-24.04-arm, # linux arm + macos-13, # macos x64 + macos-15, # macos arm + # windows-latest, # windows x64 + ] + fail-fast: false + runs-on: ${{ matrix.machine }} + permissions: + contents: read + defaults: + run: + working-directory: packages/bun-release + timeout-minutes: 5 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Bun + uses: ./.github/actions/setup-bun + with: + bun-version: "1.2.0" + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Install Dependencies + run: bun install && npm i -g pnpm yarn npm && which node + + - name: Release + run: bun upload-npm -- 1.2.0 test + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/packages/bun-release/npm/@oven/bun-linux-x64-musl-baseline/README.md b/packages/bun-release/npm/@oven/bun-linux-x64-musl-baseline/README.md index 0ca6a5f9d8c..ab9f13411db 100644 --- a/packages/bun-release/npm/@oven/bun-linux-x64-musl-baseline/README.md +++ b/packages/bun-release/npm/@oven/bun-linux-x64-musl-baseline/README.md @@ -1,6 +1,6 @@ # Bun -This is the Linux arm64 binary for Bun, a fast all-in-one JavaScript runtime. https://bun.com +This is the Linux x64 binary for Bun, a fast all-in-one JavaScript runtime. https://bun.com _Note: "Baseline" builds are for machines that do not support [AVX2](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) instructions._ diff --git a/packages/bun-release/scripts/upload-npm.ts b/packages/bun-release/scripts/upload-npm.ts index 05c7f43350a..3323fb613d2 100644 --- a/packages/bun-release/scripts/upload-npm.ts +++ b/packages/bun-release/scripts/upload-npm.ts @@ -112,7 +112,7 @@ without *requiring* a postinstall script. cpu, keywords: ["bun", "bun.js", "node", "node.js", "runtime", "bundler", "transpiler", "typescript"], homepage: "https://bun.com", - bugs: "https://github.com/oven-sh/issues", + bugs: "https://github.com/oven-sh/bun/issues", license: "MIT", repository: "https://github.com/oven-sh/bun", }); @@ -148,7 +148,7 @@ async function buildModule( version: version, description: `This is the ${osName} ${arch} binary for Bun, a fast all-in-one JavaScript runtime.`, homepage: "https://bun.com", - bugs: "https://github.com/oven-sh/issues", + bugs: "https://github.com/oven-sh/bun/issues", license: "MIT", repository: "https://github.com/oven-sh/bun", preferUnplugged: true, @@ -259,7 +259,7 @@ async function test() { ["npm i", "npm exec"], ["yarn set version berry; yarn add", "yarn"], ["yarn set version latest; yarn add", "yarn"], - ["pnpm i", "pnpm"], + ["pnpm i --dangerously-allow-all-builds", "pnpm"], ["bun i", "bun run"], ]) { rmSync(join(root, "node_modules"), { recursive: true, force: true }); @@ -272,7 +272,10 @@ async function test() { }); console.log("Testing", install + " bun"); - await $`${{ raw: install }} ./bun-${version}.tgz`; + const nodePath = Bun.which("node")?.replace("/node", "") || ""; + await $`${{ raw: install }} ./bun-${version}.tgz`.env({ + PATH: nodePath ? `${nodePath}:${process.env.PATH}` : process.env.PATH, + }); console.log("Running " + exec + " bun"); @@ -312,7 +315,7 @@ async function test() { expect(output[0]).toBe(version); expect(output[1]).toBe(process.platform); expect(output[2]).toBe(process.arch); - expect(output[3]).toStartWith(root); + expect(output[3]).toInclude(root); expect(output[3]).toInclude("bun"); } } From c3258f37adb819dde23447be9e5a25254336bdaa Mon Sep 17 00:00:00 2001 From: RiskyMH Date: Fri, 11 Jul 2025 03:35:32 +1000 Subject: [PATCH 3/3] Update README.md --- packages/bun-release/npm/bun/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/bun-release/npm/bun/README.md b/packages/bun-release/npm/bun/README.md index 8eb18241ce3..a5e941aa4a7 100644 --- a/packages/bun-release/npm/bun/README.md +++ b/packages/bun-release/npm/bun/README.md @@ -20,8 +20,11 @@ bun upgrade - [macOS, x64](https://www.npmjs.com/package/@oven/bun-darwin-x64) - [macOS, x64 (without AVX2 instructions)](https://www.npmjs.com/package/@oven/bun-darwin-x64-baseline) - [Linux, arm64](https://www.npmjs.com/package/@oven/bun-linux-aarch64) +- [Linux, arm64 (musl)](https://www.npmjs.com/package/@oven/bun-linux-aarch64-musl) - [Linux, x64](https://www.npmjs.com/package/@oven/bun-linux-x64) - [Linux, x64 (without AVX2 instructions)](https://www.npmjs.com/package/@oven/bun-linux-x64-baseline) +- [Linux, x64 (musl)](https://www.npmjs.com/package/@oven/bun-linux-x64-musl) +- [Linux, x64 (without AVX2 instructions, musl)](https://www.npmjs.com/package/@oven/bun-linux-x64-musl-baseline) - [Windows](https://www.npmjs.com/package/@oven/bun-windows-x64) - [Windows (without AVX2 instructions)](https://www.npmjs.com/package/@oven/bun-windows-x64-baseline)