Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/bun-release-test.yml
Original file line number Diff line number Diff line change
@@ -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 }}
Original file line number Diff line number Diff line change
@@ -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/)._
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Bun

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._

_Note: "musl" builds are for machines that use [musl](https://musl.libc.org/) instead of [glibc](https://www.gnu.org/software/libc/)._
5 changes: 5 additions & 0 deletions packages/bun-release/npm/@oven/bun-linux-x64-musl/README.md
Original file line number Diff line number Diff line change
@@ -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/)._
3 changes: 3 additions & 0 deletions packages/bun-release/npm/bun/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
24 changes: 17 additions & 7 deletions packages/bun-release/scripts/upload-npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});
Expand All @@ -123,7 +123,7 @@ without *requiring* a postinstall script.

async function buildModule(
release: Awaited<ReturnType<typeof getRelease>>,
{ bin, exe, os, arch }: Platform,
{ bin, exe, os, arch, abi }: Platform,
): Promise<void> {
const module = `${owner}/${bin}`;
log("Building:", `${module}@${version}`);
Expand All @@ -137,17 +137,24 @@ 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",
bugs: "https://github.com/oven-sh/bun/issues",
license: "MIT",
repository: "https://github.com/oven-sh/bun",
preferUnplugged: true,
os: [os],
cpu: [arch],
libc: abi ? [abi] : undefined,
});
if (exists(".npmrc")) {
copy(".npmrc", join(cwd, ".npmrc"));
Expand Down Expand Up @@ -252,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"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnpm seems to also have a postinstall blocking now too

 Warning ─────────────────────────────────────────────────────────────────────╮
                                                                              
   Ignored build scripts: bun.                                                
   Run "pnpm approve-builds" to pick which dependencies should be allowed     
   to run scripts.                                                            
                                                                              
╰──────────────────────────────────────────────────────────────────────────────╯

["bun i", "bun run"],
]) {
rmSync(join(root, "node_modules"), { recursive: true, force: true });
Expand All @@ -265,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,
});
Comment on lines -268 to +278
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why it throws env: node: No such file or directory without this force path change...


console.log("Running " + exec + " bun");

Expand Down Expand Up @@ -305,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");
}
}
7 changes: 5 additions & 2 deletions packages/bun-release/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -44,19 +44,22 @@ 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",
},
{
os: "linux",
arch: "x64",
abi: "glibc",
bin: "bun-linux-x64-baseline",
exe: "bin/bun",
},
Expand Down
Loading