Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.patch whitespace=-trailing-space
*.patch text eol=lf whitespace=-trailing-space
*.ps1 text eol=lf
101 changes: 88 additions & 13 deletions .github/workflows/bun-integration.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
name: Bun integration build

on:
pull_request:
paths:
- ".github/workflows/bun-integration.yml"
- ".github/workflows/release.yml"
- "Cargo.lock"
- "crates/**"
- "examples/**"
- "patches/**"
- "scripts/**"
- "sdk/**"
- "upstream.toml"
workflow_call:
workflow_dispatch:

permissions:
Expand All @@ -17,10 +29,21 @@ env:
RUSTUP_TOOLCHAIN: nightly-2026-07-20

jobs:
linux-x64:
name: Build and smoke-test Linux x64
runs-on: ubuntu-24.04
build:
name: Build and smoke-test ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- platform: linux-x64
os: ubuntu-24.04
artifact_path: dist/poly
- platform: windows-x64
# The pinned Bun/WebKit toolchain targets the VS 2022 MSVC ABI.
os: windows-2022
artifact_path: dist/poly.exe

steps:
- name: Checkout
Expand All @@ -33,7 +56,8 @@ jobs:
with:
bun-version: ${{ env.BUN_VERSION }}

- name: Install Bun build dependencies
- name: Install Linux build dependencies
if: runner.os == 'Linux'
shell: bash
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
Expand All @@ -48,6 +72,7 @@ jobs:
cmake \
curl \
golang \
libffi-dev \
libtool \
lld-${LLVM_VERSION_MAJOR} \
llvm-${LLVM_VERSION_MAJOR} \
Expand All @@ -59,6 +84,11 @@ jobs:
wget \
xz-utils

- name: Install Windows build dependencies
if: runner.os == 'Windows'
shell: pwsh
run: ./scripts/setup-bun-windows-ci.ps1

- name: Install Bun's Rust toolchain
shell: bash
run: |
Expand All @@ -67,20 +97,65 @@ jobs:

- name: Build the downstream Bun executable
shell: pwsh
run: ./scripts/bootstrap-bun.ps1
run: ./scripts/bootstrap-bun.ps1 -Configuration Release

- name: Upload executable
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: poly-${{ matrix.platform }}
path: ${{ matrix.artifact_path }}
if-no-files-found: error
retention-days: 7

- name: Configure Windows crash dumps
if: runner.os == 'Windows'
shell: pwsh
run: |
$dumpDir = Join-Path $env:RUNNER_TEMP "poly-crash-dumps"
New-Item -ItemType Directory -Force -Path $dumpDir | Out-Null
"POLY_CRASH_DUMP_DIR=$dumpDir" | Out-File -FilePath $env:GITHUB_ENV -Append

$werKey = "HKCU:\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\poly.exe"
New-Item -Force -Path $werKey | Out-Null
New-ItemProperty -Force -Path $werKey -Name DumpFolder -PropertyType ExpandString -Value $dumpDir | Out-Null
New-ItemProperty -Force -Path $werKey -Name DumpType -PropertyType DWord -Value 2 | Out-Null

- name: Smoke-test direct Python entry
shell: bash
run: ./dist/poly examples/python_main.py -- workflow
shell: pwsh
run: |
$poly = if ($IsWindows) { ".\dist\poly.exe" } else { "./dist/poly" }
& $poly examples/python_main.py -- workflow
if ($LASTEXITCODE -ne 0) {
throw "Direct Python smoke test failed with exit code $LASTEXITCODE."
}

- name: Smoke-test JavaScript runtime
shell: pwsh
env:
POLY_TRACE: "1"
run: |
$poly = if ($IsWindows) { ".\dist\poly.exe" } else { "./dist/poly" }
& $poly examples/js_smoke.ts
if ($LASTEXITCODE -ne 0) {
throw "JavaScript smoke test failed with exit code $LASTEXITCODE."
}

- name: Smoke-test TypeScript to Python
shell: bash
run: ./dist/poly examples/main.ts
shell: pwsh
env:
POLY_TRACE: "1"
run: |
$poly = if ($IsWindows) { ".\dist\poly.exe" } else { "./dist/poly" }
& $poly examples/main.ts
if ($LASTEXITCODE -ne 0) {
throw "TypeScript to Python smoke test failed with exit code $LASTEXITCODE."
}

- name: Upload the debug executable
- name: Upload Windows crash diagnostics
if: failure() && runner.os == 'Windows'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: poly-linux-x64-debug
path: dist/poly
if-no-files-found: error
name: poly-windows-crash-diagnostics
path: ${{ env.POLY_CRASH_DUMP_DIR }}
if-no-files-found: warn
retention-days: 7
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,18 @@ jobs:
git -C "$bun_checkout" sparse-checkout init --no-cone
git -C "$bun_checkout" sparse-checkout set \
Cargo.toml \
scripts/build/bun.ts \
src/bun_bin/Cargo.toml \
src/bun_bin/lib.rs \
src/jsc/bindings/BunObject+exports.h \
src/jsc/bindings/BunObject.cpp \
src/jsc/bindings/windows/rescle.cpp \
src/runtime/Cargo.toml \
src/runtime/api/BunObject.rs
src/runtime/api/BunObject.rs \
src/runtime/api/bun/spawn/stdio.rs \
src/runtime/dns_jsc/options_jsc.rs \
src/runtime/node/node_fs.rs \
src/runtime/node/win_watcher.rs
git -C "$bun_checkout" checkout --detach FETCH_HEAD
git -C "$bun_checkout" apply --check \
"$GITHUB_WORKSPACE/patches/bun-in-process.patch"
98 changes: 98 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: read

jobs:
build:
name: Build Windows and Linux
uses: ./.github/workflows/bun-integration.yml
permissions:
contents: read

release:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false

- name: Download built executables
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: artifacts

- name: Package release assets
shell: bash
run: |
set -euo pipefail
version="${GITHUB_REF_NAME#v}"
asset_version="$GITHUB_REF_NAME"
bun_commit="$(sed -n 's/^commit = "\(.*\)"/\1/p' upstream.toml)"
mkdir -p packages/linux-x64 packages/windows-x64 release-assets

install -m 0755 artifacts/poly-linux-x64/poly packages/linux-x64/poly
install -m 0644 LICENSE THIRD_PARTY_NOTICES.md packages/linux-x64/
jq -n \
--arg version "$version" \
--arg source_commit "$GITHUB_SHA" \
--arg bun_commit "$bun_commit" \
--arg target "x86_64-unknown-linux-gnu" \
--arg workflow "$GITHUB_WORKFLOW" \
'{version:$version,source_commit:$source_commit,bun_commit:$bun_commit,target:$target,workflow:$workflow}' \
> packages/linux-x64/BUILDINFO.json

install -m 0755 artifacts/poly-windows-x64/poly.exe packages/windows-x64/poly.exe
install -m 0644 LICENSE THIRD_PARTY_NOTICES.md packages/windows-x64/
jq -n \
--arg version "$version" \
--arg source_commit "$GITHUB_SHA" \
--arg bun_commit "$bun_commit" \
--arg target "x86_64-pc-windows-msvc" \
--arg workflow "$GITHUB_WORKFLOW" \
'{version:$version,source_commit:$source_commit,bun_commit:$bun_commit,target:$target,workflow:$workflow}' \
> packages/windows-x64/BUILDINFO.json

tar -C packages/linux-x64 -czf \
"release-assets/poly-${asset_version}-linux-x64.tar.gz" .
(
cd packages/windows-x64
zip -q -r "../../release-assets/poly-${asset_version}-windows-x64.zip" .
)
(
cd release-assets
sha256sum poly-* > SHA256SUMS
)

- name: Create or update GitHub Release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
prerelease=()
if [[ "$GITHUB_REF_NAME" == *-* ]]; then
prerelease=(--prerelease)
fi

if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" release-assets/* --clobber
else
gh release create "$GITHUB_REF_NAME" \
release-assets/* \
--verify-tag \
--generate-notes \
--title "$GITHUB_REF_NAME" \
"${prerelease[@]}"
fi
Loading
Loading