mirror of
https://github.com/oven-sh/bun
synced 2026-02-04 07:58:54 +00:00
Compare commits
370 Commits
jarred/ser
...
fix-9432
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d1f0dacd8 | ||
|
|
5d7b3ab579 | ||
|
|
79c7abe595 | ||
|
|
23fb8ce07a | ||
|
|
e45cd749e5 | ||
|
|
5f4c5052d1 | ||
|
|
32120fe920 | ||
|
|
23e4f609bf | ||
|
|
bd632464a0 | ||
|
|
2a401486d9 | ||
|
|
fd45c67e72 | ||
|
|
303f86af41 | ||
|
|
3fc2e45960 | ||
|
|
50ba690cad | ||
|
|
2b193095d3 | ||
|
|
e1a7fe55c3 | ||
|
|
c156a8db09 | ||
|
|
dc99eb69ca | ||
|
|
a38b3102b6 | ||
|
|
3106b890ac | ||
|
|
b48c6736e5 | ||
|
|
a5b5a2a725 | ||
|
|
7fd67a4151 | ||
|
|
32bf5eb444 | ||
|
|
a1803347d9 | ||
|
|
efd4e15f4c | ||
|
|
18261046ee | ||
|
|
ee0e69702e | ||
|
|
74c6bd4197 | ||
|
|
a78db0b8ae | ||
|
|
b42f5227e3 | ||
|
|
93829420dc | ||
|
|
168d50e622 | ||
|
|
558aad5611 | ||
|
|
185a4bf90e | ||
|
|
ce4f85c2c5 | ||
|
|
cacf97ca0a | ||
|
|
72b3045758 | ||
|
|
0f4449d51b | ||
|
|
6f15b90e83 | ||
|
|
2724bd3649 | ||
|
|
bca4d0be48 | ||
|
|
3970339483 | ||
|
|
603588ac8c | ||
|
|
fbbc20fe83 | ||
|
|
7af0ed164a | ||
|
|
7062e89d2e | ||
|
|
2bf3f32fb8 | ||
|
|
697f37e21f | ||
|
|
c7aed7e0a3 | ||
|
|
84d81c3002 | ||
|
|
e58d67b468 | ||
|
|
dfcbe09035 | ||
|
|
cbb0b3113a | ||
|
|
9ebbe035b9 | ||
|
|
57b529d181 | ||
|
|
cc8cdf6c51 | ||
|
|
4cbd215d55 | ||
|
|
3b1311a84f | ||
|
|
2f1a3da21b | ||
|
|
adc631c9ef | ||
|
|
a52dd7853d | ||
|
|
e2c36aabff | ||
|
|
9416ee49b2 | ||
|
|
8280defc30 | ||
|
|
609ef6a8ad | ||
|
|
829ac49612 | ||
|
|
555bd1defd | ||
|
|
589f941aea | ||
|
|
a6d39e14fc | ||
|
|
4b87e1a909 | ||
|
|
181d6a0a83 | ||
|
|
b257a30977 | ||
|
|
189aa22845 | ||
|
|
7f0b810d7a | ||
|
|
17fc156460 | ||
|
|
7502c9b391 | ||
|
|
c7773975f6 | ||
|
|
006575a0f1 | ||
|
|
9ba1181215 | ||
|
|
588259fff1 | ||
|
|
c34428d47f | ||
|
|
78aef2d894 | ||
|
|
9eab12f7b8 | ||
|
|
196cc2a4cd | ||
|
|
49fa21f6dc | ||
|
|
d966fe6afd | ||
|
|
a64554bba6 | ||
|
|
a6714904e4 | ||
|
|
e792bbdf5f | ||
|
|
685dc02142 | ||
|
|
ebeae0ff1c | ||
|
|
7bc8456edf | ||
|
|
fdff887c0a | ||
|
|
d789eb34c9 | ||
|
|
b03c6690ba | ||
|
|
e3689e7e83 | ||
|
|
2abe6e7c3f | ||
|
|
0989f1a575 | ||
|
|
528a84d29f | ||
|
|
024c274a3d | ||
|
|
ff624147ad | ||
|
|
c1d7a5ed79 | ||
|
|
7593790308 | ||
|
|
3d770c112c | ||
|
|
d690504943 | ||
|
|
1a17d7179c | ||
|
|
309c2e3678 | ||
|
|
90fc629156 | ||
|
|
dd774c7f8c | ||
|
|
79a4cfb17d | ||
|
|
dc5044443f | ||
|
|
68c13f2af5 | ||
|
|
e6954c440e | ||
|
|
a1c771834c | ||
|
|
9768d30e6d | ||
|
|
9813341cef | ||
|
|
0f13deb540 | ||
|
|
0f8d74e3dc | ||
|
|
c3c1750ec7 | ||
|
|
e8fa39f938 | ||
|
|
0fb10356f8 | ||
|
|
c405a4bd21 | ||
|
|
164b2f610f | ||
|
|
83e4aca269 | ||
|
|
6758046f76 | ||
|
|
7496299b00 | ||
|
|
c2ad94aa01 | ||
|
|
a614336157 | ||
|
|
7bd305c573 | ||
|
|
cd3b184ba0 | ||
|
|
a010db8eca | ||
|
|
a3dc94f1e1 | ||
|
|
639f554c9c | ||
|
|
536379b8ed | ||
|
|
04a79fa308 | ||
|
|
0bd75cc3c5 | ||
|
|
1f1df6be0c | ||
|
|
6ff77c978e | ||
|
|
7433f5a922 | ||
|
|
9c879064fe | ||
|
|
8168415e5a | ||
|
|
22a289e272 | ||
|
|
97efa6f505 | ||
|
|
c604c57a32 | ||
|
|
ab79940e6a | ||
|
|
1a4bad80b7 | ||
|
|
30f4090571 | ||
|
|
1191bf0c15 | ||
|
|
707fd7f1ea | ||
|
|
df1e9290ae | ||
|
|
fc4459991d | ||
|
|
a062e2d367 | ||
|
|
ad44949621 | ||
|
|
d0a4fd5e80 | ||
|
|
e6d8391e00 | ||
|
|
5bdc5bebb1 | ||
|
|
e0f583df75 | ||
|
|
131183f747 | ||
|
|
5ccc042cc4 | ||
|
|
abaa505374 | ||
|
|
c5270f8121 | ||
|
|
c4d69146c8 | ||
|
|
2ce83953e5 | ||
|
|
b6aebb58c2 | ||
|
|
26428d5e1c | ||
|
|
05ff620d4d | ||
|
|
e134ed253f | ||
|
|
f663472d5f | ||
|
|
6f67c63873 | ||
|
|
f460d39298 | ||
|
|
246df1f43e | ||
|
|
213461adc6 | ||
|
|
a78668eb4c | ||
|
|
452dd68253 | ||
|
|
de7985b5a6 | ||
|
|
a1f86bf3f3 | ||
|
|
df23f18461 | ||
|
|
1d7f80c73c | ||
|
|
6d6b2e8bc5 | ||
|
|
accfff0271 | ||
|
|
aa1174df69 | ||
|
|
997f57b97f | ||
|
|
074205d963 | ||
|
|
cfce166a9b | ||
|
|
13f0188fec | ||
|
|
97761cba67 | ||
|
|
492211f499 | ||
|
|
192577141b | ||
|
|
6e71dca5c2 | ||
|
|
c99d7ed331 | ||
|
|
f764c1233b | ||
|
|
20d8261405 | ||
|
|
a7273802a8 | ||
|
|
303bf4d9f1 | ||
|
|
d4c31d3c9e | ||
|
|
d5e6ff4c97 | ||
|
|
51bb5f3a04 | ||
|
|
fdaa01287a | ||
|
|
f8a28ad37e | ||
|
|
c18c25f390 | ||
|
|
3df202f91f | ||
|
|
df190815df | ||
|
|
2ae48f3314 | ||
|
|
291a39bd3f | ||
|
|
fbe2fe0c3f | ||
|
|
5a81dc8e33 | ||
|
|
24a411f904 | ||
|
|
3f10d5250a | ||
|
|
dd6beb66d8 | ||
|
|
233624b6ff | ||
|
|
fdcc844027 | ||
|
|
74d91f6b51 | ||
|
|
9f81a6268e | ||
|
|
7b5065c1c9 | ||
|
|
21ad40e86c | ||
|
|
c59f49385f | ||
|
|
8d49a3ee37 | ||
|
|
f6b9c0c909 | ||
|
|
65d8288d81 | ||
|
|
4627af5893 | ||
|
|
176af5cf58 | ||
|
|
1820d08d25 | ||
|
|
472bd6c7de | ||
|
|
d785d30eaf | ||
|
|
22d6227a3a | ||
|
|
70023bc4ed | ||
|
|
19da72fe34 | ||
|
|
7d673dd7d8 | ||
|
|
ca98138936 | ||
|
|
d00b5b94ea | ||
|
|
ff5ef512c7 | ||
|
|
545cb546cc | ||
|
|
688844b472 | ||
|
|
0f10d4f1be | ||
|
|
c2ac5d4d18 | ||
|
|
edeb75a84a | ||
|
|
57208cb02e | ||
|
|
5b4b6931c4 | ||
|
|
257f4c1b3e | ||
|
|
459bcdc5ac | ||
|
|
f5c8914c8a | ||
|
|
1e20f618c9 | ||
|
|
cd52f42148 | ||
|
|
21fc1f7295 | ||
|
|
e209ae81dd | ||
|
|
698d0f7c87 | ||
|
|
baf0d7c40f | ||
|
|
81d021794e | ||
|
|
769d7a1680 | ||
|
|
df49a5a8e4 | ||
|
|
0dc0919119 | ||
|
|
e30a848c4c | ||
|
|
c739c4adeb | ||
|
|
00933d597a | ||
|
|
5baa2fbb87 | ||
|
|
2615dc742e | ||
|
|
a4e8534779 | ||
|
|
9380e99e2b | ||
|
|
9898e0a731 | ||
|
|
ad6aadf7b2 | ||
|
|
ee05bae2be | ||
|
|
d615c11a57 | ||
|
|
3679f69b70 | ||
|
|
0b0bf353fa | ||
|
|
c4847f464e | ||
|
|
c8d072c2a9 | ||
|
|
f014f35531 | ||
|
|
fd3cd05647 | ||
|
|
20085d8ddc | ||
|
|
5735feac5d | ||
|
|
4ba993be7e | ||
|
|
0b2bb1fdc1 | ||
|
|
b29cf75a24 | ||
|
|
05fb044577 | ||
|
|
8825b29529 | ||
|
|
182b90896f | ||
|
|
40e33da4b4 | ||
|
|
f393f8a065 | ||
|
|
a09c421f2a | ||
|
|
ca1dbb4eb2 | ||
|
|
8a3b6f0439 | ||
|
|
e7d8abb263 | ||
|
|
013bc79f62 | ||
|
|
8326235ecc | ||
|
|
7543bf936a | ||
|
|
06ec233ebe | ||
|
|
0cdad4bebb | ||
|
|
14c23cc429 | ||
|
|
0dfbdc711a | ||
|
|
3cde2365ea | ||
|
|
3cfb2816ac | ||
|
|
c8f5c9f29c | ||
|
|
00f27fbeec | ||
|
|
76795af695 | ||
|
|
a4b151962a | ||
|
|
1cde9bcdac | ||
|
|
0bd7265e8f | ||
|
|
c831dd8db8 | ||
|
|
390441327f | ||
|
|
2e0e9f135b | ||
|
|
36f1bd3694 | ||
|
|
289d23b377 | ||
|
|
bb483e8479 | ||
|
|
268f13765c | ||
|
|
801e475c72 | ||
|
|
a073c85fdb | ||
|
|
8cb9f59753 | ||
|
|
5903a61410 | ||
|
|
b4941cdb0c | ||
|
|
58417217d6 | ||
|
|
2d57f25637 | ||
|
|
83a99bf190 | ||
|
|
e2ffa66bf7 | ||
|
|
8980dc026d | ||
|
|
4192728592 | ||
|
|
bdfbcb1898 | ||
|
|
6e07f9477c | ||
|
|
2dd2fc6ed0 | ||
|
|
9e6e8b0234 | ||
|
|
d53e6d6323 | ||
|
|
1edacc6e49 | ||
|
|
81badbac4c | ||
|
|
7531bfbfe0 | ||
|
|
1a989c9ad2 | ||
|
|
ab7825cca5 | ||
|
|
f02752577b | ||
|
|
c177e054f5 | ||
|
|
a01b01ae72 | ||
|
|
456a32344e | ||
|
|
6164fac256 | ||
|
|
4bbcc39d2f | ||
|
|
62c8c97e24 | ||
|
|
eb708d34ae | ||
|
|
c3ba60eef5 | ||
|
|
7f71f10ad1 | ||
|
|
9939049b85 | ||
|
|
a5c5b5dc61 | ||
|
|
a2835ef098 | ||
|
|
31c4c59740 | ||
|
|
0248e3c2b7 | ||
|
|
d869fcee21 | ||
|
|
55f8ae5aea | ||
|
|
e414d107e6 | ||
|
|
0103e2df73 | ||
|
|
02ad501f9e | ||
|
|
d433a1ada0 | ||
|
|
d712254128 | ||
|
|
a500c69728 | ||
|
|
d30b53591f | ||
|
|
b8389f32ce | ||
|
|
7172013a72 | ||
|
|
8ff7ee03d2 | ||
|
|
5296c26dab | ||
|
|
da6826e2b7 | ||
|
|
a637b4c880 | ||
|
|
d9074dfa5d | ||
|
|
ba9834d746 | ||
|
|
4869ebff24 | ||
|
|
a9804a3a11 | ||
|
|
6bedc23992 | ||
|
|
093e9c2499 | ||
|
|
3047c9005e | ||
|
|
e80e61c9a3 | ||
|
|
e3bf906127 | ||
|
|
4e7ed173ef | ||
|
|
31befad163 | ||
|
|
94b01b2f45 | ||
|
|
9ecb691380 | ||
|
|
fb8a299765 |
3
.clangd
Normal file
3
.clangd
Normal file
@@ -0,0 +1,3 @@
|
||||
Index:
|
||||
Background: Skip # Disable slow background indexing of these files.
|
||||
|
||||
27
.github/ISSUE_TEMPLATE/6-crash-report.yml
vendored
Normal file
27
.github/ISSUE_TEMPLATE/6-crash-report.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Prefilled crash report
|
||||
description: Report a crash in Bun
|
||||
labels:
|
||||
- bug
|
||||
- crash
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for submitting a crash report. It helps make Bun better.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: How can we reproduce the crash?
|
||||
description: Please provide instructions on how to reproduce the crash.
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Please copy and paste any relevant log output. This will be
|
||||
automatically formatted into code, so no need for backticks.
|
||||
render: shell
|
||||
- type: textarea
|
||||
id: remapped_trace
|
||||
attributes:
|
||||
label: Stack Trace (bun.report)
|
||||
validations:
|
||||
required: true
|
||||
2
.github/actions/setup-bun/action.yml
vendored
2
.github/actions/setup-bun/action.yml
vendored
@@ -30,7 +30,7 @@ runs:
|
||||
*) os=windows;;
|
||||
esac
|
||||
case "$(uname -m)" in
|
||||
arm64 | aarch64) arch=arm64;;
|
||||
arm64 | aarch64) arch=aarch64;;
|
||||
*) arch=x64;;
|
||||
esac
|
||||
case "${{ inputs.baseline }}" in
|
||||
|
||||
310
.github/workflows/build-darwin.yml
vendored
Normal file
310
.github/workflows/build-darwin.yml
vendored
Normal file
@@ -0,0 +1,310 @@
|
||||
name: Build Darwin
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runs-on:
|
||||
type: string
|
||||
default: macos-12-large
|
||||
tag:
|
||||
type: string
|
||||
required: true
|
||||
arch:
|
||||
type: string
|
||||
required: true
|
||||
cpu:
|
||||
type: string
|
||||
required: true
|
||||
assertions:
|
||||
type: boolean
|
||||
canary:
|
||||
type: boolean
|
||||
no-cache:
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
LLVM_VERSION: 16
|
||||
BUN_VERSION: 1.1.2
|
||||
|
||||
jobs:
|
||||
build-submodules:
|
||||
name: Build Submodules
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.gitmodules
|
||||
src/deps
|
||||
scripts
|
||||
- name: Hash Submodules
|
||||
id: hash
|
||||
run: |
|
||||
print_versions() {
|
||||
git submodule | grep -v WebKit
|
||||
echo "LLVM_VERSION=${{ env.LLVM_VERSION }}"
|
||||
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
|
||||
}
|
||||
echo "hash=$(print_versions | shasum)" >> $GITHUB_OUTPUT
|
||||
- if: ${{ !inputs.no-cache }}
|
||||
name: Restore Cache
|
||||
id: cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/bun-deps
|
||||
key: bun-${{ inputs.tag }}-deps-${{ steps.hash.outputs.hash }}
|
||||
# TODO: Figure out how to cache homebrew dependencies
|
||||
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
|
||||
name: Install Dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install \
|
||||
llvm@${{ env.LLVM_VERSION }} \
|
||||
ccache \
|
||||
rust \
|
||||
pkg-config \
|
||||
coreutils \
|
||||
libtool \
|
||||
cmake \
|
||||
libiconv \
|
||||
automake \
|
||||
openssl@1.1 \
|
||||
ninja \
|
||||
golang \
|
||||
gnu-sed --force --overwrite
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
|
||||
name: Clone Submodules
|
||||
run: |
|
||||
./scripts/update-submodules.sh
|
||||
- name: Build Submodules
|
||||
if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
|
||||
env:
|
||||
CPU_TARGET: ${{ inputs.cpu }}
|
||||
BUN_DEPS_OUT_DIR: ${{ runner.temp }}/bun-deps
|
||||
run: |
|
||||
mkdir -p $BUN_DEPS_OUT_DIR
|
||||
./scripts/all-dependencies.sh
|
||||
- name: Save Cache
|
||||
if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/bun-deps
|
||||
key: ${{ steps.cache.outputs.cache-primary-key }}
|
||||
- name: Upload bun-${{ inputs.tag }}-deps
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-deps
|
||||
path: ${{ runner.temp }}/bun-deps
|
||||
if-no-files-found: error
|
||||
build-cpp:
|
||||
name: Build C++
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
# TODO: Figure out how to cache homebrew dependencies
|
||||
- name: Install Dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install \
|
||||
llvm@${{ env.LLVM_VERSION }} \
|
||||
ccache \
|
||||
rust \
|
||||
pkg-config \
|
||||
coreutils \
|
||||
libtool \
|
||||
cmake \
|
||||
libiconv \
|
||||
automake \
|
||||
openssl@1.1 \
|
||||
ninja \
|
||||
golang \
|
||||
gnu-sed --force --overwrite
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- if: ${{ !inputs.no-cache }}
|
||||
name: Restore Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/ccache
|
||||
key: bun-${{ inputs.tag }}-cpp-${{ hashFiles('Dockerfile', 'Makefile', 'CMakeLists.txt', 'build.zig', 'scripts/**', 'src/**', 'packages/bun-usockets/src/**', 'packages/bun-uws/src/**') }}
|
||||
restore-keys: |
|
||||
bun-${{ inputs.tag }}-cpp-
|
||||
- name: Compile
|
||||
env:
|
||||
CPU_TARGET: ${{ inputs.cpu }}
|
||||
SOURCE_DIR: ${{ github.workspace }}
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{ runner.temp }}/bun-deps
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
run: |
|
||||
mkdir -p $OBJ_DIR
|
||||
cd $OBJ_DIR
|
||||
cmake -S $SOURCE_DIR -B $OBJ_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DUSE_LTO=ON \
|
||||
-DBUN_CPP_ONLY=1 \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
chmod +x compile-cpp-only.sh
|
||||
./compile-cpp-only.sh -v
|
||||
- name: Upload bun-${{ inputs.tag }}-cpp
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
|
||||
if-no-files-found: error
|
||||
build-zig:
|
||||
name: Build Zig
|
||||
uses: ./.github/workflows/build-zig.yml
|
||||
with:
|
||||
os: darwin
|
||||
only-zig: true
|
||||
tag: ${{ inputs.tag }}
|
||||
arch: ${{ inputs.arch }}
|
||||
cpu: ${{ inputs.cpu }}
|
||||
assertions: ${{ inputs.assertions }}
|
||||
canary: ${{ inputs.canary }}
|
||||
no-cache: ${{ inputs.no-cache }}
|
||||
link:
|
||||
name: Link
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
needs:
|
||||
- build-submodules
|
||||
- build-cpp
|
||||
- build-zig
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# TODO: Figure out how to cache homebrew dependencies
|
||||
- name: Install Dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install \
|
||||
llvm@${{ env.LLVM_VERSION }} \
|
||||
ccache \
|
||||
rust \
|
||||
pkg-config \
|
||||
coreutils \
|
||||
libtool \
|
||||
cmake \
|
||||
libiconv \
|
||||
automake \
|
||||
openssl@1.1 \
|
||||
ninja \
|
||||
golang \
|
||||
gnu-sed --force --overwrite
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Download bun-${{ inputs.tag }}-deps
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-deps
|
||||
path: ${{ runner.temp }}/bun-deps
|
||||
- name: Download bun-${{ inputs.tag }}-cpp
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
- name: Download bun-${{ inputs.tag }}-zig
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-zig
|
||||
path: ${{ runner.temp }}/release
|
||||
- if: ${{ !inputs.no-cache }}
|
||||
name: Restore Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/ccache
|
||||
key: bun-${{ inputs.tag }}-cpp-${{ hashFiles('Dockerfile', 'Makefile', 'CMakeLists.txt', 'build.zig', 'scripts/**', 'src/**', 'packages/bun-usockets/src/**', 'packages/bun-uws/src/**') }}
|
||||
restore-keys: |
|
||||
bun-${{ inputs.tag }}-cpp-
|
||||
- name: Link
|
||||
env:
|
||||
CPU_TARGET: ${{ inputs.cpu }}
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
run: |
|
||||
SRC_DIR=$PWD
|
||||
mkdir ${{ runner.temp }}/link-build
|
||||
cd ${{ runner.temp }}/link-build
|
||||
cmake $SRC_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DUSE_LTO=ON \
|
||||
-DBUN_LINK_ONLY=1 \
|
||||
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
|
||||
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
|
||||
-DBUN_DEPS_OUT_DIR="${{ runner.temp }}/bun-deps" \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
ninja -v
|
||||
- name: Prepare
|
||||
run: |
|
||||
cd ${{ runner.temp }}/link-build
|
||||
chmod +x bun-profile bun
|
||||
mkdir -p bun-${{ inputs.tag }}-profile/ bun-${{ inputs.tag }}/
|
||||
mv bun-profile bun-${{ inputs.tag }}-profile/bun-profile
|
||||
mv bun bun-${{ inputs.tag }}/bun
|
||||
zip -r bun-${{ inputs.tag }}-profile.zip bun-${{ inputs.tag }}-profile
|
||||
zip -r bun-${{ inputs.tag }}.zip bun-${{ inputs.tag }}
|
||||
- name: Upload bun-${{ inputs.tag }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}
|
||||
path: ${{ runner.temp }}/link-build/bun-${{ inputs.tag }}.zip
|
||||
if-no-files-found: error
|
||||
- name: Upload bun-${{ inputs.tag }}-profile
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-profile
|
||||
path: ${{ runner.temp }}/link-build/bun-${{ inputs.tag }}-profile.zip
|
||||
if-no-files-found: error
|
||||
on-failure:
|
||||
if: ${{ github.repository_owner == 'oven-sh' && failure() }}
|
||||
name: On Failure
|
||||
needs: link
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send Message
|
||||
uses: sarisia/actions-status-discord@v1
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
nodetail: true
|
||||
color: "#FF0000"
|
||||
title: ""
|
||||
description: |
|
||||
### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})
|
||||
|
||||
@${{ github.actor }}, the build for bun-${{ inputs.tag }} failed.
|
||||
|
||||
**[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})**
|
||||
64
.github/workflows/build-linux.yml
vendored
Normal file
64
.github/workflows/build-linux.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Build Linux
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runs-on:
|
||||
type: string
|
||||
required: true
|
||||
tag:
|
||||
type: string
|
||||
required: true
|
||||
arch:
|
||||
type: string
|
||||
required: true
|
||||
cpu:
|
||||
type: string
|
||||
required: true
|
||||
assertions:
|
||||
type: boolean
|
||||
zig-optimize:
|
||||
type: string
|
||||
canary:
|
||||
type: boolean
|
||||
no-cache:
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Linux
|
||||
uses: ./.github/workflows/build-zig.yml
|
||||
with:
|
||||
os: linux
|
||||
only-zig: false
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
tag: ${{ inputs.tag }}
|
||||
arch: ${{ inputs.arch }}
|
||||
cpu: ${{ inputs.cpu }}
|
||||
assertions: ${{ inputs.assertions }}
|
||||
zig-optimize: ${{ inputs.zig-optimize }}
|
||||
canary: ${{ inputs.canary }}
|
||||
no-cache: ${{ inputs.no-cache }}
|
||||
on-failure:
|
||||
if: ${{ github.repository_owner == 'oven-sh' && failure() }}
|
||||
name: On Failure
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send Message
|
||||
uses: sarisia/actions-status-discord@v1
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
nodetail: true
|
||||
color: "#FF0000"
|
||||
title: ""
|
||||
description: |
|
||||
### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})
|
||||
|
||||
@${{ github.actor }}, the build for bun-${{ inputs.tag }} failed.
|
||||
|
||||
**[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})**
|
||||
337
.github/workflows/build-windows.yml
vendored
Normal file
337
.github/workflows/build-windows.yml
vendored
Normal file
@@ -0,0 +1,337 @@
|
||||
name: Build Windows
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runs-on:
|
||||
type: string
|
||||
default: windows
|
||||
tag:
|
||||
type: string
|
||||
required: true
|
||||
arch:
|
||||
type: string
|
||||
required: true
|
||||
cpu:
|
||||
type: string
|
||||
required: true
|
||||
assertions:
|
||||
type: boolean
|
||||
canary:
|
||||
type: boolean
|
||||
no-cache:
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
# Must specify exact version of LLVM for Windows
|
||||
LLVM_VERSION: 16.0.6
|
||||
BUN_VERSION: 1.1.2
|
||||
|
||||
jobs:
|
||||
build-submodules:
|
||||
name: Build Submodules
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- name: Setup Git
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.gitmodules
|
||||
src/deps
|
||||
scripts
|
||||
- name: Hash Submodules
|
||||
id: hash
|
||||
run: |
|
||||
$data = "$(& {
|
||||
git submodule | Where-Object { $_ -notmatch 'WebKit' }
|
||||
echo "LLVM_VERSION=${{ env.LLVM_VERSION }}"
|
||||
Get-Content -Path (Get-ChildItem -Path 'scripts/build*.ps1', 'scripts/all-dependencies.ps1', 'scripts/env.ps1' | Sort-Object -Property Name).FullName | Out-String
|
||||
echo 1
|
||||
})"
|
||||
$hash = ( -join ((New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($data)) | ForEach-Object { $_.ToString("x2") } )).Substring(0, 10)
|
||||
echo "hash=${hash}" >> $env:GITHUB_OUTPUT
|
||||
- if: ${{ !inputs.no-cache }}
|
||||
name: Restore Cache
|
||||
id: cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: bun-deps
|
||||
key: bun-${{ inputs.tag }}-deps-${{ steps.hash.outputs.hash }}
|
||||
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
|
||||
name: Install LLVM
|
||||
uses: KyleMayes/install-llvm-action@8b37482c5a2997a3ab5dbf6561f8109e2eaa7d3b
|
||||
with:
|
||||
version: ${{ env.LLVM_VERSION }}
|
||||
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
|
||||
name: Install Ninja
|
||||
run: |
|
||||
choco install -y ninja
|
||||
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
|
||||
name: Clone Submodules
|
||||
run: |
|
||||
.\scripts\update-submodules.ps1
|
||||
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
|
||||
name: Build Dependencies
|
||||
env:
|
||||
CPU_TARGET: ${{ inputs.cpu }}
|
||||
CCACHE_DIR: ccache
|
||||
run: |
|
||||
.\scripts\env.ps1 ${{ contains(inputs.tag, '-baseline') && '-Baseline' || '' }}
|
||||
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip" -OutFile nasm.zip
|
||||
Expand-Archive nasm.zip (mkdir -Force "nasm")
|
||||
$Nasm = (Get-ChildItem "nasm")
|
||||
$env:Path += ";${Nasm}"
|
||||
$env:BUN_DEPS_OUT_DIR = (mkdir -Force "./bun-deps")
|
||||
.\scripts\all-dependencies.ps1
|
||||
- name: Save Cache
|
||||
if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: bun-deps
|
||||
key: ${{ steps.cache.outputs.cache-primary-key }}
|
||||
- name: Upload bun-${{ inputs.tag }}-deps
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-deps
|
||||
path: bun-deps
|
||||
if-no-files-found: error
|
||||
codegen:
|
||||
name: Codegen
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Git
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Codegen
|
||||
run: |
|
||||
./scripts/cross-compile-codegen.sh win32 x64
|
||||
- if: ${{ inputs.canary }}
|
||||
name: Calculate Revision
|
||||
run: |
|
||||
echo "canary_revision=$(GITHUB_TOKEN="${{ github.token }}"
|
||||
bash ./scripts/calculate-canary-revision.sh --raw)" > build-codegen-win32-x64/.canary_revision
|
||||
- name: Upload bun-${{ inputs.tag }}-codegen
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-codegen
|
||||
path: build-codegen-win32-x64
|
||||
if-no-files-found: error
|
||||
build-cpp:
|
||||
name: Build C++
|
||||
needs: codegen
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- name: Setup Git
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install LLVM
|
||||
uses: KyleMayes/install-llvm-action@8b37482c5a2997a3ab5dbf6561f8109e2eaa7d3b
|
||||
with:
|
||||
version: ${{ env.LLVM_VERSION }}
|
||||
- name: Install Ninja
|
||||
run: |
|
||||
choco install -y ninja
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- if: ${{ !inputs.no-cache }}
|
||||
name: Restore Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ccache
|
||||
key: bun-${{ inputs.tag }}-cpp-${{ hashFiles('Dockerfile', 'Makefile', 'CMakeLists.txt', 'build.zig', 'scripts/**', 'src/**', 'packages/bun-usockets/src/**', 'packages/bun-uws/src/**') }}
|
||||
restore-keys: |
|
||||
bun-${{ inputs.tag }}-cpp-
|
||||
- name: Download bun-${{ inputs.tag }}-codegen
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-codegen
|
||||
path: build
|
||||
- name: Compile
|
||||
env:
|
||||
CPU_TARGET: ${{ inputs.cpu }}
|
||||
CCACHE_DIR: ccache
|
||||
run: |
|
||||
# $CANARY_REVISION = if (Test-Path build/.canary_revision) { Get-Content build/.canary_revision } else { "0" }
|
||||
$CANARY_REVISION = 0
|
||||
.\scripts\env.ps1 ${{ contains(inputs.tag, '-baseline') && '-Baseline' || '' }}
|
||||
.\scripts\update-submodules.ps1
|
||||
.\scripts\build-libuv.ps1 -CloneOnly $True
|
||||
cd build
|
||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release `
|
||||
-DNO_CODEGEN=1 `
|
||||
-DNO_CONFIGURE_DEPENDS=1 `
|
||||
"-DCANARY=${CANARY_REVISION}" `
|
||||
-DBUN_CPP_ONLY=1 ${{ contains(inputs.tag, '-baseline') && '-DUSE_BASELINE_BUILD=1' || '' }}
|
||||
if ($LASTEXITCODE -ne 0) { throw "CMake configuration failed" }
|
||||
.\compile-cpp-only.ps1 -v
|
||||
if ($LASTEXITCODE -ne 0) { throw "C++ compilation failed" }
|
||||
- name: Upload bun-${{ inputs.tag }}-cpp
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-cpp
|
||||
path: build/bun-cpp-objects.a
|
||||
if-no-files-found: error
|
||||
build-zig:
|
||||
name: Build Zig
|
||||
uses: ./.github/workflows/build-zig.yml
|
||||
with:
|
||||
os: windows
|
||||
zig-optimize: ReleaseSafe
|
||||
only-zig: true
|
||||
tag: ${{ inputs.tag }}
|
||||
arch: ${{ inputs.arch }}
|
||||
cpu: ${{ inputs.cpu }}
|
||||
assertions: ${{ inputs.assertions }}
|
||||
canary: ${{ inputs.canary }}
|
||||
no-cache: ${{ inputs.no-cache }}
|
||||
link:
|
||||
name: Link
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
needs:
|
||||
- build-submodules
|
||||
- build-cpp
|
||||
- build-zig
|
||||
- codegen
|
||||
steps:
|
||||
- name: Setup Git
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install LLVM
|
||||
uses: KyleMayes/install-llvm-action@8b37482c5a2997a3ab5dbf6561f8109e2eaa7d3b
|
||||
with:
|
||||
version: ${{ env.LLVM_VERSION }}
|
||||
- name: Install Ninja
|
||||
run: |
|
||||
choco install -y ninja
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Download bun-${{ inputs.tag }}-deps
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-deps
|
||||
path: bun-deps
|
||||
- name: Download bun-${{ inputs.tag }}-cpp
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-cpp
|
||||
path: bun-cpp
|
||||
- name: Download bun-${{ inputs.tag }}-zig
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-zig
|
||||
path: bun-zig
|
||||
- name: Download bun-${{ inputs.tag }}-codegen
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-codegen
|
||||
path: build
|
||||
- if: ${{ !inputs.no-cache }}
|
||||
name: Restore Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ccache
|
||||
key: bun-${{ inputs.tag }}-cpp-${{ hashFiles('Dockerfile', 'Makefile', 'CMakeLists.txt', 'build.zig', 'scripts/**', 'src/**', 'packages/bun-usockets/src/**', 'packages/bun-uws/src/**') }}
|
||||
restore-keys: |
|
||||
bun-${{ inputs.tag }}-cpp-
|
||||
- name: Link
|
||||
env:
|
||||
CPU_TARGET: ${{ inputs.cpu }}
|
||||
CCACHE_DIR: ccache
|
||||
run: |
|
||||
.\scripts\update-submodules.ps1
|
||||
.\scripts\env.ps1 ${{ contains(inputs.tag, '-baseline') && '-Baseline' || '' }}
|
||||
Set-Location build
|
||||
# $CANARY_REVISION = if (Test-Path build/.canary_revision) { Get-Content build/.canary_revision } else { "0" }
|
||||
$CANARY_REVISION = 0
|
||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release `
|
||||
-DNO_CODEGEN=1 `
|
||||
-DNO_CONFIGURE_DEPENDS=1 `
|
||||
"-DCANARY=${CANARY_REVISION}" `
|
||||
-DBUN_LINK_ONLY=1 `
|
||||
"-DBUN_DEPS_OUT_DIR=$(Resolve-Path ../bun-deps)" `
|
||||
"-DBUN_CPP_ARCHIVE=$(Resolve-Path ../bun-cpp/bun-cpp-objects.a)" `
|
||||
"-DBUN_ZIG_OBJ=$(Resolve-Path ../bun-zig/bun-zig.o)" `
|
||||
${{ contains(inputs.tag, '-baseline') && '-DUSE_BASELINE_BUILD=1' || '' }}
|
||||
if ($LASTEXITCODE -ne 0) { throw "CMake configuration failed" }
|
||||
ninja -v
|
||||
if ($LASTEXITCODE -ne 0) { throw "Link failed!" }
|
||||
- name: Prepare
|
||||
run: |
|
||||
$Dist = mkdir -Force "bun-${{ inputs.tag }}"
|
||||
cp -r build\bun.exe "$Dist\bun.exe"
|
||||
Compress-Archive -Force "$Dist" "${Dist}.zip"
|
||||
$Dist = "$Dist-profile"
|
||||
MkDir -Force "$Dist"
|
||||
cp -r build\bun.exe "$Dist\bun.exe"
|
||||
cp -r build\bun.pdb "$Dist\bun.pdb"
|
||||
Compress-Archive -Force "$Dist" "$Dist.zip"
|
||||
$env:BUN_GARBAGE_COLLECTOR_LEVEL = "1"
|
||||
$env:BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING = "1"
|
||||
.\build\bun.exe --print "JSON.stringify(require('bun:internal-for-testing').crash_handler.getFeatureData())" > .\features.json
|
||||
- name: Upload bun-${{ inputs.tag }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}
|
||||
path: bun-${{ inputs.tag }}.zip
|
||||
if-no-files-found: error
|
||||
- name: Upload bun-${{ inputs.tag }}-profile
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-profile
|
||||
path: bun-${{ inputs.tag }}-profile.zip
|
||||
if-no-files-found: error
|
||||
- name: Upload bun-feature-data
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-feature-data
|
||||
path: features.json
|
||||
if-no-files-found: error
|
||||
overwrite: true
|
||||
on-failure:
|
||||
if: ${{ github.repository_owner == 'oven-sh' && failure() }}
|
||||
name: On Failure
|
||||
needs: link
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send Message
|
||||
uses: sarisia/actions-status-discord@v1
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
nodetail: true
|
||||
color: "#FF0000"
|
||||
title: ""
|
||||
description: |
|
||||
### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})
|
||||
|
||||
@${{ github.actor }}, the build for bun-${{ inputs.tag }} failed.
|
||||
|
||||
**[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})**
|
||||
122
.github/workflows/build-zig.yml
vendored
Normal file
122
.github/workflows/build-zig.yml
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
name: Build Zig
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runs-on:
|
||||
type: string
|
||||
default: ${{ github.repository_owner != 'oven-sh' && 'ubuntu-latest' || inputs.only-zig && 'namespace-profile-bun-ci-linux-x64' || inputs.arch == 'x64' && 'namespace-profile-bun-ci-linux-x64' || 'namespace-profile-bun-ci-linux-aarch64' }}
|
||||
tag:
|
||||
type: string
|
||||
required: true
|
||||
os:
|
||||
type: string
|
||||
required: true
|
||||
arch:
|
||||
type: string
|
||||
required: true
|
||||
cpu:
|
||||
type: string
|
||||
required: true
|
||||
assertions:
|
||||
type: boolean
|
||||
default: false
|
||||
zig-optimize:
|
||||
type: string # 'ReleaseSafe' or 'ReleaseFast'
|
||||
default: ReleaseFast
|
||||
canary:
|
||||
type: boolean
|
||||
default: ${{ github.ref == 'refs/heads/main' }}
|
||||
only-zig:
|
||||
type: boolean
|
||||
default: true
|
||||
no-cache:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build-zig:
|
||||
name: ${{ inputs.only-zig && 'Build Zig' || 'Build & Link' }}
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Calculate Cache Key
|
||||
id: cache
|
||||
run: |
|
||||
echo "key=${{ hashFiles('Dockerfile', 'Makefile', 'CMakeLists.txt', 'build.zig', 'scripts/**', 'src/**', 'packages/bun-usockets/src/**', 'packages/bun-uws/src/**') }}" >> $GITHUB_OUTPUT
|
||||
- if: ${{ !inputs.no-cache }}
|
||||
name: Restore Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
key: bun-${{ inputs.tag }}-docker-${{ steps.cache.outputs.key }}
|
||||
restore-keys: |
|
||||
bun-${{ inputs.tag }}-docker-
|
||||
path: |
|
||||
${{ runner.temp }}/dockercache
|
||||
- name: Setup Docker
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
install: true
|
||||
platforms: |
|
||||
linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: false
|
||||
target: ${{ inputs.only-zig && 'build_release_obj' || 'artifact' }}
|
||||
cache-from: |
|
||||
type=local,src=${{ runner.temp }}/dockercache
|
||||
cache-to: |
|
||||
type=local,dest=${{ runner.temp }}/dockercache,mode=max
|
||||
outputs: |
|
||||
type=local,dest=${{ runner.temp }}/release
|
||||
platforms: |
|
||||
linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
build-args: |
|
||||
GIT_SHA=${{ github.event.workflow_run.head_sha || github.sha }}
|
||||
TRIPLET=${{ inputs.os == 'darwin' && format('{0}-macos-none', inputs.arch == 'x64' && 'x86_64' || 'aarch64') || inputs.os == 'windows' && format('{0}-windows-msvc', inputs.arch == 'x64' && 'x86_64' || 'aarch64') || format('{0}-linux-gnu', inputs.arch == 'x64' && 'x86_64' || 'aarch64') }}
|
||||
ARCH=${{ inputs.arch == 'x64' && 'x86_64' || 'aarch64' }}
|
||||
BUILDARCH=${{ inputs.arch == 'x64' && 'amd64' || 'arm64' }}
|
||||
BUILD_MACHINE_ARCH=${{ inputs.arch == 'x64' && 'x86_64' || 'aarch64' }}
|
||||
CPU_TARGET=${{ inputs.arch == 'x64' && inputs.cpu || 'native' }}
|
||||
ASSERTIONS=${{ inputs.assertions && 'ON' || 'OFF' }}
|
||||
ZIG_OPTIMIZE=${{ inputs.zig-optimize }}
|
||||
CANARY=${{ inputs.canary && '1' || '0' }}
|
||||
- if: ${{ inputs.only-zig }}
|
||||
name: Upload bun-${{ inputs.tag }}-zig
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-zig
|
||||
path: ${{ runner.temp }}/release/bun-zig.o
|
||||
if-no-files-found: error
|
||||
- if: ${{ !inputs.only-zig }}
|
||||
name: Prepare
|
||||
run: |
|
||||
cd ${{ runner.temp }}/release
|
||||
chmod +x bun-profile bun
|
||||
mkdir bun-${{ inputs.tag }}-profile
|
||||
mkdir bun-${{ inputs.tag }}
|
||||
strip bun
|
||||
mv bun-profile bun-${{ inputs.tag }}-profile/bun-profile
|
||||
mv bun bun-${{ inputs.tag }}/bun
|
||||
zip -r bun-${{ inputs.tag }}-profile.zip bun-${{ inputs.tag }}-profile
|
||||
zip -r bun-${{ inputs.tag }}.zip bun-${{ inputs.tag }}
|
||||
- if: ${{ !inputs.only-zig }}
|
||||
name: Upload bun-${{ inputs.tag }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}
|
||||
path: ${{ runner.temp }}/release/bun-${{ inputs.tag }}.zip
|
||||
if-no-files-found: error
|
||||
- if: ${{ !inputs.only-zig }}
|
||||
name: Upload bun-${{ inputs.tag }}-profile
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-profile
|
||||
path: ${{ runner.temp }}/release/bun-${{ inputs.tag }}-profile.zip
|
||||
if-no-files-found: error
|
||||
18
.github/workflows/bun-deploy-site.yml
vendored
18
.github/workflows/bun-deploy-site.yml
vendored
@@ -1,18 +0,0 @@
|
||||
# redeploy Vercel site when a file in `docs` changes
|
||||
# using VERCEL_DEPLOY_HOOK environment variable
|
||||
|
||||
name: Deploy site
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "docs/**"
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy site
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
steps:
|
||||
- name: Trigger Vercel build
|
||||
run: curl ${{ secrets.VERCEL_DEPLOY_HOOK }}
|
||||
142
.github/workflows/bun-linux-aarch64.yml
vendored
142
.github/workflows/bun-linux-aarch64.yml
vendored
@@ -1,142 +0,0 @@
|
||||
name: bun-linux
|
||||
|
||||
concurrency:
|
||||
group: bun-linux-aarch64-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- ".github/workflows/bun-linux-aarch64.yml"
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- ".github/workflows/bun-linux-aarch64.yml"
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
name: ${{matrix.tag}}
|
||||
runs-on: ${{matrix.runner}}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 90
|
||||
permissions: write-all
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: native
|
||||
tag: linux-aarch64
|
||||
arch: aarch64
|
||||
build_arch: arm64
|
||||
runner: linux-arm64
|
||||
build_machine_arch: aarch64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
ref: ${{github.sha}}
|
||||
clean: true
|
||||
- run: |
|
||||
bash ./scripts/update-submodules.sh
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
- name: Run
|
||||
run: |
|
||||
rm -rf ${{runner.temp}}/release
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: |
|
||||
mkdir -p /tmp/.buildx-cache-${{matrix.tag}}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
cache-from: type=local,src=/tmp/.buildx-cache-${{matrix.tag}}
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache-${{matrix.tag}}
|
||||
build-args: |
|
||||
ARCH=${{matrix.arch}}
|
||||
BUILDARCH=${{matrix.build_arch}}
|
||||
BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}}
|
||||
CPU_TARGET=${{matrix.cpu}}
|
||||
GIT_SHA=${{github.sha}}
|
||||
platforms: linux/${{matrix.build_arch}}
|
||||
target: artifact
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- name: Zip
|
||||
run: |
|
||||
# if zip is not found
|
||||
if [ ! -x "$(command -v zip)" ]; then
|
||||
sudo apt-get update && sudo apt-get install -y zip --no-install-recommends
|
||||
fi
|
||||
|
||||
if [ ! -x "$(command -v strip)" ]; then
|
||||
sudo apt-get update && sudo apt-get install -y binutils --no-install-recommends
|
||||
fi
|
||||
|
||||
cd ${{runner.temp}}/release
|
||||
chmod +x bun-profile bun
|
||||
|
||||
mkdir bun-${{matrix.tag}}-profile
|
||||
mkdir bun-${{matrix.tag}}
|
||||
|
||||
strip bun
|
||||
|
||||
mv bun-profile bun-${{matrix.tag}}-profile/bun-profile
|
||||
mv bun bun-${{matrix.tag}}/bun
|
||||
|
||||
zip -r bun-${{matrix.tag}}-profile.zip bun-${{matrix.tag}}-profile
|
||||
zip -r bun-${{matrix.tag}}.zip bun-${{matrix.tag}}
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{matrix.tag}}-profile
|
||||
path: ${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip
|
||||
if-no-files-found: "error"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release/bun-${{matrix.tag}}.zip
|
||||
if-no-files-found: "error"
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: |
|
||||
github.repository_owner == 'oven-sh'
|
||||
&& github.ref == 'refs/heads/main'
|
||||
with:
|
||||
prerelease: true
|
||||
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
|
||||
allowUpdates: true
|
||||
replacesArtifacts: true
|
||||
generateReleaseNotes: true
|
||||
artifactErrorsFailBuild: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{runner.temp}}/release/bun-${{matrix.tag}}.zip,${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip"
|
||||
316
.github/workflows/bun-linux-build.yml
vendored
316
.github/workflows/bun-linux-build.yml
vendored
@@ -1,316 +0,0 @@
|
||||
name: bun-linux
|
||||
|
||||
concurrency:
|
||||
group: bun-linux-build-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- ".github/workflows/bun-linux-build.yml"
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- ".github/workflows/bun-linux-build.yml"
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
name: ${{matrix.tag}}
|
||||
runs-on: ${{matrix.runner}}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 90
|
||||
permissions: write-all
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- cpu: haswell
|
||||
tag: linux-x64
|
||||
arch: x86_64
|
||||
build_arch: amd64
|
||||
runner: namespace-profile-bun-linux-x64
|
||||
build_machine_arch: x86_64
|
||||
assertions: "OFF"
|
||||
zig_optimize: "ReleaseFast"
|
||||
target: "artifact"
|
||||
- cpu: nehalem
|
||||
tag: linux-x64-baseline
|
||||
arch: x86_64
|
||||
build_arch: amd64
|
||||
runner: namespace-profile-bun-linux-x64
|
||||
build_machine_arch: x86_64
|
||||
assertions: "OFF"
|
||||
zig_optimize: "ReleaseFast"
|
||||
target: "artifact"
|
||||
# - cpu: haswell
|
||||
# tag: linux-x64-assertions
|
||||
# arch: x86_64
|
||||
# build_arch: amd64
|
||||
# runner: big-ubuntu
|
||||
# build_machine_arch: x86_64
|
||||
# assertions: "ON"
|
||||
# zig_optimize: "ReleaseSafe"
|
||||
# target: "artifact-assertions"
|
||||
# - cpu: nehalem
|
||||
# tag: linux-x64-baseline-assertions
|
||||
# arch: x86_64
|
||||
# build_arch: amd64
|
||||
# runner: big-ubuntu
|
||||
# build_machine_arch: x86_64
|
||||
# assertions: "ON"
|
||||
# zig_optimize: "ReleaseSafe"
|
||||
# target: "artifact-assertions"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
ref: ${{github.sha}}
|
||||
clean: true
|
||||
- name: Run
|
||||
run: |
|
||||
rm -rf ${{runner.temp}}/release
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
build-args: |
|
||||
ARCH=${{matrix.arch}}
|
||||
BUILDARCH=${{matrix.build_arch}}
|
||||
BUILD_MACHINE_ARCH=${{matrix.build_machine_arch}}
|
||||
CPU_TARGET=${{matrix.cpu}}
|
||||
GIT_SHA=${{github.sha}}
|
||||
ASSERTIONS=${{matrix.assertions}}
|
||||
ZIG_OPTIMIZE=${{matrix.zig_optimize}}
|
||||
platforms: linux/${{matrix.build_arch}}
|
||||
target: ${{matrix.target}}
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
${{runner.temp}}/release/bun-profile --version
|
||||
- name: Zip
|
||||
run: |
|
||||
# if zip is not found
|
||||
if [ ! -x "$(command -v zip)" ]; then
|
||||
sudo apt-get update && sudo apt-get install -y zip --no-install-recommends
|
||||
fi
|
||||
|
||||
if [ ! -x "$(command -v strip)" ]; then
|
||||
sudo apt-get update && sudo apt-get install -y binutils --no-install-recommends
|
||||
fi
|
||||
|
||||
cd ${{runner.temp}}/release
|
||||
chmod +x bun-profile bun
|
||||
|
||||
mkdir bun-${{matrix.tag}}-profile
|
||||
mkdir bun-${{matrix.tag}}
|
||||
|
||||
strip bun
|
||||
|
||||
mv bun-profile bun-${{matrix.tag}}-profile/bun-profile
|
||||
mv bun bun-${{matrix.tag}}/bun
|
||||
|
||||
zip -r bun-${{matrix.tag}}-profile.zip bun-${{matrix.tag}}-profile
|
||||
zip -r bun-${{matrix.tag}}.zip bun-${{matrix.tag}}
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{matrix.tag}}-profile
|
||||
path: ${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip
|
||||
if-no-files-found: "error"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release/bun-${{matrix.tag}}.zip
|
||||
if-no-files-found: "error"
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: |
|
||||
github.repository_owner == 'oven-sh'
|
||||
&& github.ref == 'refs/heads/main'
|
||||
with:
|
||||
prerelease: true
|
||||
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
|
||||
allowUpdates: true
|
||||
replacesArtifacts: true
|
||||
generateReleaseNotes: true
|
||||
artifactErrorsFailBuild: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{runner.temp}}/release/bun-${{matrix.tag}}.zip,${{runner.temp}}/release/bun-${{matrix.tag}}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on ${{ matrix.tag }}:
|
||||
|
||||
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
linux-test:
|
||||
name: Tests ${{matrix.tag}}
|
||||
runs-on: namespace-profile-bun-linux-x64
|
||||
needs: [linux]
|
||||
if: github.event_name == 'pull_request'
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
pull-requests: write
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- tag: linux-x64
|
||||
- tag: linux-x64-baseline
|
||||
# - tag: linux-x64-assertions
|
||||
# - tag: linux-x64-baseline-assertions
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
clean: true
|
||||
- id: download
|
||||
name: Download
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release
|
||||
- id: install-bun
|
||||
name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip bun-${{matrix.tag}}.zip
|
||||
cd bun-${{matrix.tag}}
|
||||
chmod +x bun
|
||||
pwd >> $GITHUB_PATH
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
bun --version
|
||||
- id: install-dependnecies
|
||||
name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y openssl
|
||||
bun install --verbose
|
||||
bun install --cwd=test --verbose
|
||||
bun install --cwd=packages/bun-internal-test --verbose
|
||||
|
||||
bun install --cwd=test/js/third_party/prisma --verbose
|
||||
|
||||
# This is disabled because the cores are ~5.5gb each
|
||||
# so it is easy to hit 50gb coredump downloads. Only enable if you need to retrive one
|
||||
|
||||
# - name: Set core dumps to get stored in /cores
|
||||
# run: |
|
||||
# sudo mkdir /cores
|
||||
# sudo chmod 777 /cores
|
||||
# # Core filenames will be of the form executable.pid.timestamp:
|
||||
# sudo bash -c 'echo "/cores/%e.%p.%t" > /proc/sys/kernel/core_pattern'
|
||||
|
||||
- id: test
|
||||
name: Test (node runner)
|
||||
env:
|
||||
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
|
||||
TMPDIR: ${{runner.temp}}
|
||||
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
# if: ${{github.event.inputs.use_bun == 'false'}}
|
||||
run: |
|
||||
node packages/bun-internal-test/src/runner.node.mjs || true
|
||||
# - uses: actions/upload-artifact@v4
|
||||
# if: steps.test.outputs.failing_tests != ''
|
||||
# with:
|
||||
# name: cores
|
||||
# path: /cores
|
||||
# if-no-files-found: "error"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
- name: Comment on PR
|
||||
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-failures-${{matrix.tag}}
|
||||
message: |
|
||||
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- name: Uncomment on PR
|
||||
if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-failures-${{matrix.tag}}
|
||||
mode: upsert
|
||||
create_if_not_exists: false
|
||||
message: |
|
||||
✅ test failures on ${{ matrix.tag }} have been resolved.
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- id: fail
|
||||
name: Fail the build
|
||||
if: steps.test.outputs.failing_tests != ''
|
||||
run: exit 1
|
||||
479
.github/workflows/bun-mac-aarch64.yml
vendored
479
.github/workflows/bun-mac-aarch64.yml
vendored
@@ -1,479 +0,0 @@
|
||||
name: bun-macOS-aarch64
|
||||
|
||||
concurrency:
|
||||
group: bun-macOS-aarch64-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
LLVM_VERSION: 16
|
||||
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
macOS-zig:
|
||||
name: macOS Zig Object
|
||||
runs-on: namespace-profile-zig-build
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: native
|
||||
arch: aarch64
|
||||
tag: bun-obj-darwin-aarch64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# - name: Checkout submodules
|
||||
# run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Compile Zig Object
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
# This doesnt seem to work
|
||||
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
build-args: |
|
||||
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{ matrix.arch }}-macos-none
|
||||
GIT_SHA=${{ github.sha }}
|
||||
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
|
||||
- name: Upload Zig Object
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}
|
||||
path: ${{runner.temp}}/release/bun-zig.o
|
||||
if-no-files-found: "error"
|
||||
|
||||
macOS-dependencies:
|
||||
name: macOS Dependencies
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: native
|
||||
arch: aarch64
|
||||
tag: bun-darwin-aarch64
|
||||
obj: bun-obj-darwin-aarch64
|
||||
artifact: bun-obj-darwin-aarch64
|
||||
runner: macos-13-xlarge
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install go sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-aarch64.zip"
|
||||
unzip bun-darwin-aarch64.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-aarch64/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Hash submodule versions
|
||||
run: |
|
||||
print_data() {
|
||||
git submodule | grep -v WebKit
|
||||
llvm-config --version
|
||||
rustc --version
|
||||
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
|
||||
}
|
||||
echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
|
||||
id: submodule-versions
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
id: cache-deps-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }}
|
||||
|
||||
- name: Compile submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
mkdir -p $BUN_DEPS_OUT_DIR
|
||||
bash ./scripts/clean-dependencies.sh
|
||||
bash ./scripts/all-dependencies.sh
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
id: cache-deps-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Upload submodule dependencies
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
if-no-files-found: "error"
|
||||
|
||||
macOS-cpp:
|
||||
name: macOS C++
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: native
|
||||
arch: aarch64
|
||||
tag: bun-darwin-aarch64
|
||||
obj: bun-obj-darwin-aarch64
|
||||
artifact: bun-obj-darwin-aarch64
|
||||
runner: macos-13-xlarge
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install go sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-aarch64.zip"
|
||||
unzip bun-darwin-aarch64.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-aarch64/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
# TODO: replace with sccache
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
|
||||
- name: Compile C++
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
SOURCE_DIR: ${{ github.workspace }}
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
mkdir -p $OBJ_DIR
|
||||
cd $OBJ_DIR
|
||||
|
||||
cmake -S $SOURCE_DIR -B $OBJ_DIR \
|
||||
-G Ninja \
|
||||
-DUSE_LTO=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_CPP_ONLY=1 \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
|
||||
bash compile-cpp-only.sh -v
|
||||
|
||||
- name: Upload C++
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
|
||||
if-no-files-found: "error"
|
||||
macOS-link:
|
||||
name: macOS Link
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
needs: [macOS-zig, macOS-cpp, macOS-dependencies]
|
||||
timeout-minutes: 60
|
||||
permissions: write-all
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: native
|
||||
arch: aarch64
|
||||
tag: bun-darwin-aarch64
|
||||
obj: bun-obj-darwin-aarch64
|
||||
package: bun-darwin-aarch64
|
||||
artifact: bun-obj-darwin-aarch64
|
||||
runner: macos-13-xlarge
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
ref: ${{github.sha}}
|
||||
clean: true
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-${{matrix.arch}}.zip"
|
||||
unzip bun-darwin-${{matrix.arch}}.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-${{matrix.arch}}/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Download C++
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
|
||||
- name: Download Zig Object
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.obj }}
|
||||
path: ${{ runner.temp }}/release
|
||||
|
||||
- name: Downloaded submodule dependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
- name: Link
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
run: |
|
||||
SRC_DIR=$PWD
|
||||
mkdir ${{runner.temp}}/link-build
|
||||
cd ${{runner.temp}}/link-build
|
||||
cmake $SRC_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DUSE_LTO=ON \
|
||||
-DBUN_LINK_ONLY=1 \
|
||||
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
|
||||
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
|
||||
-DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
ninja -v
|
||||
- name: Zip
|
||||
run: |
|
||||
cd ${{runner.temp}}/link-build
|
||||
chmod +x bun-profile bun
|
||||
|
||||
mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/
|
||||
|
||||
mv bun-profile ${{matrix.tag}}-profile/bun-profile
|
||||
mv bun ${{matrix.tag}}/bun
|
||||
|
||||
zip -r ${{matrix.tag}}-profile.zip ${{matrix.tag}}-profile
|
||||
zip -r ${{matrix.tag}}.zip ${{matrix.tag}}
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{matrix.tag}}-profile
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip
|
||||
if-no-files-found: "error"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip
|
||||
if-no-files-found: "error"
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: |
|
||||
github.repository_owner == 'oven-sh'
|
||||
&& github.ref == 'refs/heads/main'
|
||||
with:
|
||||
prerelease: true
|
||||
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
|
||||
allowUpdates: true
|
||||
replacesArtifacts: true
|
||||
generateReleaseNotes: true
|
||||
artifactErrorsFailBuild: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on ${{ matrix.tag }}:
|
||||
|
||||
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
macOS-test:
|
||||
name: Tests ${{matrix.tag}}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
needs: [macOS-link]
|
||||
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
|
||||
permissions:
|
||||
pull-requests: write
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- tag: bun-darwin-aarch64
|
||||
runner: macos-13-xlarge
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
- id: download
|
||||
name: Download
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release
|
||||
- id: install-bun
|
||||
name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip ${{matrix.tag}}.zip
|
||||
cd ${{matrix.tag}}
|
||||
chmod +x bun
|
||||
pwd >> $GITHUB_PATH
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
bun --version
|
||||
- id: install
|
||||
name: Install dependencies
|
||||
run: |
|
||||
bun install --verbose
|
||||
bun install --cwd=test --verbose
|
||||
bun install --cwd=packages/bun-internal-test --verbose
|
||||
- id: test
|
||||
name: Test (node runner)
|
||||
env:
|
||||
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
|
||||
TMPDIR: ${{runner.temp}}
|
||||
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
# if: ${{github.event.inputs.use_bun == 'false'}}
|
||||
run: |
|
||||
node packages/bun-internal-test/src/runner.node.mjs || true
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
- name: Comment on PR
|
||||
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-failures-${{matrix.tag}}
|
||||
message: |
|
||||
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- name: Uncomment on PR
|
||||
if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-failures-${{matrix.tag}}
|
||||
mode: upsert
|
||||
create_if_not_exists: false
|
||||
message: |
|
||||
✅ test failures on ${{ matrix.tag }} have been resolved.
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- id: fail
|
||||
name: Fail the build
|
||||
if: steps.test.outputs.failing_tests != ''
|
||||
run: exit 1
|
||||
469
.github/workflows/bun-mac-x64-baseline.yml
vendored
469
.github/workflows/bun-mac-x64-baseline.yml
vendored
@@ -1,469 +0,0 @@
|
||||
name: bun-macOS-x64-baseline
|
||||
|
||||
concurrency:
|
||||
group: bun-macOS-x64-baseline-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
LLVM_VERSION: 16
|
||||
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
macos-object-files:
|
||||
name: macOS Object
|
||||
runs-on: namespace-profile-zig-build
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: nehalem
|
||||
arch: x86_64
|
||||
tag: bun-obj-darwin-x64-baseline
|
||||
# - cpu: haswell
|
||||
# arch: x86_64
|
||||
# tag: bun-obj-darwin-x64
|
||||
# - cpu: native
|
||||
# arch: aarch64
|
||||
# tag: bun-obj-darwin-aarch64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Compile Zig Object
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
build-args: |
|
||||
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{ matrix.arch }}-macos-none
|
||||
GIT_SHA=${{ github.sha }}
|
||||
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- name: Upload Zig Object
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}
|
||||
path: ${{runner.temp}}/release/bun-zig.o
|
||||
if-no-files-found: "error"
|
||||
macOS-dependencies:
|
||||
name: macOS Dependencies
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: nehalem
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64-baseline
|
||||
obj: bun-obj-darwin-x64-baseline
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64-baseline
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
- name: Hash submodule versions
|
||||
run: |
|
||||
print_data() {
|
||||
git submodule | grep -v WebKit
|
||||
llvm-config --version
|
||||
rustc --version
|
||||
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
|
||||
}
|
||||
echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
|
||||
id: submodule-versions
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
id: cache-deps-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }}
|
||||
|
||||
- name: Compile submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
mkdir -p $BUN_DEPS_OUT_DIR
|
||||
bash ./scripts/clean-dependencies.sh
|
||||
bash ./scripts/all-dependencies.sh
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
id: cache-deps-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Upload submodule dependencies
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
if-no-files-found: "error"
|
||||
|
||||
macOS-cpp:
|
||||
name: macOS C++
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: nehalem
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64-baseline
|
||||
obj: bun-obj-darwin-x64-baseline
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64-baseline
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64-baseline.zip"
|
||||
unzip bun-darwin-x64-baseline.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-x64-baseline/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
# TODO: replace with sccache
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
|
||||
- name: Compile C++
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
SOURCE_DIR: ${{ github.workspace }}
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
mkdir -p $OBJ_DIR
|
||||
cd $OBJ_DIR
|
||||
|
||||
cmake -S $SOURCE_DIR -B $OBJ_DIR \
|
||||
-G Ninja \
|
||||
-DUSE_LTO=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_CPP_ONLY=1 \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
|
||||
bash compile-cpp-only.sh -v
|
||||
|
||||
- name: Upload C++
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
|
||||
if-no-files-found: "error"
|
||||
macOS:
|
||||
name: macOS Link
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
needs: [macOS-cpp, macos-object-files, macOS-dependencies]
|
||||
timeout-minutes: 90
|
||||
permissions: write-all
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: nehalem
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64-baseline
|
||||
obj: bun-obj-darwin-x64-baseline
|
||||
package: bun-darwin-x64
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64-baseline
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64-baseline.zip"
|
||||
unzip bun-darwin-x64-baseline.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-x64-baseline/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Download C++
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
|
||||
- name: Download Zig Object
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.obj }}
|
||||
path: ${{ runner.temp }}/release
|
||||
|
||||
- name: Downloaded submodule dependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
- name: Link
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
run: |
|
||||
SRC_DIR=$PWD
|
||||
mkdir ${{runner.temp}}/link-build
|
||||
cd ${{runner.temp}}/link-build
|
||||
cmake $SRC_DIR \
|
||||
-G Ninja \
|
||||
-DUSE_LTO=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_LINK_ONLY=1 \
|
||||
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
|
||||
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
|
||||
-DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
ninja -v
|
||||
- name: Zip
|
||||
run: |
|
||||
cd ${{runner.temp}}/link-build
|
||||
chmod +x bun-profile bun
|
||||
|
||||
mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/
|
||||
|
||||
mv bun-profile ${{matrix.tag}}-profile/bun-profile
|
||||
mv bun ${{matrix.tag}}/bun
|
||||
|
||||
zip -r ${{matrix.tag}}-profile.zip ${{matrix.tag}}-profile
|
||||
zip -r ${{matrix.tag}}.zip ${{matrix.tag}}
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{matrix.tag}}-profile
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip
|
||||
if-no-files-found: "error"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip
|
||||
if-no-files-found: "error"
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: |
|
||||
github.repository_owner == 'oven-sh'
|
||||
&& github.ref == 'refs/heads/main'
|
||||
with:
|
||||
prerelease: true
|
||||
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
|
||||
allowUpdates: true
|
||||
replacesArtifacts: true
|
||||
generateReleaseNotes: true
|
||||
artifactErrorsFailBuild: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on ${{ matrix.tag }}:
|
||||
|
||||
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
macOS-test:
|
||||
name: macOS Test
|
||||
runs-on: ${{ matrix.runner }}
|
||||
needs: [macOS]
|
||||
# if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
|
||||
if: false
|
||||
permissions:
|
||||
pull-requests: write
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- tag: bun-darwin-x64-baseline
|
||||
runner: macos-12-large
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
- id: download
|
||||
name: Download
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release
|
||||
- id: install-bun
|
||||
name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip ${{matrix.tag}}.zip
|
||||
cd ${{matrix.tag}}
|
||||
chmod +x bun
|
||||
pwd >> $GITHUB_PATH
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
bun --version
|
||||
- id: install
|
||||
name: Install dependencies
|
||||
run: |
|
||||
bun install --verbose
|
||||
bun install --cwd=test --verbose
|
||||
bun install --cwd=packages/bun-internal-test --verbose
|
||||
- id: test
|
||||
name: Test (node runner)
|
||||
env:
|
||||
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
|
||||
TMPDIR: ${{runner.temp}}
|
||||
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
# if: ${{github.event.inputs.use_bun == 'false'}}
|
||||
run: |
|
||||
node packages/bun-internal-test/src/runner.node.mjs || true
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
Hey @${{ github.actor }},
|
||||
|
||||
${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
- name: Comment on PR
|
||||
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-failures-${{matrix.tag}}
|
||||
message: |
|
||||
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- name: Uncomment on PR
|
||||
if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-failures-${{matrix.tag}}
|
||||
mode: upsert
|
||||
create_if_not_exists: false
|
||||
message: |
|
||||
✅ test failures on ${{ matrix.tag }} have been resolved.
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- id: fail
|
||||
name: Fail the build
|
||||
if: steps.test.outputs.failing_tests != ''
|
||||
run: exit 1
|
||||
463
.github/workflows/bun-mac-x64.yml
vendored
463
.github/workflows/bun-mac-x64.yml
vendored
@@ -1,463 +0,0 @@
|
||||
name: bun-macOS-x64
|
||||
|
||||
concurrency:
|
||||
group: bun-macOS-x64-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
LLVM_VERSION: 16
|
||||
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
macOS-zig:
|
||||
name: macOS Zig Object
|
||||
runs-on: namespace-profile-zig-build
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# - cpu: nehalem
|
||||
# arch: x86_64
|
||||
# tag: bun-obj-darwin-x64-baseline
|
||||
- cpu: haswell
|
||||
arch: x86_64
|
||||
tag: bun-obj-darwin-x64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Compile Zig Object
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
build-args: |
|
||||
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{ matrix.arch }}-macos-none
|
||||
GIT_SHA=${{ github.sha }}
|
||||
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
- name: Upload Zig Object
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}
|
||||
path: ${{runner.temp}}/release/bun-zig.o
|
||||
if-no-files-found: "error"
|
||||
|
||||
macOS-dependencies:
|
||||
name: macOS Dependencies
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: haswell
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64
|
||||
obj: bun-obj-darwin-x64
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
- name: Hash submodule versions
|
||||
run: |
|
||||
print_data() {
|
||||
git submodule | grep -v WebKit
|
||||
llvm-config --version
|
||||
rustc --version
|
||||
cat $(echo scripts/build*.sh scripts/all-dependencies.sh | tr " " "\n" | sort)
|
||||
}
|
||||
echo "sha=$(print_data | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
|
||||
id: submodule-versions
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
id: cache-deps-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: bun-deps-${{ matrix.tag }}-${{ steps.submodule-versions.outputs.sha }}
|
||||
|
||||
- name: Compile submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
mkdir -p $BUN_DEPS_OUT_DIR
|
||||
bash ./scripts/clean-dependencies.sh
|
||||
bash ./scripts/all-dependencies.sh
|
||||
|
||||
- name: Cache submodule dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
id: cache-deps-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Upload submodule dependencies
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
if-no-files-found: "error"
|
||||
|
||||
macOS-cpp:
|
||||
name: macOS C++
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: haswell
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64
|
||||
obj: bun-obj-darwin-x64
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install sccache ccache rust llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja gnu-sed pkg-config --force
|
||||
# echo "$(brew --prefix sccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64.zip"
|
||||
unzip bun-darwin-x64.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-x64/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
# TODO: replace with sccache
|
||||
- name: ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
restore-keys: ${{ runner.os }}-ccache-${{ matrix.tag }}
|
||||
|
||||
- name: Compile C++
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
SOURCE_DIR: ${{ github.workspace }}
|
||||
OBJ_DIR: ${{ runner.temp }}/bun-cpp-obj
|
||||
BUN_DEPS_OUT_DIR: ${{runner.temp}}/bun-deps
|
||||
run: |
|
||||
mkdir -p $OBJ_DIR
|
||||
cd $OBJ_DIR
|
||||
|
||||
cmake -S $SOURCE_DIR -B $OBJ_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DUSE_LTO=ON \
|
||||
-DBUN_CPP_ONLY=1 \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
|
||||
bash compile-cpp-only.sh -v
|
||||
|
||||
- name: Upload C++
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
|
||||
if-no-files-found: "error"
|
||||
macOS:
|
||||
name: macOS Link
|
||||
runs-on: ${{ matrix.runner }}
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
needs: [macOS-cpp, macOS-zig, macOS-dependencies]
|
||||
timeout-minutes: 90
|
||||
permissions: write-all
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- cpu: haswell
|
||||
arch: x86_64
|
||||
tag: bun-darwin-x64
|
||||
obj: bun-obj-darwin-x64
|
||||
package: bun-darwin-x64
|
||||
runner: macos-12-large
|
||||
artifact: bun-obj-darwin-x64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive --depth=1 --progress --force
|
||||
|
||||
- name: Install system dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install ccache llvm@$LLVM_VERSION pkg-config coreutils libtool cmake libiconv openssl@1.1 ninja --force
|
||||
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
|
||||
curl -LO "$BUN_DOWNLOAD_URL_BASE/bun-darwin-x64-baseline.zip"
|
||||
unzip bun-darwin-x64-baseline.zip
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv bun-darwin-x64-baseline/bun ${{ runner.temp }}/.bun/bin/bun
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/bun
|
||||
echo "${{ runner.temp }}/.bun/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Download C++
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-cpp
|
||||
path: ${{ runner.temp }}/bun-cpp-obj
|
||||
|
||||
- name: Download Zig Object
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.obj }}
|
||||
path: ${{ runner.temp }}/release
|
||||
|
||||
- name: Downloaded submodule dependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.tag }}-deps
|
||||
path: ${{runner.temp}}/bun-deps
|
||||
|
||||
- name: Link
|
||||
env:
|
||||
CPU_TARGET: ${{ matrix.cpu }}
|
||||
run: |
|
||||
SRC_DIR=$PWD
|
||||
mkdir ${{runner.temp}}/link-build
|
||||
cd ${{runner.temp}}/link-build
|
||||
cmake $SRC_DIR \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DUSE_LTO=ON \
|
||||
-DBUN_LINK_ONLY=1 \
|
||||
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
|
||||
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
|
||||
-DBUN_DEPS_OUT_DIR="${{runner.temp}}/bun-deps" \
|
||||
-DNO_CONFIGURE_DEPENDS=1
|
||||
ninja -v
|
||||
- name: Zip
|
||||
run: |
|
||||
cd ${{runner.temp}}/link-build
|
||||
chmod +x bun-profile bun
|
||||
|
||||
mkdir -p ${{matrix.tag}}-profile/ ${{matrix.tag}}/
|
||||
|
||||
mv bun-profile ${{matrix.tag}}-profile/bun-profile
|
||||
mv bun ${{matrix.tag}}/bun
|
||||
|
||||
zip -r ${{matrix.tag}}-profile.zip ${{matrix.tag}}-profile
|
||||
zip -r ${{matrix.tag}}.zip ${{matrix.tag}}
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{matrix.tag}}-profile
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip
|
||||
if-no-files-found: "error"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/link-build/${{matrix.tag}}.zip
|
||||
if-no-files-found: "error"
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: |
|
||||
github.repository_owner == 'oven-sh'
|
||||
&& github.ref == 'refs/heads/main'
|
||||
with:
|
||||
prerelease: true
|
||||
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
|
||||
allowUpdates: true
|
||||
replacesArtifacts: true
|
||||
generateReleaseNotes: true
|
||||
artifactErrorsFailBuild: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{runner.temp}}/link-build/${{matrix.tag}}.zip,${{runner.temp}}/link-build/${{matrix.tag}}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on ${{ matrix.tag }}:
|
||||
|
||||
**[View build output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
[Commit ${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
macOS-test:
|
||||
name: Tests ${{matrix.tag}}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
needs: [macOS]
|
||||
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
|
||||
permissions:
|
||||
pull-requests: write
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- tag: bun-darwin-x64
|
||||
runner: macos-12-large
|
||||
steps:
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
- id: download
|
||||
name: Download
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{matrix.tag}}
|
||||
path: ${{runner.temp}}/release
|
||||
- id: install-bun
|
||||
name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip ${{matrix.tag}}.zip
|
||||
cd ${{matrix.tag}}
|
||||
chmod +x bun
|
||||
pwd >> $GITHUB_PATH
|
||||
- id: bun-version-check
|
||||
name: Bun version check
|
||||
run: |
|
||||
# If this hangs, it means something is seriously wrong with the build
|
||||
bun --version
|
||||
- id: install
|
||||
name: Install dependencies
|
||||
run: |
|
||||
bun install --verbose
|
||||
bun install --cwd=test --verbose
|
||||
bun install --cwd=packages/bun-internal-test --verbose
|
||||
- id: test
|
||||
name: Test (node runner)
|
||||
env:
|
||||
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
|
||||
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
|
||||
TMPDIR: ${{runner.temp}}
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
# if: ${{github.event.inputs.use_bun == 'false'}}
|
||||
run: |
|
||||
node packages/bun-internal-test/src/runner.node.mjs || true
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
Pull Request
|
||||
### ❌ [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
- name: Comment on PR
|
||||
if: steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-failures-${{matrix.tag}}
|
||||
message: |
|
||||
❌ @${{ github.actor }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on ${{ matrix.tag }}:
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})**
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- name: Uncomment on PR
|
||||
if: steps.test.outputs.failing_tests == '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-failures-${{matrix.tag}}
|
||||
mode: upsert
|
||||
create_if_not_exists: false
|
||||
message: |
|
||||
✅ test failures on ${{ matrix.tag }} have been resolved.
|
||||
|
||||
<sup>[#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}})</sup>
|
||||
- id: fail
|
||||
name: Fail the build
|
||||
if: steps.test.outputs.failing_tests != ''
|
||||
run: exit 1
|
||||
41
.github/workflows/bun-types-tests.yml
vendored
41
.github/workflows/bun-types-tests.yml
vendored
@@ -1,41 +0,0 @@
|
||||
name: bun-types
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "packages/bun-types/**"
|
||||
branches: [main]
|
||||
pull_request:
|
||||
paths:
|
||||
- "packages/bun-types/**"
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: type-tests
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/bun-types
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: canary
|
||||
|
||||
- name: Install node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
bun install
|
||||
|
||||
- name: Generate package
|
||||
run: bun run build
|
||||
|
||||
- name: Tests
|
||||
run: bun run test
|
||||
501
.github/workflows/bun-windows.yml
vendored
501
.github/workflows/bun-windows.yml
vendored
@@ -1,501 +0,0 @@
|
||||
name: bun-windows
|
||||
|
||||
concurrency:
|
||||
group: bun-windows-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# note: in other files, this version is only the major version, but for windows it is the full version
|
||||
LLVM_VERSION: 16.0.6
|
||||
BUN_DOWNLOAD_URL_BASE: https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/latest
|
||||
|
||||
tag: bun-windows
|
||||
# TODO: wire this up to workflow_dispatch.
|
||||
# github's expression syntax makes this hard to set a default to true
|
||||
canary: true
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "test/**/*"
|
||||
- "packages/bun-usockets/src/**/*"
|
||||
- "packages/bun-uws/src/**/*"
|
||||
- "CMakeLists.txt"
|
||||
- "build.zig"
|
||||
- "Makefile"
|
||||
- "Dockerfile"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
# inputs:
|
||||
# is-canary:
|
||||
# type: boolean
|
||||
# description: Is Canary Build?
|
||||
# default: true
|
||||
|
||||
jobs:
|
||||
windows-zig:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cpu: [haswell, nehalem]
|
||||
arch: [x86_64]
|
||||
name: Zig Build
|
||||
runs-on: namespace-profile-zig-build
|
||||
timeout-minutes: 60
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Calculate Canary Revision
|
||||
if: ${{ env.canary == 'true' }}
|
||||
id: canary
|
||||
run: |
|
||||
echo "canary_revision=$(GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" bash ./scripts/calculate-canary-revision.sh --raw)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Compile Zig Object
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
# This doesnt seem to work
|
||||
# cache-from: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
# cache-to: type=s3,endpoint_url=${{ secrets.CACHE_S3_ENDPOINT }},blobs_prefix=docker_blobs/,manifests_prefix=docker_manifests/,access_key_id=${{ secrets.CACHE_S3_ACCESS_KEY_ID }},secret_access_key=${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }},bucket=bun,region=auto
|
||||
build-args: |
|
||||
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
CPU_TARGET=${{ matrix.cpu }}
|
||||
TRIPLET=${{ matrix.arch }}-windows-msvc
|
||||
GIT_SHA=${{ github.sha }}
|
||||
CANARY=${{ env.canary == 'true' && steps.canary.outputs.canary_revision || '0' }}
|
||||
ZIG_OPTIMIZE=ReleaseSafe
|
||||
# TODO(@paperdave): enable ASSERTIONS=1
|
||||
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
|
||||
target: build_release_obj
|
||||
outputs: type=local,dest=${{runner.temp}}/release
|
||||
|
||||
- name: Upload Zig Object
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-zig${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: ${{runner.temp}}/release/bun-zig.o
|
||||
if-no-files-found: "error"
|
||||
|
||||
windows-dependencies:
|
||||
name: Dependencies
|
||||
runs-on: windows
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cpu: [haswell, nehalem]
|
||||
arch: [x86_64]
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Clone Submodules
|
||||
run: .\scripts\update-submodules.ps1
|
||||
- name: Hash submodule versions
|
||||
shell: pwsh
|
||||
run: |
|
||||
$data = "$(& {
|
||||
git submodule | Where-Object { $_ -notmatch 'WebKit' }
|
||||
clang --version
|
||||
rustc --version
|
||||
Get-Content -Path (Get-ChildItem -Path 'scripts/build*.ps1', 'scripts/all-dependencies.ps1', 'scripts/env.ps1' | Sort-Object -Property Name).FullName | Out-String
|
||||
echo 1
|
||||
})"
|
||||
$hash = ( -join ((New-Object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($data)) | ForEach-Object { $_.ToString("x2") } )).Substring(0, 10)
|
||||
echo "sha=${hash}" >> $env:GITHUB_OUTPUT
|
||||
id: submodule-versions
|
||||
|
||||
- name: Try fetch dependencies
|
||||
id: cache-deps-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: bun-deps
|
||||
key: bun-deps-${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-${{ steps.submodule-versions.outputs.sha }}
|
||||
|
||||
- name: Install LLVM ${{ env.LLVM_VERSION }}
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
|
||||
with:
|
||||
version: ${{ env.LLVM_VERSION }}
|
||||
|
||||
- name: Install Ninja
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
run: choco install -y ninja
|
||||
|
||||
- name: Build Dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
run: |
|
||||
.\scripts\env.ps1 ${{ matrix.cpu == 'nehalem' && '-Baseline' || '' }}
|
||||
Invoke-WebRequest -Uri "https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip" -OutFile nasm.zip
|
||||
Expand-Archive nasm.zip (mkdir -Force "nasm")
|
||||
$Nasm = (Get-ChildItem "nasm")
|
||||
$env:Path += ";${Nasm}"
|
||||
$env:BUN_DEPS_OUT_DIR = (mkdir -Force "./bun-deps")
|
||||
.\scripts\all-dependencies.ps1
|
||||
|
||||
- name: Upload Dependencies
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-deps${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: bun-deps/
|
||||
if-no-files-found: "error"
|
||||
|
||||
- name: Cache Dependencies
|
||||
if: ${{ !steps.cache-deps-restore.outputs.cache-hit }}
|
||||
id: cache-deps-save
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: bun-deps
|
||||
key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }}
|
||||
|
||||
# TODO(@paperdave): stop relying on this and use bun.exe to build itself.
|
||||
# we cant do that now because there isn't a tagged release to use.
|
||||
#
|
||||
# and at the time of writing, the minimum canary required to work is not
|
||||
# yet released as it is the one *this* commit.
|
||||
windows-codegen:
|
||||
name: Codegen
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [x86_64]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: |
|
||||
curl -fsSL $BUN_DOWNLOAD_URL_BASE/bun-linux-x64.zip > bun.zip
|
||||
unzip bun.zip
|
||||
export PATH="$PWD/bun-linux-x64:$PATH"
|
||||
./scripts/cross-compile-codegen.sh win32 x64
|
||||
# Sort of a hack to do this step in the codegen stage
|
||||
- name: Calculate Canary Revision
|
||||
if: ${{ env.canary == 'true' }}
|
||||
run: |
|
||||
echo "canary_revision=$(GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" bash ./scripts/calculate-canary-revision.sh --raw)" > build-codegen-win32-x64/.canary_revision
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-codegen
|
||||
path: build-codegen-win32-x64/
|
||||
if-no-files-found: "error"
|
||||
|
||||
windows-cpp:
|
||||
name: C++ Build
|
||||
needs: [windows-codegen]
|
||||
runs-on: windows
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cpu: [haswell, nehalem]
|
||||
arch: [x86_64]
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- uses: actions/checkout@v4
|
||||
- uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
|
||||
with:
|
||||
version: ${{ env.LLVM_VERSION }}
|
||||
- run: choco install -y ninja
|
||||
- name: Download Codegen
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-codegen
|
||||
path: build
|
||||
- name: Build C++
|
||||
run: |
|
||||
# Using SCCache was blocked by an issue that is fixed in a newer version.
|
||||
# TODO UPDATE
|
||||
# $sczip = "sccache-v0.6.0-x86_64-pc-windows-msvc"
|
||||
|
||||
# Invoke-WebRequest -Uri "https://github.com/mozilla/sccache/releases/download/v0.6.0/${sczip}.zip" -OutFile "${sczip}.zip"
|
||||
# Expand-Archive "${sczip}.zip"
|
||||
# $env:SCCACHE_BUCKET="bun"
|
||||
# $env:SCCACHE_REGION="auto"
|
||||
# $env:SCCACHE_S3_USE_SSL="true"
|
||||
# $env:SCCACHE_ENDPOINT="${{ secrets.CACHE_S3_ENDPOINT }}"
|
||||
# $env:AWS_ACCESS_KEY_ID="${{ secrets.CACHE_S3_ACCESS_KEY_ID }}"
|
||||
# $env:AWS_SECRET_ACCESS_KEY="${{ secrets.CACHE_S3_SECRET_ACCESS_KEY }}"
|
||||
# $SCCACHE="$PWD/${sczip}/${sczip}/sccache.exe"
|
||||
|
||||
$CANARY_REVISION = if (Test-Path build/.canary_revision) { Get-Content build/.canary_revision } else { "0" }
|
||||
|
||||
.\scripts\env.ps1 ${{ matrix.cpu == 'nehalem' && '-Baseline' || '' }}
|
||||
.\scripts\update-submodules.ps1
|
||||
.\scripts\build-libuv.ps1 -CloneOnly $True
|
||||
cd build
|
||||
# "-DCCACHE_PROGRAM=${SCCACHE}"
|
||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release `
|
||||
-DNO_CODEGEN=1 `
|
||||
-DNO_CONFIGURE_DEPENDS=1 `
|
||||
"-DCANARY=${CANARY_REVISION}" `
|
||||
-DBUN_CPP_ONLY=1 ${{ matrix.cpu == 'nehalem' && '-DUSE_BASELINE_BUILD=1' || '' }}
|
||||
if ($LASTEXITCODE -ne 0) { throw "CMake configuration failed" }
|
||||
.\compile-cpp-only.ps1 -v
|
||||
if ($LASTEXITCODE -ne 0) { throw "C++ compilation failed" }
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-cpp${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: build/bun-cpp-objects.a
|
||||
if-no-files-found: "error"
|
||||
|
||||
windows-link:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cpu: [haswell, nehalem]
|
||||
arch: [x86_64]
|
||||
name: Link
|
||||
needs: [windows-dependencies, windows-codegen, windows-cpp, windows-zig]
|
||||
runs-on: windows-small
|
||||
if: github.repository_owner == 'oven-sh'
|
||||
timeout-minutes: 30
|
||||
permissions: write-all
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- uses: actions/checkout@v4
|
||||
- uses: KyleMayes/install-llvm-action@1a3da29f56261a1e1f937ec88f0856a9b8321d7e
|
||||
with:
|
||||
version: ${{ env.LLVM_VERSION }}
|
||||
- run: choco install -y ninja
|
||||
- name: Download Codegen
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-codegen
|
||||
path: build
|
||||
- name: Download Dependencies
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-deps${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: bun-deps
|
||||
- name: Download Zig Object
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-zig${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: bun-zig
|
||||
- name: Download C++ Objects
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}-cpp${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: bun-cpp
|
||||
- name: Link
|
||||
run: |
|
||||
.\scripts\update-submodules.ps1
|
||||
.\scripts\env.ps1 ${{ matrix.cpu == 'nehalem' && '-Baseline' || '' }}
|
||||
Set-Location build
|
||||
$CANARY_REVISION = if (Test-Path build/.canary_revision) { Get-Content build/.canary_revision } else { "0" }
|
||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release `
|
||||
-DNO_CODEGEN=1 `
|
||||
-DNO_CONFIGURE_DEPENDS=1 `
|
||||
"-DCANARY=${CANARY_REVISION}" `
|
||||
-DBUN_LINK_ONLY=1 `
|
||||
"-DBUN_DEPS_OUT_DIR=$(Resolve-Path ../bun-deps)" `
|
||||
"-DBUN_CPP_ARCHIVE=$(Resolve-Path ../bun-cpp/bun-cpp-objects.a)" `
|
||||
"-DBUN_ZIG_OBJ=$(Resolve-Path ../bun-zig/bun-zig.o)" `
|
||||
${{ matrix.cpu == 'nehalem' && '-DUSE_BASELINE_BUILD=1' || '' }}
|
||||
if ($LASTEXITCODE -ne 0) { throw "CMake configuration failed" }
|
||||
ninja -v
|
||||
if ($LASTEXITCODE -ne 0) { throw "Link failed!" }
|
||||
- name: Package
|
||||
run: |
|
||||
$Dist = mkdir -Force "${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}"
|
||||
cp -r build\bun.exe "$Dist\bun.exe"
|
||||
Compress-Archive "$Dist" "${Dist}.zip"
|
||||
$Dist = "$Dist-profile"
|
||||
MkDir -Force "$Dist"
|
||||
cp -r build\bun.exe "$Dist\bun.exe"
|
||||
cp -r build\bun.pdb "$Dist\bun.pdb"
|
||||
Compress-Archive "$Dist" "$Dist.zip"
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}
|
||||
path: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}.zip
|
||||
if-no-files-found: "error"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile
|
||||
path: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile.zip
|
||||
if-no-files-found: "error"
|
||||
- name: Release
|
||||
id: release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: |
|
||||
github.repository_owner == 'oven-sh'
|
||||
&& github.ref == 'refs/heads/main'
|
||||
with:
|
||||
prerelease: true
|
||||
body: "This canary release of Bun corresponds to the commit [${{ github.sha }}]"
|
||||
allowUpdates: true
|
||||
replacesArtifacts: true
|
||||
generateReleaseNotes: true
|
||||
artifactErrorsFailBuild: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: "Canary (${{github.sha}})"
|
||||
tag: "canary"
|
||||
artifacts: "${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}.zip,${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile.zip"
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: failure() && github.repository_owner == 'oven-sh' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: ${{ job.status }}
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
### [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}
|
||||
|
||||
Build failed on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }}
|
||||
|
||||
**[Build Output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})** | [Commit](https://github.com/oven-sh/bun/commits/${{github.sha}})
|
||||
windows-test:
|
||||
name: Test
|
||||
runs-on: windows-small
|
||||
needs: [windows-link]
|
||||
if: github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'
|
||||
permissions:
|
||||
pull-requests: write
|
||||
timeout-minutes: 180
|
||||
outputs:
|
||||
failing_tests: ${{ steps.test.outputs.failing_tests }}
|
||||
failing_tests_count: ${{ steps.test.outputs.failing_tests_count }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# TODO: test baseline, disabled due to noise
|
||||
cpu: [haswell]
|
||||
arch: [x86_64]
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false && git config --global core.eol lf
|
||||
- id: checkout
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: false
|
||||
- id: download
|
||||
name: Download Release
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ env.tag }}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile
|
||||
path: ${{runner.temp}}/release
|
||||
- name: Install Bun
|
||||
run: |
|
||||
cd ${{runner.temp}}/release
|
||||
unzip ${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile.zip
|
||||
cd ${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile
|
||||
pwd >> $env:GITHUB_PATH
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- uses: secondlife/setup-cygwin@v1
|
||||
with:
|
||||
packages: bash
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
# bun install --verbose
|
||||
# bun install --cwd=test --verbose
|
||||
# bun install --cwd=packages/bun-internal-test --verbose
|
||||
|
||||
npm install
|
||||
cd test && npm install
|
||||
cd ../packages/bun-internal-test && npm install
|
||||
cd ../..
|
||||
- id: test
|
||||
name: Run tests
|
||||
env:
|
||||
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
|
||||
TMPDIR: ${{runner.temp}}
|
||||
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
SHELLOPTS: igncr
|
||||
BUN_PATH_BASE: ${{runner.temp}}
|
||||
BUN_PATH: release/${{env.tag}}-${{ matrix.arch == 'x86_64' && 'x64' || 'aarch64' }}${{ matrix.cpu == 'nehalem' && '-baseline' || '' }}-profile/bun.exe
|
||||
run: |
|
||||
node packages/bun-internal-test/src/runner.node.mjs || true
|
||||
shell: bash
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.failing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK_WINTEST }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
### ❌🪟 [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are **${{ steps.test.outputs.failing_test_count }} failing tests** on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }}
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
[Full Test Output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})
|
||||
- uses: sarisia/actions-status-discord@v1
|
||||
if: always() && steps.test.outputs.regressing_tests != '' && github.event_name == 'pull_request'
|
||||
with:
|
||||
title: ""
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
status: "failure"
|
||||
noprefix: true
|
||||
nocontext: true
|
||||
description: |
|
||||
### ❌🪟 [${{github.event.pull_request.title}}](https://github.com/oven-sh/bun/pull/${{github.event.number}})
|
||||
|
||||
@${{ github.actor }}, there are **${{ steps.test.outputs.regressing_test_count }} test regressions** on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }}
|
||||
|
||||
${{ steps.test.outputs.regressing_tests }}
|
||||
|
||||
[Full Test Output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})
|
||||
- name: Comment on PR
|
||||
if: always() && steps.test.outputs.regressing_tests != '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-windows-${{ matrix.arch }}-${{ matrix.cpu }}
|
||||
message: |
|
||||
### ❌🪟 @${{ github.actor }}, there are **${{ steps.test.outputs.regressing_test_count }} test regressions** on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }}
|
||||
|
||||
${{ steps.test.outputs.regressing_tests }}
|
||||
|
||||
[Full Test Output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})
|
||||
- name: Uncomment on PR
|
||||
if: steps.test.outputs.regressing_tests == '' && github.event_name == 'pull_request'
|
||||
uses: thollander/actions-comment-pull-request@v2
|
||||
with:
|
||||
comment_tag: test-windows-${{ matrix.arch }}-${{ matrix.cpu }}
|
||||
mode: upsert
|
||||
create_if_not_exists: false
|
||||
message: |
|
||||
✅🪟 Test regressions on Windows ${{ matrix.arch }}${{ matrix.cpu == 'nehalem' && ' Baseline' || '' }} have been resolved.
|
||||
- id: fail
|
||||
name: Fail the build
|
||||
if: steps.test.outputs.regressing_tests != '' && github.event_name == 'pull_request'
|
||||
run: exit 1
|
||||
242
.github/workflows/ci.yml
vendored
Normal file
242
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
name: CI
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.run-id || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run-id:
|
||||
type: string
|
||||
description: The workflow ID to download artifacts (skips the build step)
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- .vscode/**/*
|
||||
- docs/**/*
|
||||
- examples/**/*
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- .vscode/**/*
|
||||
- docs/**/*
|
||||
- examples/**/*
|
||||
|
||||
jobs:
|
||||
format:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Format
|
||||
uses: ./.github/workflows/run-format.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
zig-version: 0.12.0-dev.1828+225fe6ddb
|
||||
permissions:
|
||||
contents: write
|
||||
lint:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Lint
|
||||
uses: ./.github/workflows/run-lint.yml
|
||||
secrets: inherit
|
||||
linux-x64:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Build linux-x64
|
||||
uses: ./.github/workflows/build-linux.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
|
||||
tag: linux-x64
|
||||
arch: x64
|
||||
cpu: haswell
|
||||
canary: true
|
||||
linux-x64-baseline:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Build linux-x64-baseline
|
||||
uses: ./.github/workflows/build-linux.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
|
||||
tag: linux-x64-baseline
|
||||
arch: x64
|
||||
cpu: nehalem
|
||||
canary: true
|
||||
linux-aarch64:
|
||||
if: ${{ !inputs.run-id && github.repository_owner == 'oven-sh' }}
|
||||
name: Build linux-aarch64
|
||||
uses: ./.github/workflows/build-linux.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: namespace-profile-bun-ci-linux-aarch64
|
||||
tag: linux-aarch64
|
||||
arch: aarch64
|
||||
cpu: native
|
||||
canary: true
|
||||
darwin-x64:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Build darwin-x64
|
||||
uses: ./.github/workflows/build-darwin.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
|
||||
tag: darwin-x64
|
||||
arch: x64
|
||||
cpu: haswell
|
||||
canary: true
|
||||
darwin-x64-baseline:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Build darwin-x64-baseline
|
||||
uses: ./.github/workflows/build-darwin.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
|
||||
tag: darwin-x64-baseline
|
||||
arch: x64
|
||||
cpu: nehalem
|
||||
canary: true
|
||||
darwin-aarch64:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Build darwin-aarch64
|
||||
uses: ./.github/workflows/build-darwin.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-darwin-aarch64' || 'macos-12' }}
|
||||
tag: darwin-aarch64
|
||||
arch: aarch64
|
||||
cpu: native
|
||||
canary: true
|
||||
windows-x64:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Build windows-x64
|
||||
uses: ./.github/workflows/build-windows.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: windows
|
||||
tag: windows-x64
|
||||
arch: x64
|
||||
cpu: haswell
|
||||
canary: true
|
||||
windows-x64-baseline:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Build windows-x64-baseline
|
||||
uses: ./.github/workflows/build-windows.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: windows
|
||||
tag: windows-x64-baseline
|
||||
arch: x64
|
||||
cpu: nehalem
|
||||
canary: true
|
||||
linux-x64-test:
|
||||
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
|
||||
name: Test linux-x64
|
||||
needs: linux-x64
|
||||
uses: ./.github/workflows/run-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
run-id: ${{ inputs.run-id }}
|
||||
pr-number: ${{ github.event.number }}
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
|
||||
tag: linux-x64
|
||||
linux-x64-baseline-test:
|
||||
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
|
||||
name: Test linux-x64-baseline
|
||||
needs: linux-x64-baseline
|
||||
uses: ./.github/workflows/run-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
run-id: ${{ inputs.run-id }}
|
||||
pr-number: ${{ github.event.number }}
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
|
||||
tag: linux-x64-baseline
|
||||
linux-aarch64-test:
|
||||
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'}}
|
||||
name: Test linux-aarch64
|
||||
needs: linux-aarch64
|
||||
uses: ./.github/workflows/run-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
run-id: ${{ inputs.run-id }}
|
||||
pr-number: ${{ github.event.number }}
|
||||
runs-on: namespace-profile-bun-ci-linux-aarch64
|
||||
tag: linux-aarch64
|
||||
darwin-x64-test:
|
||||
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
|
||||
name: Test darwin-x64
|
||||
needs: darwin-x64
|
||||
uses: ./.github/workflows/run-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
run-id: ${{ inputs.run-id }}
|
||||
pr-number: ${{ github.event.number }}
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
|
||||
tag: darwin-x64
|
||||
darwin-x64-baseline-test:
|
||||
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
|
||||
name: Test darwin-x64-baseline
|
||||
needs: darwin-x64-baseline
|
||||
uses: ./.github/workflows/run-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
run-id: ${{ inputs.run-id }}
|
||||
pr-number: ${{ github.event.number }}
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
|
||||
tag: darwin-x64-baseline
|
||||
darwin-aarch64-test:
|
||||
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
|
||||
name: Test darwin-aarch64
|
||||
needs: darwin-aarch64
|
||||
uses: ./.github/workflows/run-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
run-id: ${{ inputs.run-id }}
|
||||
pr-number: ${{ github.event.number }}
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-darwin-aarch64' || 'macos-12' }}
|
||||
tag: darwin-aarch64
|
||||
windows-x64-test:
|
||||
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
|
||||
name: Test windows-x64
|
||||
needs: windows-x64
|
||||
uses: ./.github/workflows/run-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
run-id: ${{ inputs.run-id }}
|
||||
pr-number: ${{ github.event.number }}
|
||||
runs-on: windows
|
||||
tag: windows-x64
|
||||
windows-x64-baseline-test:
|
||||
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
|
||||
name: Test windows-x64-baseline
|
||||
needs: windows-x64-baseline
|
||||
uses: ./.github/workflows/run-test.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
run-id: ${{ inputs.run-id }}
|
||||
pr-number: ${{ github.event.number }}
|
||||
runs-on: windows
|
||||
tag: windows-x64-baseline
|
||||
cleanup:
|
||||
if: ${{ always() }}
|
||||
name: Cleanup
|
||||
needs:
|
||||
- linux-x64
|
||||
- linux-x64-baseline
|
||||
- linux-aarch64
|
||||
- darwin-x64
|
||||
- darwin-x64-baseline
|
||||
- darwin-aarch64
|
||||
- windows-x64
|
||||
- windows-x64-baseline
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cleanup Artifacts
|
||||
uses: geekyeggo/delete-artifact@v5
|
||||
with:
|
||||
name: |
|
||||
bun-*-cpp
|
||||
bun-*-zig
|
||||
bun-*-deps
|
||||
bun-*-codegen
|
||||
55
.github/workflows/comment.yml
vendored
Normal file
55
.github/workflows/comment.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
name: Comment
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- CI
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
comment:
|
||||
if: ${{ github.repository_owner == 'oven-sh' }}
|
||||
name: Comment
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download Tests
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: bun
|
||||
pattern: bun-*-tests
|
||||
github-token: ${{ github.token }}
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
- name: Setup Environment
|
||||
id: env
|
||||
shell: bash
|
||||
run: |
|
||||
echo "pr-number=$(<bun/bun-linux-x64-tests/pr-number.txt)" >> $GITHUB_OUTPUT
|
||||
- name: Generate Comment
|
||||
run: |
|
||||
cat bun/bun-*-tests/comment.md > comment.md
|
||||
if [ -s comment.md ]; then
|
||||
echo -e "❌ @${{ github.actor }}, your commit has failing tests :(\n\n$(cat comment.md)" > comment.md
|
||||
else
|
||||
echo -e "✅ @${{ github.actor }}, all tests passed!" > comment.md
|
||||
fi
|
||||
echo -e "\n**[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }})**" >> comment.md
|
||||
echo -e "<!-- generated-comment workflow=${{ github.workflow }} -->" >> comment.md
|
||||
- name: Find Comment
|
||||
id: comment
|
||||
uses: peter-evans/find-comment@v3
|
||||
with:
|
||||
issue-number: ${{ steps.env.outputs.pr-number }}
|
||||
comment-author: github-actions[bot]
|
||||
body-includes: <!-- generated-comment workflow=${{ github.workflow }} -->
|
||||
- name: Write Comment
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
with:
|
||||
comment-id: ${{ steps.comment.outputs.comment-id }}
|
||||
issue-number: ${{ steps.env.outputs.pr-number }}
|
||||
body-path: comment.md
|
||||
edit-mode: replace
|
||||
183
.github/workflows/create-release-build.yml
vendored
Normal file
183
.github/workflows/create-release-build.yml
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
name: Create Release Build
|
||||
run-name: Compile Bun v${{ inputs.version }} by ${{ github.actor }}
|
||||
|
||||
concurrency:
|
||||
group: release
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
type: string
|
||||
required: true
|
||||
description: "Release version. Example: 1.1.4. Exclude the 'v' prefix."
|
||||
tag:
|
||||
type: string
|
||||
required: true
|
||||
description: "GitHub tag to use"
|
||||
clobber:
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
description: "Overwrite existing release artifacts?"
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
|
||||
jobs:
|
||||
notify-start:
|
||||
if: ${{ github.repository_owner == 'oven-sh' }}
|
||||
name: Notify Start
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send Message
|
||||
uses: sarisia/actions-status-discord@v1
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK_PUBLIC }}
|
||||
nodetail: true
|
||||
color: "#1F6FEB"
|
||||
title: "Bun v${{ inputs.version }} is compiling"
|
||||
description: |
|
||||
### @${{ github.actor }} started compiling Bun v${{inputs.version}}
|
||||
- name: Send Message
|
||||
uses: sarisia/actions-status-discord@v1
|
||||
with:
|
||||
webhook: ${{ secrets.BUN_DISCORD_GITHUB_CHANNEL_WEBHOOK }}
|
||||
nodetail: true
|
||||
color: "#1F6FEB"
|
||||
title: "Bun v${{ inputs.version }} is compiling"
|
||||
description: |
|
||||
### @${{ github.actor }} started compiling Bun v${{inputs.version}}
|
||||
|
||||
**[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})**
|
||||
linux-x64:
|
||||
name: Build linux-x64
|
||||
uses: ./.github/workflows/build-linux.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
|
||||
tag: linux-x64
|
||||
arch: x64
|
||||
cpu: haswell
|
||||
canary: false
|
||||
linux-x64-baseline:
|
||||
name: Build linux-x64-baseline
|
||||
uses: ./.github/workflows/build-linux.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
|
||||
tag: linux-x64-baseline
|
||||
arch: x64
|
||||
cpu: nehalem
|
||||
canary: false
|
||||
linux-aarch64:
|
||||
name: Build linux-aarch64
|
||||
uses: ./.github/workflows/build-linux.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: namespace-profile-bun-ci-linux-aarch64
|
||||
tag: linux-aarch64
|
||||
arch: aarch64
|
||||
cpu: native
|
||||
canary: false
|
||||
darwin-x64:
|
||||
name: Build darwin-x64
|
||||
uses: ./.github/workflows/build-darwin.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
|
||||
tag: darwin-x64
|
||||
arch: x64
|
||||
cpu: haswell
|
||||
canary: false
|
||||
darwin-x64-baseline:
|
||||
name: Build darwin-x64-baseline
|
||||
uses: ./.github/workflows/build-darwin.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }}
|
||||
tag: darwin-x64-baseline
|
||||
arch: x64
|
||||
cpu: nehalem
|
||||
canary: false
|
||||
darwin-aarch64:
|
||||
name: Build darwin-aarch64
|
||||
uses: ./.github/workflows/build-darwin.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-darwin-aarch64' || 'macos-12' }}
|
||||
tag: darwin-aarch64
|
||||
arch: aarch64
|
||||
cpu: native
|
||||
canary: false
|
||||
windows-x64:
|
||||
name: Build windows-x64
|
||||
uses: ./.github/workflows/build-windows.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: windows
|
||||
tag: windows-x64
|
||||
arch: x64
|
||||
cpu: haswell
|
||||
canary: false
|
||||
windows-x64-baseline:
|
||||
name: Build windows-x64-baseline
|
||||
uses: ./.github/workflows/build-windows.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
runs-on: windows
|
||||
tag: windows-x64-baseline
|
||||
arch: x64
|
||||
cpu: nehalem
|
||||
canary: false
|
||||
|
||||
upload-artifacts:
|
||||
needs:
|
||||
- linux-x64
|
||||
- linux-x64-baseline
|
||||
- linux-aarch64
|
||||
- darwin-x64
|
||||
- darwin-x64-baseline
|
||||
- darwin-aarch64
|
||||
- windows-x64
|
||||
- windows-x64-baseline
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: bun-releases
|
||||
pattern: bun-*
|
||||
merge-multiple: true
|
||||
github-token: ${{ github.token }}
|
||||
- name: Check for Artifacts
|
||||
run: |
|
||||
if [ ! -d "bun-releases" ] || [ -z "$(ls -A bun-releases)" ]; then
|
||||
echo "Error: No artifacts were downloaded or 'bun-releases' directory does not exist."
|
||||
exit 1 # Fail the job if the condition is met
|
||||
else
|
||||
echo "Artifacts downloaded successfully."
|
||||
fi
|
||||
- name: Send Message
|
||||
uses: sarisia/actions-status-discord@v1
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
nodetail: true
|
||||
color: "#FF0000"
|
||||
title: "Bun v${{ inputs.version }} release artifacts uploaded"
|
||||
- name: "Upload Artifacts"
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
# Unzip one level deep each artifact
|
||||
cd bun-releases
|
||||
for f in *.zip; do
|
||||
unzip -o $f
|
||||
done
|
||||
cd ..
|
||||
gh release upload ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.event.release.id }} ${{ inputs.clobber && '--clobber' || '' }} bun-releases/*.zip
|
||||
20
.github/workflows/docs.yml
vendored
Normal file
20
.github/workflows/docs.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "docs/**"
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'oven-sh' }}
|
||||
steps:
|
||||
# redeploy Vercel site when a file in `docs` changes
|
||||
# using VERCEL_DEPLOY_HOOK environment variable
|
||||
- name: Trigger Webhook
|
||||
run: |
|
||||
curl -v ${{ secrets.VERCEL_DEPLOY_HOOK }}
|
||||
@@ -1,8 +1,10 @@
|
||||
name: bun-release
|
||||
name: Release
|
||||
concurrency: release
|
||||
|
||||
env:
|
||||
BUN_VERSION: ${{ github.event.inputs.tag || github.event.release.tag_name || 'canary' }}
|
||||
BUN_LATEST: ${{ (github.event.inputs.is-latest || github.event.release.tag_name) && 'true' || 'false' }}
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
@@ -39,6 +41,7 @@ on:
|
||||
description: Should types be released to npm?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
sign:
|
||||
name: Sign Release
|
||||
@@ -58,7 +61,7 @@ jobs:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: "1.0.21"
|
||||
- name: Install Dependencies
|
||||
@@ -83,7 +86,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: "1.0.21"
|
||||
- name: Install Dependencies
|
||||
@@ -112,12 +115,12 @@ jobs:
|
||||
node-version: latest
|
||||
- name: Setup Bun
|
||||
if: ${{ env.BUN_VERSION != 'canary' }}
|
||||
uses: oven-sh/setup-bun@v1
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: "1.0.21"
|
||||
- name: Setup Bun
|
||||
if: ${{ env.BUN_VERSION == 'canary' }}
|
||||
uses: oven-sh/setup-bun@v1
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: "canary" # Must be 'canary' so tag is correct
|
||||
- name: Install Dependencies
|
||||
@@ -254,7 +257,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: "1.0.21"
|
||||
- name: Install Dependencies
|
||||
@@ -1,22 +1,19 @@
|
||||
name: autofix.ci # Must be named this for autofix.ci to work
|
||||
name: Format
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
ZIG_VERSION: 0.12.0-dev.1828+225fe6ddb
|
||||
workflow_call:
|
||||
inputs:
|
||||
zig-version:
|
||||
type: string
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: format
|
||||
runs-on: ${{ vars.RUNNER_LINUX_X64 || 'ubuntu-latest' }}
|
||||
name: Format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -34,13 +31,17 @@ jobs:
|
||||
- name: Setup Zig
|
||||
uses: goto-bus-stop/setup-zig@c7b6cdd3adba8f8b96984640ff172c37c93f73ee
|
||||
with:
|
||||
version: ${{ env.ZIG_VERSION }}
|
||||
version: ${{ inputs.zig-version }}
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
bun install
|
||||
- name: Format
|
||||
run: |
|
||||
bun fmt
|
||||
- name: Format Zig
|
||||
run: |
|
||||
bun fmt:zig
|
||||
- name: Commit # https://autofix.ci/
|
||||
uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: Apply formatting changes
|
||||
30
.github/workflows/run-lint.yml
vendored
Normal file
30
.github/workflows/run-lint.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Lint
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
text_output: ${{ steps.lint.outputs.text_output }}
|
||||
json_output: ${{ steps.lint.outputs.json_output }}
|
||||
count: ${{ steps.lint.outputs.count }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: "1.1.3"
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
bun --cwd=packages/bun-internal-test install
|
||||
- name: Lint
|
||||
id: lint
|
||||
run: |
|
||||
bun packages/bun-internal-test/src/linter.ts
|
||||
208
.github/workflows/run-test.yml
vendored
Normal file
208
.github/workflows/run-test.yml
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
name: Test
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
runs-on:
|
||||
type: string
|
||||
required: true
|
||||
tag:
|
||||
type: string
|
||||
required: true
|
||||
pr-number:
|
||||
type: string
|
||||
required: true
|
||||
run-id:
|
||||
type: string
|
||||
default: ${{ github.run_id }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Tests
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- if: ${{ runner.os == 'Windows' }}
|
||||
name: Setup Git
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
package.json
|
||||
bun.lockb
|
||||
test
|
||||
packages/bun-internal-test
|
||||
- name: Setup Environment
|
||||
shell: bash
|
||||
run: |
|
||||
echo "${{ inputs.pr-number }}" > pr-number.txt
|
||||
- name: Download Bun
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}
|
||||
path: bun
|
||||
github-token: ${{ github.token }}
|
||||
run-id: ${{ inputs.run-id || github.run_id }}
|
||||
- if: ${{ runner.os != 'Windows' }}
|
||||
name: Setup Bun
|
||||
shell: bash
|
||||
run: |
|
||||
unzip bun/bun-*.zip
|
||||
cd bun-*
|
||||
pwd >> $GITHUB_PATH
|
||||
- if: ${{ runner.os == 'Windows' }}
|
||||
name: Setup Cygwin
|
||||
uses: secondlife/setup-cygwin@v3
|
||||
with:
|
||||
packages: bash
|
||||
- if: ${{ runner.os == 'Windows' }}
|
||||
name: Setup Bun (Windows)
|
||||
run: |
|
||||
unzip bun/bun-*.zip
|
||||
cd bun-*
|
||||
pwd >> $env:GITHUB_PATH
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install Dependencies
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
bun install
|
||||
- name: Install Dependencies (test)
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
bun install --cwd test
|
||||
- name: Install Dependencies (runner)
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
bun install --cwd packages/bun-internal-test
|
||||
- name: Run Tests
|
||||
id: test
|
||||
timeout-minutes: 90
|
||||
shell: bash
|
||||
env:
|
||||
TMPDIR: ${{ runner.temp }}
|
||||
BUN_TAG: ${{ inputs.tag }}
|
||||
BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "true"
|
||||
SMTP_SENDGRID_SENDER: ${{ secrets.SMTP_SENDGRID_SENDER }}
|
||||
TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }}
|
||||
TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }}
|
||||
TEST_INFO_STRIPE: ${{ secrets.TEST_INFO_STRIPE }}
|
||||
SHELLOPTS: igncr
|
||||
run: |
|
||||
node packages/bun-internal-test/src/runner.node.mjs $(which bun)
|
||||
- if: ${{ always() }}
|
||||
name: Upload Results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-tests
|
||||
path: |
|
||||
test-report.*
|
||||
comment.md
|
||||
pr-number.txt
|
||||
if-no-files-found: error
|
||||
overwrite: true
|
||||
- if: ${{ always() && steps.test.outputs.failing_tests != '' && github.event.pull_request && github.repository_owner == 'oven-sh' }}
|
||||
name: Send Message
|
||||
uses: sarisia/actions-status-discord@v1
|
||||
with:
|
||||
webhook: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
nodetail: true
|
||||
color: "#FF0000"
|
||||
title: ""
|
||||
description: |
|
||||
### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})
|
||||
|
||||
@${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count || 'some' }} failing tests on bun-${{ inputs.tag }}.
|
||||
|
||||
${{ steps.test.outputs.failing_tests }}
|
||||
|
||||
**[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})**
|
||||
- name: Fail
|
||||
if: ${{ failure() || always() && steps.test.outputs.failing_tests != '' }}
|
||||
run: |
|
||||
echo "There are ${{ steps.test.outputs.failing_tests_count || 'some' }} failing tests on bun-${{ inputs.tag }}."
|
||||
exit 1
|
||||
test-node:
|
||||
name: Node.js Tests
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- if: ${{ runner.os == 'Windows' }}
|
||||
name: Setup Git
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
test/node.js
|
||||
- name: Setup Environment
|
||||
shell: bash
|
||||
run: |
|
||||
echo "${{ inputs.pr-number }}" > pr-number.txt
|
||||
- name: Download Bun
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}
|
||||
path: bun
|
||||
github-token: ${{ github.token }}
|
||||
run-id: ${{ inputs.run-id || github.run_id }}
|
||||
- if: ${{ runner.os != 'Windows' }}
|
||||
name: Setup Bun
|
||||
shell: bash
|
||||
run: |
|
||||
unzip bun/bun-*.zip
|
||||
cd bun-*
|
||||
pwd >> $GITHUB_PATH
|
||||
- if: ${{ runner.os == 'Windows' }}
|
||||
name: Setup Cygwin
|
||||
uses: secondlife/setup-cygwin@v3
|
||||
with:
|
||||
packages: bash
|
||||
- if: ${{ runner.os == 'Windows' }}
|
||||
name: Setup Bun (Windows)
|
||||
run: |
|
||||
unzip bun/bun-*.zip
|
||||
cd bun-*
|
||||
pwd >> $env:GITHUB_PATH
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Checkout Tests
|
||||
shell: bash
|
||||
working-directory: test/node.js
|
||||
run: |
|
||||
node runner.mjs --pull
|
||||
- name: Install Dependencies
|
||||
timeout-minutes: 5
|
||||
shell: bash
|
||||
working-directory: test/node.js
|
||||
run: |
|
||||
bun install
|
||||
- name: Run Tests
|
||||
timeout-minutes: 10 # Increase when more tests are added
|
||||
shell: bash
|
||||
working-directory: test/node.js
|
||||
env:
|
||||
TMPDIR: ${{ runner.temp }}
|
||||
BUN_GARBAGE_COLLECTOR_LEVEL: "0"
|
||||
BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "true"
|
||||
run: |
|
||||
node runner.mjs
|
||||
- name: Upload Results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bun-${{ inputs.tag }}-node-tests
|
||||
path: |
|
||||
test/node.js/summary/*.json
|
||||
if-no-files-found: error
|
||||
overwrite: true
|
||||
82
.github/workflows/upload.yml
vendored
Normal file
82
.github/workflows/upload.yml
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
name: Upload Artifacts
|
||||
run-name: Canary release ${{github.sha}} upload
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- CI
|
||||
types:
|
||||
- completed
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
if: ${{ github.repository_owner == 'oven-sh' }}
|
||||
name: Upload Artifacts
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: bun
|
||||
pattern: bun-*
|
||||
merge-multiple: true
|
||||
github-token: ${{ github.token }}
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
- name: Check for Artifacts
|
||||
run: |
|
||||
if [ ! -d "bun" ] || [ -z "$(ls -A bun)" ]; then
|
||||
echo "Error: No artifacts were downloaded or 'bun' directory does not exist."
|
||||
exit 1 # Fail the job if the condition is met
|
||||
else
|
||||
echo "Artifacts downloaded successfully."
|
||||
fi
|
||||
- name: Upload to GitHub Releases
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: canary
|
||||
name: Canary (${{ github.sha }})
|
||||
prerelease: true
|
||||
body: This canary release of Bun corresponds to the commit [${{ github.sha }}]
|
||||
allowUpdates: true
|
||||
replacesArtifacts: true
|
||||
generateReleaseNotes: true
|
||||
artifactErrorsFailBuild: true
|
||||
artifacts: bun/**/bun-*.zip
|
||||
token: ${{ github.token }}
|
||||
- name: Upload to S3 (using SHA)
|
||||
uses: shallwefootball/s3-upload-action@4350529f410221787ccf424e50133cbc1b52704e
|
||||
with:
|
||||
endpoint: ${{ secrets.AWS_ENDPOINT }}
|
||||
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
|
||||
aws_bucket: ${{ secrets.AWS_BUCKET }}
|
||||
source_dir: bun
|
||||
destination_dir: releases/${{ github.event.workflow_run.head_sha || github.sha }}
|
||||
- name: Upload to S3 (using tag)
|
||||
uses: shallwefootball/s3-upload-action@4350529f410221787ccf424e50133cbc1b52704e
|
||||
with:
|
||||
endpoint: ${{ secrets.AWS_ENDPOINT }}
|
||||
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
|
||||
aws_bucket: ${{ secrets.AWS_BUCKET }}
|
||||
source_dir: bun
|
||||
destination_dir: releases/canary
|
||||
- name: Announce on Discord
|
||||
uses: sarisia/actions-status-discord@v1
|
||||
with:
|
||||
webhook: ${{ secrets.BUN_DISCORD_GITHUB_CHANNEL_WEBHOOK }}
|
||||
nodetail: true
|
||||
color: "#1F6FEB"
|
||||
title: "New Bun Canary available"
|
||||
url: https://github.com/oven-sh/bun/commit/${{ github.sha }}
|
||||
description: |
|
||||
A new canary build of Bun has been automatically uploaded. To upgrade, run:
|
||||
```sh
|
||||
bun upgrade --canary
|
||||
# bun upgrade --stable <- to downgrade
|
||||
```
|
||||
312
.gitignore
vendored
312
.gitignore
vendored
@@ -1,169 +1,143 @@
|
||||
.DS_Store
|
||||
zig-cache
|
||||
packages/*/*.wasm
|
||||
*.o
|
||||
*.a
|
||||
profile.json
|
||||
|
||||
.env
|
||||
node_modules
|
||||
.envrc
|
||||
.swcrc
|
||||
yarn.lock
|
||||
dist
|
||||
*.tmp
|
||||
*.log
|
||||
*.out.js
|
||||
*.out.refresh.js
|
||||
**/package-lock.json
|
||||
build
|
||||
*.wat
|
||||
zig-out
|
||||
pnpm-lock.yaml
|
||||
README.md.template
|
||||
src/deps/zig-clap/example
|
||||
src/deps/zig-clap/README.md
|
||||
src/deps/zig-clap/.github
|
||||
src/deps/zig-clap/.gitattributes
|
||||
out
|
||||
outdir
|
||||
|
||||
.trace
|
||||
cover
|
||||
coverage
|
||||
coverv
|
||||
*.trace
|
||||
github
|
||||
out.*
|
||||
out
|
||||
.parcel-cache
|
||||
esbuilddir
|
||||
*.bun
|
||||
parceldist
|
||||
esbuilddir
|
||||
outdir/
|
||||
outcss
|
||||
.next
|
||||
txt.js
|
||||
.idea
|
||||
.vscode/cpp*
|
||||
.vscode/clang*
|
||||
|
||||
node_modules_*
|
||||
*.jsb
|
||||
*.zip
|
||||
bun-zigld
|
||||
bun-singlehtreaded
|
||||
bun-nomimalloc
|
||||
bun-mimalloc
|
||||
examples/lotta-modules/bun-yday
|
||||
examples/lotta-modules/bun-old
|
||||
examples/lotta-modules/bun-nofscache
|
||||
|
||||
src/node-fallbacks/out/*
|
||||
src/node-fallbacks/node_modules
|
||||
sign.json
|
||||
release/
|
||||
*.dmg
|
||||
sign.*.json
|
||||
packages/debug-*
|
||||
packages/bun-cli/postinstall.js
|
||||
packages/bun-*/bun
|
||||
packages/bun-*/bun-profile
|
||||
packages/bun-*/debug-bun
|
||||
packages/bun-*/*.o
|
||||
packages/bun-cli/postinstall.js
|
||||
|
||||
packages/bun-cli/bin/*
|
||||
bun-test-scratch
|
||||
misctools/fetch
|
||||
|
||||
src/deps/libiconv
|
||||
src/deps/openssl
|
||||
src/tests.zig
|
||||
*.blob
|
||||
src/deps/s2n-tls
|
||||
.npm
|
||||
.npm.gz
|
||||
|
||||
bun-binary
|
||||
|
||||
src/deps/PLCrashReporter/
|
||||
|
||||
*.dSYM
|
||||
*.crash
|
||||
misctools/sha
|
||||
packages/bun-wasm/*.mjs
|
||||
packages/bun-wasm/*.cjs
|
||||
packages/bun-wasm/*.map
|
||||
packages/bun-wasm/*.js
|
||||
packages/bun-wasm/*.d.ts
|
||||
packages/bun-wasm/*.d.cts
|
||||
packages/bun-wasm/*.d.mts
|
||||
*.bc
|
||||
|
||||
src/fallback.version
|
||||
src/runtime.version
|
||||
*.sqlite
|
||||
*.database
|
||||
*.db
|
||||
misctools/machbench
|
||||
*.big
|
||||
.eslintcache
|
||||
|
||||
/bun-webkit
|
||||
|
||||
src/deps/c-ares/build
|
||||
src/bun.js/bindings-obj
|
||||
src/bun.js/debug-bindings-obj
|
||||
|
||||
failing-tests.txt
|
||||
test.txt
|
||||
myscript.sh
|
||||
|
||||
cold-jsc-start
|
||||
cold-jsc-start.d
|
||||
|
||||
/testdir
|
||||
/test.ts
|
||||
/test.js
|
||||
|
||||
src/js/out/modules*
|
||||
src/js/out/functions*
|
||||
src/js/out/tmp
|
||||
src/js/out/DebugPath.h
|
||||
|
||||
make-dev-stats.csv
|
||||
|
||||
.uuid
|
||||
tsconfig.tsbuildinfo
|
||||
|
||||
test/js/bun/glob/fixtures
|
||||
*.lib
|
||||
*.pdb
|
||||
CMakeFiles
|
||||
build.ninja
|
||||
.ninja_deps
|
||||
.ninja_log
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
compile_commands.json
|
||||
|
||||
*.lib
|
||||
x64
|
||||
**/*.vcxproj*
|
||||
**/*.sln*
|
||||
**/*.dir
|
||||
**/*.pdb
|
||||
|
||||
/.webkit-cache
|
||||
/.cache
|
||||
/src/deps/libuv
|
||||
/build-*/
|
||||
/kcov-out
|
||||
|
||||
.vs
|
||||
|
||||
**/.verdaccio-db.json
|
||||
/test-report.md
|
||||
/test-report.json
|
||||
.DS_Store
|
||||
.env
|
||||
.envrc
|
||||
.eslintcache
|
||||
.idea
|
||||
.next
|
||||
.ninja_deps
|
||||
.ninja_log
|
||||
.npm
|
||||
.npm.gz
|
||||
.parcel-cache
|
||||
.swcrc
|
||||
.trace
|
||||
.uuid
|
||||
.vs
|
||||
.vscode/clang*
|
||||
.vscode/cpp*
|
||||
*.a
|
||||
*.bc
|
||||
*.big
|
||||
*.blob
|
||||
*.bun
|
||||
*.crash
|
||||
*.database
|
||||
*.db
|
||||
*.dmg
|
||||
*.dSYM
|
||||
*.jsb
|
||||
*.lib
|
||||
*.log
|
||||
*.o
|
||||
*.out.js
|
||||
*.out.refresh.js
|
||||
*.pdb
|
||||
*.sqlite
|
||||
*.tmp
|
||||
*.trace
|
||||
*.wat
|
||||
*.zip
|
||||
**/.verdaccio-db.json
|
||||
**/*.dir
|
||||
**/*.pdb
|
||||
**/*.sln*
|
||||
**/*.vcxproj*
|
||||
**/package-lock.json
|
||||
/.cache
|
||||
/.webkit-cache
|
||||
/build-*/
|
||||
/bun-webkit
|
||||
/kcov-out
|
||||
/src/deps/libuv
|
||||
/test-report.json
|
||||
/test-report.md
|
||||
/test.js
|
||||
/test.ts
|
||||
/testdir
|
||||
build
|
||||
build.ninja
|
||||
bun-binary
|
||||
bun-mimalloc
|
||||
bun-nomimalloc
|
||||
bun-singlehtreaded
|
||||
bun-test-scratch
|
||||
bun-zigld
|
||||
cmake_install.cmake
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
cold-jsc-start
|
||||
cold-jsc-start.d
|
||||
compile_commands.json
|
||||
cover
|
||||
coverage
|
||||
coverv
|
||||
dist
|
||||
esbuilddir
|
||||
examples/lotta-modules/bun-nofscache
|
||||
examples/lotta-modules/bun-old
|
||||
examples/lotta-modules/bun-yday
|
||||
failing-tests.txt
|
||||
github
|
||||
make-dev-stats.csv
|
||||
misctools/fetch
|
||||
misctools/machbench
|
||||
misctools/sha
|
||||
myscript.sh
|
||||
node_modules
|
||||
node_modules_*
|
||||
out
|
||||
out.*
|
||||
outcss
|
||||
outdir
|
||||
outdir/
|
||||
packages/*/*.wasm
|
||||
packages/bun-*/*.o
|
||||
packages/bun-*/bun
|
||||
packages/bun-*/bun-profile
|
||||
packages/bun-*/debug-bun
|
||||
packages/bun-cli/bin/*
|
||||
packages/bun-cli/postinstall.js
|
||||
packages/bun-wasm/*.cjs
|
||||
packages/bun-wasm/*.d.cts
|
||||
packages/bun-wasm/*.d.mts
|
||||
packages/bun-wasm/*.d.ts
|
||||
packages/bun-wasm/*.js
|
||||
packages/bun-wasm/*.map
|
||||
packages/bun-wasm/*.mjs
|
||||
packages/debug-*
|
||||
parceldist
|
||||
pnpm-lock.yaml
|
||||
profile.json
|
||||
README.md.template
|
||||
release/
|
||||
sign.*.json
|
||||
sign.json
|
||||
src/bun.js/bindings-obj
|
||||
src/bun.js/bindings/GeneratedJS2Native.zig
|
||||
src/bun.js/debug-bindings-obj
|
||||
src/deps/c-ares/build
|
||||
src/deps/libiconv
|
||||
src/deps/openssl
|
||||
src/deps/PLCrashReporter/
|
||||
src/deps/s2n-tls
|
||||
src/deps/zig-clap/.gitattributes
|
||||
src/deps/zig-clap/.github
|
||||
src/deps/zig-clap/example
|
||||
src/deps/zig-clap/README.md
|
||||
src/fallback.version
|
||||
src/js/out/DebugPath.h
|
||||
src/js/out/functions*
|
||||
src/js/out/modules*
|
||||
src/js/out/tmp
|
||||
src/node-fallbacks/node_modules
|
||||
src/node-fallbacks/out/*
|
||||
src/runtime.version
|
||||
src/tests.zig
|
||||
test.txt
|
||||
test/js/bun/glob/fixtures
|
||||
tsconfig.tsbuildinfo
|
||||
txt.js
|
||||
x64
|
||||
yarn.lock
|
||||
zig-cache
|
||||
zig-out
|
||||
15
.gitmodules
vendored
15
.gitmodules
vendored
@@ -83,3 +83,18 @@ ignore = dirty
|
||||
depth = 1
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
[submodule "zig"]
|
||||
path = src/deps/zig
|
||||
url = https://github.com/oven-sh/zig
|
||||
branch = bun
|
||||
depth = 1
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
[submodule "test/node.js/upstream"]
|
||||
path = test/node.js/upstream
|
||||
url = https://github.com/nodejs/node.git
|
||||
ignore = dirty
|
||||
depth = 1
|
||||
update = none
|
||||
shallow = true
|
||||
fetchRecurseSubmodules = false
|
||||
|
||||
@@ -2,4 +2,6 @@ src/bun.js/WebKit
|
||||
src/deps
|
||||
test/snapshots
|
||||
test/js/deno
|
||||
test/node.js
|
||||
src/react-refresh.js
|
||||
*.min.js
|
||||
|
||||
@@ -5,6 +5,15 @@
|
||||
"useTabs": false,
|
||||
"quoteProps": "preserve",
|
||||
"overrides": [
|
||||
{
|
||||
"files": [".vscode/*.json"],
|
||||
"options": {
|
||||
"parser": "jsonc",
|
||||
"quoteProps": "preserve",
|
||||
"singleQuote": false,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["*.md"],
|
||||
"options": {
|
||||
|
||||
25
.vscode/c_cpp_properties.json
vendored
25
.vscode/c_cpp_properties.json
vendored
@@ -17,7 +17,7 @@
|
||||
"${workspaceFolder}/src/deps",
|
||||
"${workspaceFolder}/src/napi/*",
|
||||
"${workspaceFolder}/packages/bun-usockets/src",
|
||||
"${workspaceFolder}/packages/"
|
||||
"${workspaceFolder}/packages/",
|
||||
],
|
||||
"browse": {
|
||||
"path": [
|
||||
@@ -30,10 +30,10 @@
|
||||
"${workspaceFolder}/src/deps/boringssl/include/*",
|
||||
"${workspaceFolder}/packages/bun-usockets/*",
|
||||
"${workspaceFolder}/packages/bun-uws/*",
|
||||
"${workspaceFolder}/src/napi/*"
|
||||
"${workspaceFolder}/src/napi/*",
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ".vscode/cppdb"
|
||||
"databaseFilename": ".vscode/cppdb",
|
||||
},
|
||||
"defines": [
|
||||
"STATICALLY_LINKED_WITH_JavaScriptCore=1",
|
||||
@@ -44,17 +44,18 @@
|
||||
"BUILDING_JSCONLY__",
|
||||
"USE_FOUNDATION=1",
|
||||
"ASSERT_ENABLED=1",
|
||||
"DU_DISABLE_RENAMING=1"
|
||||
"DU_DISABLE_RENAMING=1",
|
||||
],
|
||||
"macFrameworkPath": [],
|
||||
"compilerPath": "${workspaceFolder}/.vscode/clang++",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20"
|
||||
"cppStandard": "c++20",
|
||||
},
|
||||
{
|
||||
"name": "BunWithJSCDebug",
|
||||
"forcedInclude": ["${workspaceFolder}/src/bun.js/bindings/root.h"],
|
||||
"includePath": [
|
||||
"${workspaceFolder}/build/codegen",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/ICU/Headers/",
|
||||
"${workspaceFolder}/src/bun.js/WebKit/WebKitBuild/Debug/JavaScriptCore/PrivateHeaders/",
|
||||
@@ -71,7 +72,7 @@
|
||||
"${workspaceFolder}/src/deps",
|
||||
"${workspaceFolder}/src/napi/*",
|
||||
"${workspaceFolder}/packages/bun-usockets/src",
|
||||
"${workspaceFolder}/packages/"
|
||||
"${workspaceFolder}/packages/",
|
||||
],
|
||||
"browse": {
|
||||
"path": [
|
||||
@@ -93,10 +94,10 @@
|
||||
"${workspaceFolder}/src/deps/boringssl/include/",
|
||||
"${workspaceFolder}/packages/bun-usockets/",
|
||||
"${workspaceFolder}/packages/bun-uws/",
|
||||
"${workspaceFolder}/src/napi"
|
||||
"${workspaceFolder}/src/napi",
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ".vscode/cppdb_debug"
|
||||
"databaseFilename": ".vscode/cppdb_debug",
|
||||
},
|
||||
"defines": [
|
||||
"STATICALLY_LINKED_WITH_JavaScriptCore=1",
|
||||
@@ -107,13 +108,13 @@
|
||||
"BUILDING_JSCONLY__",
|
||||
"USE_FOUNDATION=1",
|
||||
"ASSERT_ENABLED=1",
|
||||
"DU_DISABLE_RENAMING=1"
|
||||
"DU_DISABLE_RENAMING=1",
|
||||
],
|
||||
"macFrameworkPath": [],
|
||||
"compilerPath": "${workspaceFolder}/.vscode/clang++",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++20"
|
||||
}
|
||||
"cppStandard": "c++20",
|
||||
},
|
||||
],
|
||||
"version": 4
|
||||
"version": 4,
|
||||
}
|
||||
|
||||
4
.vscode/extensions.json
vendored
4
.vscode/extensions.json
vendored
@@ -28,6 +28,6 @@
|
||||
"tamasfe.even-better-toml",
|
||||
|
||||
// Other
|
||||
"bierner.comment-tagged-templates"
|
||||
]
|
||||
"bierner.comment-tagged-templates",
|
||||
],
|
||||
}
|
||||
|
||||
425
.vscode/launch.json
generated
vendored
425
.vscode/launch.json
generated
vendored
@@ -18,9 +18,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -33,9 +33,9 @@
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "1",
|
||||
"BUN_DEBUG_FileReader": "1"
|
||||
"BUN_DEBUG_FileReader": "1",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -47,9 +47,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -61,9 +61,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "0",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -75,9 +75,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -89,9 +89,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -104,14 +104,14 @@
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1"
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -124,14 +124,14 @@
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1"
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
// bun run [file]
|
||||
{
|
||||
@@ -144,9 +144,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "0",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -158,9 +158,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -172,9 +172,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "0",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -186,9 +186,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -200,9 +200,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -215,14 +215,14 @@
|
||||
"FORCE_COLOR": "0",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1"
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -235,14 +235,14 @@
|
||||
"FORCE_COLOR": "0",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1"
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
// bun test [...]
|
||||
{
|
||||
@@ -255,9 +255,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -269,9 +269,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -283,9 +283,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "0",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -297,9 +297,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -311,9 +311,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -326,14 +326,14 @@
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1"
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -346,14 +346,29 @@
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1"
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
// bun exec [...]
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "bun exec [...]",
|
||||
"program": "${workspaceFolder}/build/bun-debug",
|
||||
"args": ["exec", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
},
|
||||
// bun test [*]
|
||||
{
|
||||
@@ -366,9 +381,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -380,9 +395,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -395,14 +410,14 @@
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
"BUN_INSPECT": "ws://localhost:0/"
|
||||
"BUN_INSPECT": "ws://localhost:0/",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -414,9 +429,9 @@
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2"
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -425,7 +440,7 @@
|
||||
"program": "node",
|
||||
"args": ["src/runner.node.mjs"],
|
||||
"cwd": "${workspaceFolder}/packages/bun-internal-test",
|
||||
"console": "internalConsole"
|
||||
"console": "internalConsole",
|
||||
},
|
||||
// Windows: bun test [file]
|
||||
{
|
||||
@@ -438,22 +453,22 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_jest",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
"value": "1",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -465,33 +480,33 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_EventLoop",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_uv",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_SYS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_PipeWriter",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -503,17 +518,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "0"
|
||||
}
|
||||
]
|
||||
"value": "0",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -525,17 +540,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "0"
|
||||
"value": "0",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -547,26 +562,26 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
"value": "2",
|
||||
},
|
||||
{
|
||||
"name": "BUN_INSPECT",
|
||||
"value": "ws://localhost:0/?wait=1"
|
||||
}
|
||||
"value": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -578,26 +593,26 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
"value": "2",
|
||||
},
|
||||
{
|
||||
"name": "BUN_INSPECT",
|
||||
"value": "ws://localhost:0/?break=1"
|
||||
}
|
||||
"value": "ws://localhost:0/?break=1",
|
||||
},
|
||||
],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
// Windows: bun run [file]
|
||||
{
|
||||
@@ -610,39 +625,36 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "Windows: bun run [file] (fast)",
|
||||
"name": "Windows: bun install",
|
||||
"program": "${workspaceFolder}/build/bun-debug.exe",
|
||||
"args": ["run", "${fileBasename}"],
|
||||
"args": ["install"],
|
||||
"cwd": "${fileDirname}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "0"
|
||||
}
|
||||
]
|
||||
"value": "0",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -654,17 +666,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "0"
|
||||
"value": "0",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -676,26 +688,26 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
"value": "2",
|
||||
},
|
||||
{
|
||||
"name": "BUN_INSPECT",
|
||||
"value": "ws://localhost:0/?wait=1"
|
||||
}
|
||||
"value": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -707,26 +719,26 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
"value": "2",
|
||||
},
|
||||
{
|
||||
"name": "BUN_INSPECT",
|
||||
"value": "ws://localhost:0/?break=1"
|
||||
}
|
||||
"value": "ws://localhost:0/?break=1",
|
||||
},
|
||||
],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
// Windows: bun test [...]
|
||||
{
|
||||
@@ -739,17 +751,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -761,17 +773,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "0"
|
||||
}
|
||||
]
|
||||
"value": "0",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -783,17 +795,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "0"
|
||||
"value": "0",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -805,17 +817,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -827,17 +839,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -849,26 +861,26 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
"value": "2",
|
||||
},
|
||||
{
|
||||
"name": "BUN_INSPECT",
|
||||
"value": "ws://localhost:0/?wait=1"
|
||||
}
|
||||
"value": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -880,26 +892,49 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
"value": "2",
|
||||
},
|
||||
{
|
||||
"name": "BUN_INSPECT",
|
||||
"value": "ws://localhost:0/?break=1"
|
||||
}
|
||||
"value": "ws://localhost:0/?break=1",
|
||||
},
|
||||
],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
// Windows: bun exec [...]
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "Windows: bun exec [...]",
|
||||
"program": "${workspaceFolder}/build/bun-debug.exe",
|
||||
"args": ["exec", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
// Windows: bun test [*]
|
||||
{
|
||||
@@ -912,17 +947,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
}
|
||||
]
|
||||
"value": "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -934,17 +969,17 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "0"
|
||||
}
|
||||
]
|
||||
"value": "0",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -956,26 +991,26 @@
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
"value": "1"
|
||||
"value": "1",
|
||||
},
|
||||
{
|
||||
"name": "BUN_DEBUG_QUIET_LOGS",
|
||||
"value": "0"
|
||||
"value": "0",
|
||||
},
|
||||
{
|
||||
"name": "BUN_GARBAGE_COLLECTOR_LEVEL",
|
||||
"value": "2"
|
||||
"value": "2",
|
||||
},
|
||||
{
|
||||
"name": "BUN_INSPECT",
|
||||
"value": "ws://localhost:0/"
|
||||
}
|
||||
"value": "ws://localhost:0/",
|
||||
},
|
||||
],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
"action": "openExternally"
|
||||
}
|
||||
"action": "openExternally",
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@@ -984,19 +1019,19 @@
|
||||
"program": "node",
|
||||
"args": ["src/runner.node.mjs"],
|
||||
"cwd": "${workspaceFolder}/packages/bun-internal-test",
|
||||
"console": "internalConsole"
|
||||
}
|
||||
"console": "internalConsole",
|
||||
},
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"id": "commandLine",
|
||||
"type": "promptString",
|
||||
"description": "Usage: bun [...]"
|
||||
"description": "Usage: bun [...]",
|
||||
},
|
||||
{
|
||||
"id": "testName",
|
||||
"type": "promptString",
|
||||
"description": "Usage: bun test [...]"
|
||||
}
|
||||
]
|
||||
"description": "Usage: bun test [...]",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
51
.vscode/settings.json
vendored
51
.vscode/settings.json
vendored
@@ -13,7 +13,8 @@
|
||||
"node_modules": true,
|
||||
".git": true,
|
||||
"src/bun.js/WebKit": true,
|
||||
"src/deps/*/**": true
|
||||
"src/deps/*/**": true,
|
||||
"test/node.js/upstream": true,
|
||||
},
|
||||
"search.followSymlinks": false,
|
||||
"search.useIgnoreFiles": true,
|
||||
@@ -34,40 +35,41 @@
|
||||
"[zig]": {
|
||||
"editor.tabSize": 4,
|
||||
"editor.useTabStops": false,
|
||||
"editor.defaultFormatter": "ziglang.vscode-zig"
|
||||
"editor.defaultFormatter": "ziglang.vscode-zig",
|
||||
},
|
||||
|
||||
// C++
|
||||
"lldb.verboseLogging": false,
|
||||
"cmake.configureOnOpen": false,
|
||||
"C_Cpp.errorSquiggles": "enabled",
|
||||
"C_Cpp.errorSquiggles": "enabled",
|
||||
"[cpp]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
"editor.defaultFormatter": "xaver.clang-format",
|
||||
},
|
||||
"[c]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
"editor.defaultFormatter": "xaver.clang-format",
|
||||
},
|
||||
"[h]": {
|
||||
"editor.defaultFormatter": "xaver.clang-format"
|
||||
"editor.defaultFormatter": "xaver.clang-format",
|
||||
},
|
||||
|
||||
// JavaScript
|
||||
"prettier.enable": true,
|
||||
"prettier.configPath": ".prettierrc",
|
||||
"eslint.workingDirectories": ["${workspaceFolder}/packages/bun-types"],
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
},
|
||||
"[javascriptreact]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
},
|
||||
|
||||
// TypeScript
|
||||
"typescript.tsdk": "${workspaceFolder}/node_modules/typescript/lib",
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
},
|
||||
|
||||
// JSON
|
||||
@@ -77,7 +79,7 @@
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
},
|
||||
|
||||
|
||||
// Markdown
|
||||
"[markdown]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
@@ -88,8 +90,8 @@
|
||||
"editor.quickSuggestions": {
|
||||
"comments": "off",
|
||||
"strings": "off",
|
||||
"other": "off"
|
||||
}
|
||||
"other": "off",
|
||||
},
|
||||
},
|
||||
|
||||
// TOML
|
||||
@@ -102,6 +104,11 @@
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
},
|
||||
|
||||
// Docker
|
||||
"[dockerfile]": {
|
||||
"editor.formatOnSave": false,
|
||||
},
|
||||
|
||||
// Files
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
@@ -113,23 +120,13 @@
|
||||
"**/*.xcworkspacedata": true,
|
||||
"**/*.xcscheme": true,
|
||||
"**/*.xcodeproj": true,
|
||||
"src/bun.js/WebKit": true,
|
||||
"src/deps/libarchive": true,
|
||||
"src/deps/mimalloc": true,
|
||||
"src/deps/s2n-tls": true,
|
||||
"src/deps/boringssl": true,
|
||||
"src/deps/openssl": true,
|
||||
"src/deps/uws": true,
|
||||
"src/deps/zlib": true,
|
||||
"src/deps/lol-html": true,
|
||||
"src/deps/c-ares": true,
|
||||
"src/deps/tinycc": true,
|
||||
"src/deps/zstd": true,
|
||||
"**/*.i": true,
|
||||
"packages/bun-uws/fuzzing/seed-corpus": true
|
||||
|
||||
// uws WebSocket.cpp conflicts with webcore WebSocket.cpp
|
||||
"packages/bun-uws/fuzzing": true,
|
||||
},
|
||||
"files.associations": {
|
||||
"*.idl": "cpp"
|
||||
"*.idl": "cpp",
|
||||
},
|
||||
"C_Cpp.files.exclude": {
|
||||
"**/.vscode": true,
|
||||
@@ -147,6 +144,6 @@
|
||||
"WebKit/WebCore": true,
|
||||
"WebKit/WebDriver": true,
|
||||
"WebKit/WebKitBuild": true,
|
||||
"WebKit/WebInspectorUI": true
|
||||
"WebKit/WebInspectorUI": true,
|
||||
},
|
||||
}
|
||||
|
||||
18
.vscode/tasks.json
vendored
18
.vscode/tasks.json
vendored
@@ -6,13 +6,13 @@
|
||||
"label": "Install Dependencies",
|
||||
"command": "scripts/all-dependencies.sh",
|
||||
"windows": {
|
||||
"command": "scripts/all-dependencies.ps1"
|
||||
"command": "scripts/all-dependencies.ps1",
|
||||
},
|
||||
"icon": {
|
||||
"id": "arrow-down"
|
||||
"id": "arrow-down",
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
"cwd": "${workspaceFolder}",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -21,13 +21,13 @@
|
||||
"dependsOn": ["Install Dependencies"],
|
||||
"command": "scripts/setup.sh",
|
||||
"windows": {
|
||||
"command": "scripts/setup.ps1"
|
||||
"command": "scripts/setup.ps1",
|
||||
},
|
||||
"icon": {
|
||||
"id": "check"
|
||||
"id": "check",
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
"cwd": "${workspaceFolder}",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -37,10 +37,10 @@
|
||||
"command": "bun",
|
||||
"args": ["run", "build"],
|
||||
"icon": {
|
||||
"id": "gear"
|
||||
"id": "gear",
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
"cwd": "${workspaceFolder}",
|
||||
},
|
||||
"isBuildCommand": true,
|
||||
"runOptions": {
|
||||
@@ -48,5 +48,5 @@
|
||||
"reevaluateOnRerun": true,
|
||||
},
|
||||
},
|
||||
]
|
||||
],
|
||||
}
|
||||
|
||||
@@ -2,12 +2,24 @@ cmake_minimum_required(VERSION 3.22)
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
cmake_policy(SET CMP0067 NEW)
|
||||
|
||||
set(Bun_VERSION "1.0.36")
|
||||
set(WEBKIT_TAG 089023cc9078b3aa173869fd6685f3e7bed2a994)
|
||||
set(Bun_VERSION "1.1.7")
|
||||
set(WEBKIT_TAG ce4af76c270078c06822efda52dcb7adf5902f3b)
|
||||
|
||||
set(BUN_WORKDIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
message(STATUS "Configuring Bun ${Bun_VERSION} in ${BUN_WORKDIR}")
|
||||
|
||||
set(CMAKE_COLOR_DIAGNOSTICS ON)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
# WebKit uses -std=gnu++20 on non-macOS non-Windows
|
||||
# If we do not set this, it will crash at startup on the first memory allocation.
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
set(CMAKE_CXX_EXTENSIONS ON)
|
||||
endif()
|
||||
|
||||
# --- Build Type ---
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
message(WARNING "No CMAKE_BUILD_TYPE value specified, defaulting to Debug.\nSet a build type with -DCMAKE_BUILD_TYPE=<Debug|Release>")
|
||||
@@ -51,11 +63,7 @@ endif()
|
||||
|
||||
# --- MacOS SDK ---
|
||||
if(APPLE AND DEFINED ENV{CI})
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
|
||||
else()
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
|
||||
endif()
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0")
|
||||
endif()
|
||||
|
||||
if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
@@ -93,7 +101,7 @@ endif()
|
||||
# any case possible. Sorry for the complexity...
|
||||
#
|
||||
# Bun and WebKit must be compiled with the same compiler, so we do as much as we can to ensure that
|
||||
# the compiler used for the prebuilt WebKit, LLVM 16, is the one that we detect in this process.
|
||||
# the compiler used for the prebuilt WebKit is the same as we install as a dependency.
|
||||
#
|
||||
# It has to be done before project() is called, so that CMake doesnt pick a compiler for us, but even then
|
||||
# we do some extra work afterwards to double-check, and we will rerun BUN_FIND_LLVM if the compiler did not match.
|
||||
@@ -214,12 +222,6 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CMAKE_COLOR_DIAGNOSTICS ON)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
project(Bun VERSION "${Bun_VERSION}")
|
||||
|
||||
# if(MSVC)
|
||||
@@ -315,6 +317,10 @@ option(USE_STATIC_LIBATOMIC "Statically link libatomic, requires the presence of
|
||||
|
||||
option(USE_LTO "Enable Link-Time Optimization" ${DEFAULT_LTO})
|
||||
|
||||
if(NOT ZIG_LIB_DIR)
|
||||
cmake_path(SET ZIG_LIB_DIR NORMALIZE "${CMAKE_CURRENT_SOURCE_DIR}/src/deps/zig/lib")
|
||||
endif()
|
||||
|
||||
if(USE_VALGRIND)
|
||||
# Disable SIMD
|
||||
set(USE_BASELINE_BUILD ON)
|
||||
@@ -551,6 +557,8 @@ else()
|
||||
add_compile_definitions("BUN_DEBUG=1")
|
||||
set(ASSERT_ENABLED "1")
|
||||
endif()
|
||||
|
||||
message(STATUS "Using WebKit from ${WEBKIT_DIR}")
|
||||
else()
|
||||
if(NOT EXISTS "${WEBKIT_DIR}/lib/${libWTF}.${STATIC_LIB_EXT}" OR NOT EXISTS "${WEBKIT_DIR}/lib/${libJavaScriptCore}.${STATIC_LIB_EXT}")
|
||||
if(WEBKIT_DIR MATCHES "src/bun.js/WebKit$")
|
||||
@@ -732,7 +740,7 @@ if(NOT NO_CODEGEN)
|
||||
OUTPUT ${BUN_IDENTIFIER_CACHE_OUT}
|
||||
MAIN_DEPENDENCY "${BUN_SRC}/js_lexer/identifier_data.zig"
|
||||
DEPENDS "${BUN_SRC}/js_lexer/identifier_cache.zig"
|
||||
COMMAND ${ZIG_COMPILER} run "${BUN_SRC}/js_lexer/identifier_data.zig"
|
||||
COMMAND ${ZIG_COMPILER} run "--zig-lib-dir" "${ZIG_LIB_DIR}" "${BUN_SRC}/js_lexer/identifier_data.zig"
|
||||
VERBATIM
|
||||
COMMENT "Building Identifier Cache"
|
||||
)
|
||||
@@ -745,19 +753,27 @@ if(NOT NO_CODEGEN)
|
||||
file(GLOB BUN_TS_MODULES ${CONFIGURE_DEPENDS}
|
||||
"${BUN_SRC}/js/node/*.ts"
|
||||
"${BUN_SRC}/js/node/*.js"
|
||||
"${BUN_SRC}/js/bun/*.js"
|
||||
"${BUN_SRC}/js/bun/*.ts"
|
||||
"${BUN_SRC}/js/bun/*.js"
|
||||
"${BUN_SRC}/js/builtins/*.ts"
|
||||
"${BUN_SRC}/js/builtins/*.js"
|
||||
"${BUN_SRC}/js/thirdparty/*.js"
|
||||
"${BUN_SRC}/js/thirdparty/*.ts"
|
||||
"${BUN_SRC}/js/internal/*.js"
|
||||
"${BUN_SRC}/js/internal/*.ts"
|
||||
"${BUN_SRC}/js/node/*.js"
|
||||
"${BUN_SRC}/js/node/*.ts"
|
||||
"${BUN_SRC}/js/thirdparty/*.js"
|
||||
"${BUN_SRC}/js/thirdparty/*.ts"
|
||||
"${BUN_SRC}/js/internal-for-testing.ts"
|
||||
)
|
||||
file(GLOB BUN_TS_FUNCTIONS ${CONFIGURE_DEPENDS} "${BUN_SRC}/js/builtins/*.ts")
|
||||
|
||||
file(GLOB CODEGEN_FILES ${CONFIGURE_DEPENDS} "${BUN_CODEGEN_SRC}/*.ts")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
"${BUN_WORKDIR}/codegen/WebCoreJSBuiltins.cpp"
|
||||
"${BUN_WORKDIR}/codegen/WebCoreJSBuiltins.h"
|
||||
"${BUN_WORKDIR}/codegen/InternalModuleRegistryConstants.h"
|
||||
"${BUN_WORKDIR}/codegen/InternalModuleRegistry+createInternalModuleById.h"
|
||||
"${BUN_WORKDIR}/codegen/InternalModuleRegistry+enum.h"
|
||||
@@ -765,10 +781,12 @@ if(NOT NO_CODEGEN)
|
||||
"${BUN_WORKDIR}/codegen/NativeModuleImpl.h"
|
||||
"${BUN_WORKDIR}/codegen/ResolvedSourceTag.zig"
|
||||
"${BUN_WORKDIR}/codegen/SyntheticModuleType.h"
|
||||
"${BUN_WORKDIR}/codegen/GeneratedJS2Native.h"
|
||||
"${BUN_SRC}/bun.js/bindings/GeneratedJS2Native.zig"
|
||||
COMMAND ${BUN_EXECUTABLE} run "${BUN_SRC}/codegen/bundle-modules.ts" "--debug=${DEBUG}" "${BUN_WORKDIR}"
|
||||
DEPENDS ${BUN_TS_MODULES} ${CODEGEN_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Bundling JS modules"
|
||||
COMMENT "Bundling JS"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -776,15 +794,6 @@ WEBKIT_ADD_SOURCE_DEPENDENCIES(
|
||||
"${BUN_SRC}/bun.js/bindings/InternalModuleRegistry.cpp"
|
||||
"${BUN_WORKDIR}/codegen/InternalModuleRegistryConstants.h"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${BUN_WORKDIR}/codegen/WebCoreJSBuiltins.cpp"
|
||||
"${BUN_WORKDIR}/codegen/WebCoreJSBuiltins.h"
|
||||
COMMAND ${BUN_EXECUTABLE} run "${BUN_SRC}/codegen/bundle-functions.ts" "--debug=${DEBUG}" "${BUN_WORKDIR}"
|
||||
DEPENDS ${BUN_TS_FUNCTIONS} ${CODEGEN_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Bundling JS builtin functions"
|
||||
)
|
||||
list(APPEND BUN_RAW_SOURCES "${BUN_WORKDIR}/codegen/WebCoreJSBuiltins.cpp")
|
||||
|
||||
# --- Peechy API ---
|
||||
@@ -852,8 +861,10 @@ if(NOT BUN_LINK_ONLY AND NOT BUN_CPP_ONLY)
|
||||
OUTPUT "${BUN_ZIG_OBJ}"
|
||||
COMMAND
|
||||
"${ZIG_COMPILER}" "build" "obj"
|
||||
"--zig-lib-dir" "${ZIG_LIB_DIR}"
|
||||
"-Doutput-file=${BUN_ZIG_OBJ}"
|
||||
"-Dgenerated-code=${BUN_WORKDIR}/codegen"
|
||||
"-freference-trace=10"
|
||||
"-Dversion=${Bun_VERSION}"
|
||||
"-Dcanary=${CANARY}"
|
||||
"-Doptimize=${ZIG_OPTIMIZE}"
|
||||
@@ -866,6 +877,7 @@ if(NOT BUN_LINK_ONLY AND NOT BUN_CPP_ONLY)
|
||||
"${BUN_WORKDIR}/codegen/ResolvedSourceTag.zig"
|
||||
"${BUN_IDENTIFIER_CACHE_OUT}"
|
||||
"${BUN_SRC}/api/schema.zig"
|
||||
"${BUN_SRC}/bun.js/bindings/GeneratedJS2Native.zig"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Building zig code"
|
||||
VERBATIM
|
||||
@@ -1005,7 +1017,7 @@ endif()
|
||||
# --- clang and linker flags ---
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if(NOT WIN32)
|
||||
target_compile_options(${bun} PUBLIC -g3 -O0 -gdwarf-4
|
||||
target_compile_options(${bun} PUBLIC -O0 -g -g3 -ggdb -gdwarf-4
|
||||
-Werror=return-type
|
||||
-Werror=return-stack-address
|
||||
-Werror=implicit-function-declaration
|
||||
@@ -1052,8 +1064,8 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
list(APPEND LTO_LINK_FLAG "/LTCG")
|
||||
endif()
|
||||
|
||||
target_compile_options(${bun} PUBLIC /O2 ${LTO_FLAG} /DEBUG /Z7)
|
||||
target_link_options(${bun} PUBLIC ${LTO_LINK_FLAG} /DEBUG)
|
||||
target_compile_options(${bun} PUBLIC /O2 ${LTO_FLAG} /DEBUG:FULL)
|
||||
target_link_options(${bun} PUBLIC ${LTO_LINK_FLAG} /DEBUG:FULL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1093,15 +1105,14 @@ else()
|
||||
target_compile_options(${bun} PUBLIC
|
||||
-fPIC
|
||||
-mtune=${CPU_TARGET}
|
||||
-fconstexpr-steps=1271242
|
||||
-fconstexpr-depth=27
|
||||
-fconstexpr-steps=2542484
|
||||
-fconstexpr-depth=54
|
||||
-fno-exceptions
|
||||
-fvisibility=hidden
|
||||
-fvisibility-inlines-hidden
|
||||
-fno-rtti
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -std=c++2a")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
@@ -1120,7 +1131,6 @@ if(UNIX AND NOT APPLE)
|
||||
"-fuse-ld=lld"
|
||||
"-static-libstdc++"
|
||||
"-static-libgcc"
|
||||
"-fuse-ld=lld"
|
||||
"-Wl,-z,now"
|
||||
"-Wl,--as-needed"
|
||||
"-Wl,--gc-sections"
|
||||
@@ -1133,16 +1143,17 @@ if(UNIX AND NOT APPLE)
|
||||
"-Wl,--wrap=log"
|
||||
"-Wl,--wrap=log2"
|
||||
"-Wl,--wrap=lstat"
|
||||
"-Wl,--wrap=stat64"
|
||||
"-Wl,--wrap=stat"
|
||||
"-Wl,--wrap=fstat"
|
||||
"-Wl,--wrap=fstatat"
|
||||
"-Wl,--wrap=lstat64"
|
||||
"-Wl,--wrap=stat64"
|
||||
"-Wl,--wrap=fstat64"
|
||||
"-Wl,--wrap=fstatat64"
|
||||
"-Wl,--wrap=mknod"
|
||||
"-Wl,--wrap=mknodat"
|
||||
"-Wl,--wrap=statx"
|
||||
"-Wl,--wrap=fmod"
|
||||
"-Wl,--compress-debug-sections=zlib"
|
||||
"-Bsymbolics-functions"
|
||||
"-rdynamic"
|
||||
|
||||
151
Dockerfile
151
Dockerfile
@@ -16,7 +16,7 @@ ARG BUILD_MACHINE_ARCH=x86_64
|
||||
ARG BUILDARCH=amd64
|
||||
ARG TRIPLET=${ARCH}-linux-gnu
|
||||
ARG GIT_SHA=""
|
||||
ARG BUN_VERSION="bun-v1.0.30"
|
||||
ARG BUN_VERSION="bun-v1.1.4"
|
||||
ARG BUN_DOWNLOAD_URL_BASE="https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/${BUN_VERSION}"
|
||||
ARG CANARY=0
|
||||
ARG ASSERTIONS=OFF
|
||||
@@ -51,10 +51,10 @@ ENV CPU_TARGET=${CPU_TARGET}
|
||||
ENV BUILDARCH=${BUILDARCH}
|
||||
ENV BUN_DEPS_OUT_DIR=${BUN_DEPS_OUT_DIR}
|
||||
|
||||
ENV CXX=clang++-16
|
||||
ENV CC=clang-16
|
||||
ENV AR=/usr/bin/llvm-ar-16
|
||||
ENV LD=lld-16
|
||||
ENV CXX=clang++-${LLVM_VERSION}
|
||||
ENV CC=clang-${LLVM_VERSION}
|
||||
ENV AR=/usr/bin/llvm-ar-${LLVM_VERSION}
|
||||
ENV LD=lld-${LLVM_VERSION}
|
||||
|
||||
ENV SCCACHE_BUCKET=${SCCACHE_BUCKET}
|
||||
ENV SCCACHE_REGION=${SCCACHE_REGION}
|
||||
@@ -63,8 +63,7 @@ ENV SCCACHE_ENDPOINT=${SCCACHE_ENDPOINT}
|
||||
ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
|
||||
ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
|
||||
|
||||
RUN apt-get update -y \
|
||||
&& install_packages \
|
||||
RUN install_packages \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
@@ -88,6 +87,8 @@ RUN apt-get update -y \
|
||||
lld-${LLVM_VERSION} \
|
||||
lldb-${LLVM_VERSION} \
|
||||
clangd-${LLVM_VERSION} \
|
||||
libc++-${LLVM_VERSION}-dev \
|
||||
libc++abi-${LLVM_VERSION}-dev \
|
||||
make \
|
||||
cmake \
|
||||
ninja-build \
|
||||
@@ -104,19 +105,21 @@ RUN apt-get update -y \
|
||||
perl \
|
||||
python3 \
|
||||
ruby \
|
||||
ruby-dev \
|
||||
golang \
|
||||
nodejs \
|
||||
&& ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang \
|
||||
&& ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ \
|
||||
&& ln -s /usr/bin/lld-${LLVM_VERSION} /usr/bin/lld \
|
||||
&& ln -s /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb \
|
||||
&& ln -s /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd \
|
||||
&& ln -s /usr/bin/llvm-ar-${LLVM_VERSION} /usr/bin/llvm-ar \
|
||||
nodejs && \
|
||||
for f in /usr/lib/llvm-${LLVM_VERSION}/bin/*; do ln -sf "$f" /usr/bin; done \
|
||||
&& ln -sf /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang \
|
||||
&& ln -sf /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++ \
|
||||
&& ln -sf /usr/bin/lld-${LLVM_VERSION} /usr/bin/lld \
|
||||
&& ln -sf /usr/bin/lldb-${LLVM_VERSION} /usr/bin/lldb \
|
||||
&& ln -sf /usr/bin/clangd-${LLVM_VERSION} /usr/bin/clangd \
|
||||
&& ln -sf /usr/bin/llvm-ar-${LLVM_VERSION} /usr/bin/llvm-ar \
|
||||
&& arch="$(dpkg --print-architecture)" \
|
||||
&& case "${arch##*-}" in \
|
||||
amd64) variant="x64";; \
|
||||
arm64) variant="aarch64";; \
|
||||
*) echo "error: unsupported architecture: $arch"; exit 1 ;; \
|
||||
*) echo "unsupported architecture: $arch"; exit 1 ;; \
|
||||
esac \
|
||||
&& wget "${BUN_DOWNLOAD_URL_BASE}/bun-linux-${variant}.zip" \
|
||||
&& unzip bun-linux-${variant}.zip \
|
||||
@@ -138,6 +141,8 @@ ARG BUILD_MACHINE_ARCH
|
||||
ARG ZIG_FOLDERNAME=zig-linux-${BUILD_MACHINE_ARCH}-${ZIG_VERSION}
|
||||
ARG ZIG_FILENAME=${ZIG_FOLDERNAME}.tar.xz
|
||||
ARG ZIG_URL="https://ziglang.org/builds/${ZIG_FILENAME}"
|
||||
ARG ZIG_LOCAL_CACHE_DIR=/zig-cache
|
||||
ENV ZIG_LOCAL_CACHE_DIR=${ZIG_LOCAL_CACHE_DIR}
|
||||
|
||||
WORKDIR $GITHUB_WORKSPACE
|
||||
|
||||
@@ -152,14 +157,18 @@ FROM bun-base as c-ares
|
||||
ARG BUN_DIR
|
||||
ARG CPU_TARGET
|
||||
ENV CPU_TARGET=${CPU_TARGET}
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
COPY Makefile ${BUN_DIR}/Makefile
|
||||
COPY src/deps/c-ares ${BUN_DIR}/src/deps/c-ares
|
||||
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
RUN --mount=type=cache,target=/ccache cd $BUN_DIR && make c-ares && rm -rf ${BUN_DIR}/src/deps/c-ares ${BUN_DIR}/Makefile
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
cd $BUN_DIR \
|
||||
&& make c-ares \
|
||||
&& rm -rf ${BUN_DIR}/src/deps/c-ares ${BUN_DIR}/Makefile
|
||||
|
||||
FROM bun-base as lolhtml
|
||||
|
||||
@@ -172,10 +181,14 @@ ENV CPU_TARGET=${CPU_TARGET}
|
||||
COPY Makefile ${BUN_DIR}/Makefile
|
||||
COPY src/deps/lol-html ${BUN_DIR}/src/deps/lol-html
|
||||
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
RUN --mount=type=cache,target=/ccache export PATH=$PATH:$HOME/.cargo/bin && cd ${BUN_DIR} && \
|
||||
make lolhtml && rm -rf src/deps/lol-html Makefile
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
export PATH=$PATH:$HOME/.cargo/bin \
|
||||
&& cd ${BUN_DIR} \
|
||||
&& make lolhtml \
|
||||
&& rm -rf src/deps/lol-html Makefile
|
||||
|
||||
FROM bun-base as mimalloc
|
||||
|
||||
@@ -187,10 +200,13 @@ ENV CPU_TARGET=${CPU_TARGET}
|
||||
COPY Makefile ${BUN_DIR}/Makefile
|
||||
COPY src/deps/mimalloc ${BUN_DIR}/src/deps/mimalloc
|
||||
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
RUN --mount=type=cache,target=/ccache cd ${BUN_DIR} && \
|
||||
make mimalloc && rm -rf src/deps/mimalloc Makefile;
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
cd ${BUN_DIR} \
|
||||
&& make mimalloc \
|
||||
&& rm -rf src/deps/mimalloc Makefile
|
||||
|
||||
FROM bun-base as mimalloc-debug
|
||||
|
||||
@@ -202,32 +218,39 @@ ENV CPU_TARGET=${CPU_TARGET}
|
||||
COPY Makefile ${BUN_DIR}/Makefile
|
||||
COPY src/deps/mimalloc ${BUN_DIR}/src/deps/mimalloc
|
||||
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
RUN --mount=type=cache,target=/ccache cd ${BUN_DIR} && \
|
||||
make mimalloc-debug && rm -rf src/deps/mimalloc Makefile;
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
cd ${BUN_DIR} \
|
||||
&& make mimalloc-debug \
|
||||
&& rm -rf src/deps/mimalloc Makefile
|
||||
|
||||
FROM bun-base as zlib
|
||||
|
||||
ARG BUN_DIR
|
||||
ARG CPU_TARGET
|
||||
ENV CPU_TARGET=${CPU_TARGET}
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
COPY Makefile ${BUN_DIR}/Makefile
|
||||
COPY src/deps/zlib ${BUN_DIR}/src/deps/zlib
|
||||
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
RUN --mount=type=cache,target=/ccache cd $BUN_DIR && \
|
||||
make zlib && rm -rf src/deps/zlib Makefile
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
cd $BUN_DIR \
|
||||
&& make zlib \
|
||||
&& rm -rf src/deps/zlib Makefile
|
||||
|
||||
FROM bun-base as libarchive
|
||||
|
||||
ARG BUN_DIR
|
||||
ARG CPU_TARGET
|
||||
ENV CPU_TARGET=${CPU_TARGET}
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
RUN install_packages autoconf automake libtool pkg-config
|
||||
|
||||
@@ -236,8 +259,10 @@ COPY src/deps/libarchive ${BUN_DIR}/src/deps/libarchive
|
||||
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
RUN --mount=type=cache,target=/ccache cd $BUN_DIR && \
|
||||
make libarchive && rm -rf src/deps/libarchive Makefile
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
cd $BUN_DIR \
|
||||
&& make libarchive \
|
||||
&& rm -rf src/deps/libarchive Makefile
|
||||
|
||||
FROM bun-base as tinycc
|
||||
|
||||
@@ -261,9 +286,13 @@ COPY src/deps/boringssl ${BUN_DIR}/src/deps/boringssl
|
||||
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
RUN --mount=type=cache,target=/ccache cd ${BUN_DIR} && make boringssl && rm -rf src/deps/boringssl Makefile
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
cd ${BUN_DIR} \
|
||||
&& make boringssl \
|
||||
&& rm -rf src/deps/boringssl Makefile
|
||||
|
||||
FROM bun-base as base64
|
||||
|
||||
@@ -286,14 +315,17 @@ ARG BUN_DIR
|
||||
ARG CPU_TARGET
|
||||
ENV CPU_TARGET=${CPU_TARGET}
|
||||
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
COPY Makefile ${BUN_DIR}/Makefile
|
||||
COPY src/deps/zstd ${BUN_DIR}/src/deps/zstd
|
||||
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
RUN --mount=type=cache,target=/ccache cd $BUN_DIR && make zstd
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
cd $BUN_DIR \
|
||||
&& make zstd
|
||||
|
||||
FROM bun-base as ls-hpack
|
||||
|
||||
@@ -302,14 +334,17 @@ ARG BUN_DIR
|
||||
ARG CPU_TARGET
|
||||
ENV CPU_TARGET=${CPU_TARGET}
|
||||
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
COPY Makefile ${BUN_DIR}/Makefile
|
||||
COPY src/deps/ls-hpack ${BUN_DIR}/src/deps/ls-hpack
|
||||
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
RUN --mount=type=cache,target=/ccache cd $BUN_DIR && make lshpack
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
cd $BUN_DIR \
|
||||
&& make lshpack
|
||||
|
||||
FROM bun-base-with-zig as bun-identifier-cache
|
||||
|
||||
@@ -324,9 +359,9 @@ WORKDIR $BUN_DIR
|
||||
COPY src/js_lexer/identifier_data.zig ${BUN_DIR}/src/js_lexer/identifier_data.zig
|
||||
COPY src/js_lexer/identifier_cache.zig ${BUN_DIR}/src/js_lexer/identifier_cache.zig
|
||||
|
||||
RUN cd $BUN_DIR \
|
||||
&& zig run src/js_lexer/identifier_data.zig \
|
||||
&& rm -rf zig-cache
|
||||
RUN --mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
|
||||
cd $BUN_DIR \
|
||||
&& zig run src/js_lexer/identifier_data.zig
|
||||
|
||||
FROM bun-base as bun-node-fallbacks
|
||||
|
||||
@@ -367,9 +402,10 @@ COPY src ${BUN_DIR}/src
|
||||
COPY CMakeLists.txt ${BUN_DIR}/CMakeLists.txt
|
||||
COPY src/deps/boringssl/include ${BUN_DIR}/src/deps/boringssl/include
|
||||
|
||||
ENV CCACHE_DIR=/ccache
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
RUN --mount=type=cache,target=/ccache mkdir ${BUN_DIR}/build \
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} mkdir ${BUN_DIR}/build \
|
||||
&& cd ${BUN_DIR}/build \
|
||||
&& mkdir -p tmp_modules tmp_functions js codegen \
|
||||
&& cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DUSE_LTO=ON -DUSE_DEBUG_JSC=${ASSERTIONS} -DBUN_CPP_ONLY=1 -DWEBKIT_DIR=/build/bun/bun-webkit -DCANARY=${CANARY} -DZIG_COMPILER=system \
|
||||
@@ -387,7 +423,8 @@ COPY src/api ${BUN_DIR}/src/api
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
# TODO: move away from Makefile entirely
|
||||
RUN bun install --frozen-lockfile \
|
||||
RUN --mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
|
||||
bun install --frozen-lockfile \
|
||||
&& make runtime_js fallback_decoder bun_error \
|
||||
&& rm -rf src/runtime src/fallback.ts node_modules bun.lockb package.json Makefile
|
||||
|
||||
@@ -401,6 +438,9 @@ ARG CANARY=0
|
||||
ARG ASSERTIONS=OFF
|
||||
ARG ZIG_OPTIMIZE=ReleaseFast
|
||||
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
|
||||
COPY *.zig package.json CMakeLists.txt ${BUN_DIR}/
|
||||
COPY completions ${BUN_DIR}/completions
|
||||
COPY packages ${BUN_DIR}/packages
|
||||
@@ -413,8 +453,10 @@ COPY --from=bun-codegen-for-zig ${BUN_DIR}/packages/bun-error/dist ${BUN_DIR}/pa
|
||||
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
RUN mkdir -p build \
|
||||
&& bun run $BUN_DIR/src/codegen/bundle-modules-fast.ts $BUN_DIR/build \
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
--mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
|
||||
mkdir -p build \
|
||||
&& bun run $BUN_DIR/src/codegen/bundle-modules.ts --debug=OFF $BUN_DIR/build \
|
||||
&& cd build \
|
||||
&& cmake .. \
|
||||
-G Ninja \
|
||||
@@ -429,6 +471,7 @@ RUN mkdir -p build \
|
||||
-DBUN_ZIG_OBJ="/tmp/bun-zig.o" \
|
||||
-DCANARY="${CANARY}" \
|
||||
-DZIG_COMPILER=system \
|
||||
-DZIG_LIB_DIR=$BUN_DIR/src/deps/zig/lib \
|
||||
&& ONLY_ZIG=1 ninja "/tmp/bun-zig.o" -v
|
||||
|
||||
FROM scratch as build_release_obj
|
||||
@@ -445,6 +488,10 @@ ARG CANARY
|
||||
ARG ASSERTIONS
|
||||
|
||||
ENV CPU_TARGET=${CPU_TARGET}
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
ARG ZIG_LOCAL_CACHE_DIR=/zig-cache
|
||||
ENV ZIG_LOCAL_CACHE_DIR=${ZIG_LOCAL_CACHE_DIR}
|
||||
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
@@ -472,7 +519,9 @@ COPY --from=bun-cpp-objects ${BUN_DIR}/bun-webkit/lib ${BUN_DIR}/bun-webkit/lib
|
||||
|
||||
WORKDIR $BUN_DIR/build
|
||||
|
||||
RUN cmake .. \
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
--mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
|
||||
cmake .. \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_LINK_ONLY=1 \
|
||||
@@ -503,6 +552,10 @@ ARG CANARY
|
||||
ARG ASSERTIONS
|
||||
|
||||
ENV CPU_TARGET=${CPU_TARGET}
|
||||
ARG CCACHE_DIR=/ccache
|
||||
ENV CCACHE_DIR=${CCACHE_DIR}
|
||||
ARG ZIG_LOCAL_CACHE_DIR=/zig-cache
|
||||
ENV ZIG_LOCAL_CACHE_DIR=${ZIG_LOCAL_CACHE_DIR}
|
||||
|
||||
WORKDIR $BUN_DIR
|
||||
|
||||
@@ -529,7 +582,9 @@ COPY --from=bun-cpp-objects ${BUN_DIR}/bun-webkit/lib ${BUN_DIR}/bun-webkit/lib
|
||||
|
||||
WORKDIR $BUN_DIR/build
|
||||
|
||||
RUN cmake .. \
|
||||
RUN --mount=type=cache,target=${CCACHE_DIR} \
|
||||
--mount=type=cache,target=${ZIG_LOCAL_CACHE_DIR} \
|
||||
cmake .. \
|
||||
-G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUN_LINK_ONLY=1 \
|
||||
|
||||
3
Makefile
3
Makefile
@@ -1266,7 +1266,8 @@ jsc-build-linux-compile-config:
|
||||
cmake \
|
||||
-DPORT="JSCOnly" \
|
||||
-DENABLE_STATIC_JSC=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DENABLE_BUN_SKIP_FAILING_ASSERTIONS=ON \
|
||||
-DUSE_THIN_ARCHIVES=OFF \
|
||||
-DUSE_BUN_JSC_ADDITIONS=ON \
|
||||
-DENABLE_FTL_JIT=ON \
|
||||
|
||||
@@ -45,16 +45,17 @@ bunx cowsay 'Hello, world!' # execute a package
|
||||
|
||||
## Install
|
||||
|
||||
Bun supports Linux (x64 & arm64) and macOS (x64 & Apple Silicon).
|
||||
Bun supports Linux (x64 & arm64), macOS (x64 & Apple Silicon) and Windows (x64).
|
||||
|
||||
> **Linux users** — Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1.
|
||||
>
|
||||
> **Windows users** — Bun does not currently provide a native Windows build. We're working on this; progress can be tracked at [this issue](https://github.com/oven-sh/bun/issues/43). In the meantime, use one of the installation methods below for Windows Subsystem for Linux.
|
||||
|
||||
```sh
|
||||
# with install script (recommended)
|
||||
curl -fsSL https://bun.sh/install | bash
|
||||
|
||||
# on windows
|
||||
powershell -c "irm bun.sh/install.ps1 | iex"
|
||||
|
||||
# with npm
|
||||
npm install -g bun
|
||||
|
||||
|
||||
24
bench/snippets/array-sort.mjs
Normal file
24
bench/snippets/array-sort.mjs
Normal file
@@ -0,0 +1,24 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
var comparator = (a, b) => a - b;
|
||||
|
||||
const numbers = [
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51,
|
||||
50, 49, 48.9,
|
||||
];
|
||||
|
||||
const presorted = numbers.slice().sort(comparator);
|
||||
|
||||
bench(`Array.sort (${numbers.length} num, unsorted)`, () => {
|
||||
[
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
|
||||
16, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52,
|
||||
51, 50, 49, 48.9,
|
||||
].sort(comparator);
|
||||
});
|
||||
|
||||
bench(`Array.sort (${numbers.length} num, pre-sorted)`, () => {
|
||||
presorted.sort(comparator);
|
||||
});
|
||||
|
||||
run();
|
||||
19
bench/snippets/url.mjs
Normal file
19
bench/snippets/url.mjs
Normal file
@@ -0,0 +1,19 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
bench(`new URL('https://example.com/')`, () => {
|
||||
const url = new URL("https://example.com/");
|
||||
});
|
||||
|
||||
bench(`new URL('https://example.com')`, () => {
|
||||
const url = new URL("https://example.com");
|
||||
});
|
||||
|
||||
bench(`new URL('https://www.example.com')`, () => {
|
||||
const url = new URL("https://www.example.com");
|
||||
});
|
||||
|
||||
bench(`new URL('https://www.example.com/')`, () => {
|
||||
const url = new URL("https://www.example.com/");
|
||||
});
|
||||
|
||||
await run();
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Database } from "https://deno.land/x/sqlite3@0.9.1/mod.ts";
|
||||
import { Database } from "https://deno.land/x/sqlite3@0.11.1/mod.ts";
|
||||
import { run, bench } from "../node_modules/mitata/src/cli.mjs";
|
||||
|
||||
const db = new Database("./src/northwind.sqlite");
|
||||
|
||||
@@ -146,7 +146,7 @@ const fs = std.fs;
|
||||
pub fn build(b: *Build) !void {
|
||||
build_(b) catch |err| {
|
||||
if (@errorReturnTrace()) |trace| {
|
||||
std.debug.dumpStackTrace(trace.*);
|
||||
(std.debug).dumpStackTrace(trace.*);
|
||||
}
|
||||
|
||||
return err;
|
||||
@@ -394,7 +394,7 @@ pub fn build_(b: *Build) !void {
|
||||
obj.linkLibC();
|
||||
obj.dll_export_fns = true;
|
||||
obj.strip = false;
|
||||
obj.omit_frame_pointer = optimize != .Debug;
|
||||
obj.omit_frame_pointer = false;
|
||||
obj.subsystem = .Console;
|
||||
|
||||
// Disable stack probing on x86 so we don't need to include compiler_rt
|
||||
|
||||
@@ -96,6 +96,10 @@ FROM alpine:3.18
|
||||
ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0
|
||||
ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
|
||||
|
||||
# Ensure `bun install -g` works
|
||||
ARG BUN_INSTALL_BIN=/usr/local/bin
|
||||
ENV BUN_INSTALL_BIN=${BUN_INSTALL_BIN}
|
||||
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin/
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
|
||||
@@ -62,6 +62,10 @@ FROM debian:bullseye-slim
|
||||
ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0
|
||||
ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
|
||||
|
||||
# Ensure `bun install -g` works
|
||||
ARG BUN_INSTALL_BIN=/usr/local/bin
|
||||
ENV BUN_INSTALL_BIN=${BUN_INSTALL_BIN}
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin/bun
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ FROM debian:bullseye-slim AS build
|
||||
# https://github.com/oven-sh/bun/releases
|
||||
ARG BUN_VERSION=latest
|
||||
|
||||
# Node.js includes python3 for node-gyp, see https://github.com/oven-sh/bun/issues/9807
|
||||
# Though, not on slim and alpine images.
|
||||
RUN apt-get update -qq \
|
||||
&& apt-get install -qq --no-install-recommends \
|
||||
ca-certificates \
|
||||
@@ -11,6 +13,7 @@ RUN apt-get update -qq \
|
||||
gpg \
|
||||
gpg-agent \
|
||||
unzip \
|
||||
python3 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& arch="$(dpkg --print-architecture)" \
|
||||
@@ -63,6 +66,10 @@ COPY --from=build /usr/local/bin/bun /usr/local/bin/bun
|
||||
ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0
|
||||
ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
|
||||
|
||||
# Ensure `bun install -g` works
|
||||
ARG BUN_INSTALL_BIN=/usr/local/bin
|
||||
ENV BUN_INSTALL_BIN=${BUN_INSTALL_BIN}
|
||||
|
||||
RUN groupadd bun \
|
||||
--gid 1000 \
|
||||
&& useradd bun \
|
||||
|
||||
@@ -62,6 +62,10 @@ FROM gcr.io/distroless/base-nossl-debian11
|
||||
ARG BUN_RUNTIME_TRANSPILER_CACHE_PATH=0
|
||||
ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
|
||||
|
||||
# Ensure `bun install -g` works
|
||||
ARG BUN_INSTALL_BIN=/usr/local/bin
|
||||
ENV BUN_INSTALL_BIN=${BUN_INSTALL_BIN}
|
||||
|
||||
COPY --from=build /usr/local/bin/bun /usr/local/bin/
|
||||
|
||||
# Temporarily use the `build`-stage image binaries to create a symlink:
|
||||
|
||||
@@ -43,6 +43,7 @@ A `BunFile` can point to a location on disk where a file does not exist.
|
||||
const notreal = Bun.file("notreal.txt");
|
||||
notreal.size; // 0
|
||||
notreal.type; // "text/plain;charset=utf-8"
|
||||
const exists = await notreal.exists(); // false
|
||||
```
|
||||
|
||||
The default MIME type is `text/plain;charset=utf-8`, but it can be overridden by passing a second argument to `Bun.file`.
|
||||
@@ -340,6 +341,7 @@ interface BunFile {
|
||||
arrayBuffer(): Promise<ArrayBuffer>;
|
||||
json(): Promise<any>;
|
||||
writer(params: { highWaterMark?: number }): FileSink;
|
||||
exists(): Promise<boolean>;
|
||||
}
|
||||
|
||||
export interface FileSink {
|
||||
|
||||
@@ -112,6 +112,7 @@ Bun.hash.murmur64v2("data", 1234);
|
||||
`Bun.CryptoHasher` is a general-purpose utility class that lets you incrementally compute a hash of string or binary data using a range of cryptographic hash algorithms. The following algorithms are supported:
|
||||
|
||||
- `"blake2b256"`
|
||||
- `"blake2b512"`
|
||||
- `"md4"`
|
||||
- `"md5"`
|
||||
- `"ripemd160"`
|
||||
@@ -120,7 +121,12 @@ Bun.hash.murmur64v2("data", 1234);
|
||||
- `"sha256"`
|
||||
- `"sha384"`
|
||||
- `"sha512"`
|
||||
- `"sha512-224"`
|
||||
- `"sha512-256"`
|
||||
- `"sha3-224"`
|
||||
- `"sha3-256"`
|
||||
- `"sha3-384"`
|
||||
- `"sha3-512"`
|
||||
|
||||
```ts
|
||||
const hasher = new Bun.CryptoHasher("sha256");
|
||||
|
||||
@@ -293,37 +293,79 @@ The `Bun.serve` server can handle roughly 2.5x more requests per second than Nod
|
||||
```ts
|
||||
interface Bun {
|
||||
serve(options: {
|
||||
fetch: (req: Request, server: Server) => Response | Promise<Response>;
|
||||
hostname?: string;
|
||||
port?: number;
|
||||
development?: boolean;
|
||||
error?: (error: Error) => Response | Promise<Response>;
|
||||
tls?: {
|
||||
key?:
|
||||
| string
|
||||
| TypedArray
|
||||
| BunFile
|
||||
| Array<string | TypedArray | BunFile>;
|
||||
cert?:
|
||||
| string
|
||||
| TypedArray
|
||||
| BunFile
|
||||
| Array<string | TypedArray | BunFile>;
|
||||
ca?: string | TypedArray | BunFile | Array<string | TypedArray | BunFile>;
|
||||
passphrase?: string;
|
||||
dhParamsFile?: string;
|
||||
};
|
||||
error?: (request: ErrorLike) => Response | Promise<Response> | undefined | Promise<undefined>;
|
||||
fetch(request: Request, server: Server): Response | Promise<Response>;
|
||||
hostname?: string;
|
||||
id?: string | null;
|
||||
maxRequestBodySize?: number;
|
||||
lowMemoryMode?: boolean;
|
||||
port?: string | number;
|
||||
reusePort?: boolean;
|
||||
tls?: TLSOptions | Array<TLSOptions>;
|
||||
unix: string;
|
||||
websocket: WebSocketHandler<WebSocketDataType>;
|
||||
}): Server;
|
||||
}
|
||||
|
||||
interface TLSOptions {
|
||||
ca?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined;
|
||||
cert?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined;
|
||||
dhParamsFile?: string;
|
||||
key?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined;
|
||||
lowMemoryMode?: boolean;
|
||||
passphrase?: string;
|
||||
secureOptions?: number | undefined;
|
||||
serverName?: string;
|
||||
}
|
||||
|
||||
interface WebSocketHandler<T = undefined> {
|
||||
backpressureLimit?: number;
|
||||
close?(ws: ServerWebSocket<T>, code: number, reason: string): void | Promise<void>;
|
||||
closeOnBackpressureLimit?: boolean;
|
||||
drain?(ws: ServerWebSocket<T>): void | Promise<void>;
|
||||
idleTimeout?: number;
|
||||
maxPayloadLength?: number;
|
||||
message(ws: ServerWebSocket<T>, message: string | Buffer): void | Promise<void>;
|
||||
open?(ws: ServerWebSocket<T>): void | Promise<void>;
|
||||
perMessageDeflate?:
|
||||
| boolean
|
||||
| {
|
||||
compress?: WebSocketCompressor | boolean;
|
||||
decompress?: WebSocketCompressor | boolean;
|
||||
};
|
||||
ping?(ws: ServerWebSocket<T>, data: Buffer): void | Promise<void>;
|
||||
pong?(ws: ServerWebSocket<T>, data: Buffer): void | Promise<void>;
|
||||
publishToSelf?: boolean;
|
||||
sendPings?: boolean;
|
||||
}
|
||||
|
||||
interface Server {
|
||||
development: boolean;
|
||||
hostname: string;
|
||||
port: number;
|
||||
pendingRequests: number;
|
||||
stop(): void;
|
||||
fetch(request: Request | string): Response | Promise<Response>;
|
||||
publish(
|
||||
compress?: boolean,
|
||||
data: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
|
||||
topic: string,
|
||||
): ServerWebSocketSendStatus;
|
||||
ref(): void;
|
||||
reload(options: Serve): void;
|
||||
requestIP(request: Request): SocketAddress | null;
|
||||
stop(closeActiveConnections?: boolean): void;
|
||||
unref(): void;
|
||||
upgrade<T = undefined>(
|
||||
options?: {
|
||||
data?: T;
|
||||
headers?: Bun.HeadersInit;
|
||||
},
|
||||
request: Request,
|
||||
): boolean;
|
||||
|
||||
readonly development: boolean;
|
||||
readonly hostname: string;
|
||||
readonly id: string;
|
||||
readonly pendingRequests: number;
|
||||
readonly pendingWebSockets: number;
|
||||
readonly port: number;
|
||||
readonly url: URL;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ Bun implements the following properties.
|
||||
import.meta.dir; // => "/path/to/project"
|
||||
import.meta.file; // => "file.ts"
|
||||
import.meta.path; // => "/path/to/project/file.ts"
|
||||
import.meta.url; // => "file:///path/to/project/file.ts"
|
||||
|
||||
import.meta.main; // `true` if this file is directly executed by `bun run`
|
||||
// `false` otherwise
|
||||
|
||||
import.meta.resolveSync("zod")
|
||||
// resolve an import specifier relative to the directory
|
||||
import.meta.resolve("zod"); // => "file:///path/to/project/node_modules/zod/index.js"
|
||||
```
|
||||
|
||||
{% table %}
|
||||
@@ -28,13 +28,18 @@ import.meta.resolveSync("zod")
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.env`
|
||||
- An alias to `process.env`.
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.file`
|
||||
- The name of the current file, e.g. `index.tsx`
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.path`
|
||||
- Absolute path to the current file, e.g. `/path/to/project/index.tx`. Equivalent to `__filename` in CommonJS modules (and Node.js)
|
||||
- Absolute path to the current file, e.g. `/path/to/project/index.ts`. Equivalent to `__filename` in CommonJS modules (and Node.js)
|
||||
|
||||
---
|
||||
|
||||
@@ -43,30 +48,22 @@ import.meta.resolveSync("zod")
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.url`
|
||||
- A string url to the current file, e.g. `file:///path/to/project/index.tx`
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.main`
|
||||
- `boolean` Indicates whether the current file is the entrypoint to the current `bun` process. Is the file being directly executed by `bun run` or is it being imported?
|
||||
- Indicates whether the current file is the entrypoint to the current `bun` process. Is the file being directly executed by `bun run` or is it being imported?
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.env`
|
||||
- An alias to `process.env`.
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.resolve{Sync}`
|
||||
- Resolve a module specifier (e.g. `"zod"` or `"./file.tsx"`) to an absolute path. While file would be imported if the specifier were imported from this file?
|
||||
- `import.meta.resolve`
|
||||
- Resolve a module specifier (e.g. `"zod"` or `"./file.tsx"`) to a url. Equivalent to [`import.meta.resolve` in browsers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta#resolve)
|
||||
|
||||
```ts
|
||||
import.meta.resolveSync("zod");
|
||||
// => "/path/to/project/node_modules/zod/index.ts"
|
||||
|
||||
import.meta.resolveSync("./file.tsx");
|
||||
// => "/path/to/project/file.tsx"
|
||||
import.meta.resolve("zod");
|
||||
// => "file:///path/to/project/node_modules/zod/index.ts"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
- `import.meta.url`
|
||||
- A `string` url to the current file, e.g. `file:///path/to/project/index.ts`. Equivalent to [`import.meta.url` in browsers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta#url)
|
||||
|
||||
{% /table %}
|
||||
|
||||
@@ -186,6 +186,7 @@ proc.unref();
|
||||
## Inter-process communication (IPC)
|
||||
|
||||
Bun supports direct inter-process communication channel between two `bun` processes. To receive messages from a spawned Bun subprocess, specify an `ipc` handler.
|
||||
|
||||
{%callout%}
|
||||
**Note** — This API is only compatible with other `bun` processes. Use `process.execPath` to get a path to the currently running `bun` executable.
|
||||
{%/callout%}
|
||||
@@ -227,8 +228,6 @@ process.on("message", (message) => {
|
||||
});
|
||||
```
|
||||
|
||||
All messages are serialized using the JSC `serialize` API, which allows for the same set of [transferrable types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects) supported by `postMessage` and `structuredClone`, including strings, typed arrays, streams, and objects.
|
||||
|
||||
```ts#child.ts
|
||||
// send a string
|
||||
process.send("Hello from child as string");
|
||||
@@ -237,6 +236,11 @@ process.send("Hello from child as string");
|
||||
process.send({ message: "Hello from child as object" });
|
||||
```
|
||||
|
||||
The `ipcMode` option controls the underlying communication format between the two processes:
|
||||
|
||||
- `advanced`: (default) Messages are serialized using the JSC `serialize` API, which supports cloning [everything `structuredClone` supports](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm). This does not support transferring ownership of objects.
|
||||
- `json`: Messages are serialized using `JSON.stringify` and `JSON.parse`, which does not support as many object types as `advanced` does.
|
||||
|
||||
## Blocking API (`Bun.spawnSync()`)
|
||||
|
||||
Bun provides a synchronous equivalent of `Bun.spawn` called `Bun.spawnSync`. This is a blocking API that supports the same inputs and parameters as `Bun.spawn`. It returns a `SyncSubprocess` object, which differs from `Subprocess` in a few ways.
|
||||
|
||||
@@ -62,7 +62,7 @@ const db = new Database("mydb.sqlite", { create: true });
|
||||
You can also use an import attribute to load a database.
|
||||
|
||||
```ts
|
||||
import db from "./mydb.sqlite" with {"type": "sqlite"};
|
||||
import db from "./mydb.sqlite" with { "type": "sqlite" };
|
||||
|
||||
console.log(db.query("select * from users LIMIT 1").get());
|
||||
```
|
||||
@@ -74,16 +74,39 @@ import { Database } from "bun:sqlite";
|
||||
const db = new Database("./mydb.sqlite");
|
||||
```
|
||||
|
||||
### `.close()`
|
||||
### `.close(throwOnError: boolean = false)`
|
||||
|
||||
To close a database:
|
||||
To close a database connection, but allow existing queries to finish, call `.close(false)`:
|
||||
|
||||
```ts
|
||||
const db = new Database();
|
||||
db.close();
|
||||
// ... do stuff
|
||||
db.close(false);
|
||||
```
|
||||
|
||||
Note: `close()` is called automatically when the database is garbage collected. It is safe to call multiple times but has no effect after the first.
|
||||
To close the database and throw an error if there are any pending queries, call `.close(true)`:
|
||||
|
||||
```ts
|
||||
const db = new Database();
|
||||
// ... do stuff
|
||||
db.close(true);
|
||||
```
|
||||
|
||||
Note: `close(false)` is called automatically when the database is garbage collected. It is safe to call multiple times but has no effect after the first.
|
||||
|
||||
### `using` statement
|
||||
|
||||
You can use the `using` statement to ensure that a database connection is closed when the `using` block is exited.
|
||||
|
||||
```ts
|
||||
import { Database } from "bun:sqlite";
|
||||
|
||||
{
|
||||
using db = new Database("mydb.sqlite");
|
||||
using query = db.query("select 'Hello world' as message;");
|
||||
console.log(query.get()); // => { message: "Hello world" }
|
||||
}
|
||||
```
|
||||
|
||||
### `.serialize()`
|
||||
|
||||
@@ -128,6 +151,8 @@ db.exec("PRAGMA journal_mode = WAL;");
|
||||
|
||||
{% details summary="What is WAL mode" %}
|
||||
In WAL mode, writes to the database are written directly to a separate file called the "WAL file" (write-ahead log). This file will be later integrated into the main database file. Think of it as a buffer for pending writes. Refer to the [SQLite docs](https://www.sqlite.org/wal.html) for a more detailed overview.
|
||||
|
||||
On macOS, WAL files may be persistent by default. This is not a bug, it is how macOS configured the system version of SQLite.
|
||||
{% /details %}
|
||||
|
||||
## Statements
|
||||
@@ -387,6 +412,25 @@ db.loadExtension("myext");
|
||||
|
||||
{% /details %}
|
||||
|
||||
### .fileControl(cmd: number, value: any)
|
||||
|
||||
To use the advanced `sqlite3_file_control` API, call `.fileControl(cmd, value)` on your `Database` instance.
|
||||
|
||||
```ts
|
||||
import { Database, constants } from "bun:sqlite";
|
||||
|
||||
const db = new Database();
|
||||
// Ensure WAL mode is NOT persistent
|
||||
// this prevents wal files from lingering after the database is closed
|
||||
db.fileControl(constants.SQLITE_FCNTL_PERSIST_WAL, 0);
|
||||
```
|
||||
|
||||
`value` can be:
|
||||
|
||||
- `number`
|
||||
- `TypedArray`
|
||||
- `undefined` or `null`
|
||||
|
||||
## Reference
|
||||
|
||||
```ts
|
||||
|
||||
125
docs/api/udp.md
Normal file
125
docs/api/udp.md
Normal file
@@ -0,0 +1,125 @@
|
||||
Use Bun's UDP API to implement services with advanced real-time requirements, such as voice chat.
|
||||
|
||||
## Bind a UDP socket (`Bun.udpSocket()`)
|
||||
|
||||
To create a new (bound) UDP socket:
|
||||
|
||||
```ts
|
||||
const socket = await Bun.udpSocket({})
|
||||
console.log(socket.port); // assigned by the operating system
|
||||
```
|
||||
|
||||
Specify a port:
|
||||
```ts
|
||||
const socket = await Bun.udpSocket({
|
||||
port: 41234
|
||||
})
|
||||
console.log(socket.port); // 41234
|
||||
```
|
||||
|
||||
### Send a datagram
|
||||
|
||||
Specify the data to send, as well as the destination port and address.
|
||||
|
||||
```ts
|
||||
socket.send("Hello, world!", 41234, "127.0.0.1");
|
||||
```
|
||||
|
||||
Note that the address must be a valid IP address - `send` does not perform
|
||||
DNS resolution, as it is intended for low-latency operations.
|
||||
|
||||
|
||||
### Receive datagrams
|
||||
|
||||
When creating your socket, add a callback to specify what should be done when packets are received:
|
||||
|
||||
```ts
|
||||
const server = await Bun.udpSocket({
|
||||
socket: {
|
||||
data(socket, buf, port, addr) {
|
||||
console.log(`message from ${addr}:${port}:`)
|
||||
console.log(buf.toString());
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const client = await Bun.udpSocket({});
|
||||
client.send("Hello!", server.port, "127.0.0.1");
|
||||
```
|
||||
|
||||
### Connections
|
||||
|
||||
While UDP does not have a concept of a connection, many UDP communications (especially as a client) involve only one peer.
|
||||
In such cases it can be beneficial to connect the socket to that peer, which specifies to which address all packets are sent
|
||||
and restricts incoming packets to that peer only.
|
||||
|
||||
```ts
|
||||
|
||||
const server = await Bun.udpSocket({
|
||||
socket: {
|
||||
data(socket, buf, port, addr) {
|
||||
console.log(`message from ${addr}:${port}:`)
|
||||
console.log(buf.toString());
|
||||
}
|
||||
}
|
||||
})
|
||||
const client = await Bun.udpSocket({
|
||||
connect: {
|
||||
port: server.port,
|
||||
hostname: '127.0.0.1',
|
||||
}
|
||||
});
|
||||
|
||||
client.send("Hello");
|
||||
|
||||
```
|
||||
|
||||
Because connections are implemented on the operating system level, you can potentially observe performance benefits, too.
|
||||
|
||||
|
||||
### Send many packets at once using `sendMany()`
|
||||
|
||||
If you want to send a large volume of packets at once, it can make sense to batch them all together to avoid the overhead
|
||||
of making a system call for each. This is made possible by the `sendMany()` API:
|
||||
|
||||
For an unconnected socket, `sendMany` takes an array as its only argument. Each set of three array elements describes a packet:
|
||||
The first item is the data to be sent, the second is the target port, and the last is the target address.
|
||||
|
||||
```ts
|
||||
const socket = await Bun.udpSocket({})
|
||||
// sends 'Hello' to 127.0.0.1:41234, and 'foo' to 1.1.1.1:53 in a single operation
|
||||
socket.sendMany(['Hello', 41234, '127.0.0.1', 'foo', 53, '1.1.1.1'])
|
||||
```
|
||||
|
||||
With a connected socket, `sendMany` simply takes an array, where each element represents the data to be sent to the peer.
|
||||
|
||||
```ts
|
||||
const socket = await Bun.udpSocket({
|
||||
connect: {
|
||||
port: 41234,
|
||||
hostname: 'localhost',
|
||||
}
|
||||
});
|
||||
socket.sendMany(['foo', 'bar', 'baz']);
|
||||
```
|
||||
|
||||
`sendMany` returns the number of packets that were successfully sent. As with `send`, `sendMany` only takes valid IP addresses
|
||||
as destinations, as it does not perform DNS resolution.
|
||||
|
||||
### Handle backpressure
|
||||
|
||||
It may happen that a packet that you're sending does not fit into the operating system's packet buffer. You can detect that this
|
||||
has happened when:
|
||||
- `send` returns `false`
|
||||
- `sendMany` returns a number smaller than the number of packets you specified
|
||||
In this case, the `drain` socket handler will be called once the socket becomes writable again:
|
||||
|
||||
```ts
|
||||
const socket = await Bun.udpSocket({
|
||||
socket: {
|
||||
drain(socket) {
|
||||
// continue sending data
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
@@ -635,7 +635,7 @@ Bun.resolveSync("zod", "/path/to/project");
|
||||
// => "/path/to/project/node_modules/zod/index.ts"
|
||||
```
|
||||
|
||||
To resolve relative to the current working directory, pass `process.cwd` or `"."` as the root.
|
||||
To resolve relative to the current working directory, pass `process.cwd()` or `"."` as the root.
|
||||
|
||||
```ts
|
||||
Bun.resolveSync("./foo.ts", process.cwd());
|
||||
|
||||
@@ -23,7 +23,7 @@ Bun.serve({
|
||||
if (server.upgrade(req)) {
|
||||
return; // do not return a Response
|
||||
}
|
||||
return new Response("Upgrade failed :(", { status: 500 });
|
||||
return new Response("Upgrade failed", { status: 500 });
|
||||
},
|
||||
websocket: {}, // handlers
|
||||
});
|
||||
|
||||
@@ -21,21 +21,76 @@ Hello world!
|
||||
|
||||
All imported files and packages are bundled into the executable, along with a copy of the Bun runtime. All built-in Bun and Node.js APIs are supported.
|
||||
|
||||
{% callout %}
|
||||
## Cross-compile to other platforms
|
||||
|
||||
**Note** — Currently, the `--compile` flag can only accept a single entrypoint at a time and does not support the following flags:
|
||||
The `--target` flag lets you compile your standalone executable for a different operating system, architecture, or version of Bun than the machine you're running `bun build` on.
|
||||
|
||||
- `--outdir` — use `outfile` instead.
|
||||
- `--splitting`
|
||||
- `--public-path`
|
||||
To build for Linux x64 (most servers):
|
||||
|
||||
{% /callout %}
|
||||
```sh
|
||||
bun build --compile --target=bun-linux-x64 ./index.ts --outfile myapp
|
||||
|
||||
# To support CPUs from before 2013, use the baseline version (nehalem)
|
||||
bun build --compile --target=bun-linux-x64-baseline ./index.ts --outfile myapp
|
||||
|
||||
# To explicitly only support CPUs from 2013 and later, use the modern version (haswell)
|
||||
# modern is faster, but baseline is more compatible.
|
||||
bun build --compile --target=bun-linux-x64-modern ./index.ts --outfile myapp
|
||||
```
|
||||
|
||||
To build for Linux ARM64 (e.g. Graviton or Raspberry Pi):
|
||||
|
||||
```sh
|
||||
# Note: the default architecture is x64 if no architecture is specified.
|
||||
bun build --compile --target=bun-linux-arm64 ./index.ts --outfile myapp
|
||||
```
|
||||
|
||||
To build for Windows x64:
|
||||
|
||||
```sh
|
||||
bun build --compile --target=bun-windows-x64 ./path/to/my/app.ts --outfile myapp
|
||||
|
||||
# To support CPUs from before 2013, use the baseline version (nehalem)
|
||||
bun build --compile --target=bun-windows-x64-baseline ./path/to/my/app.ts --outfile myapp
|
||||
|
||||
# To explicitly only support CPUs from 2013 and later, use the modern version (haswell)
|
||||
bun build --compile --target=bun-windows-x64-modern ./path/to/my/app.ts --outfile myapp
|
||||
|
||||
# note: if no .exe extension is provided, Bun will automatically add it for Windows executables
|
||||
```
|
||||
|
||||
To build for macOS arm64:
|
||||
|
||||
```sh
|
||||
bun build --compile --target=bun-darwin-arm64 ./path/to/my/app.ts --outfile myapp
|
||||
```
|
||||
|
||||
To build for macOS x64:
|
||||
|
||||
```sh
|
||||
bun build --compile --target=bun-darwin-x64 ./path/to/my/app.ts --outfile myapp
|
||||
```
|
||||
|
||||
#### Supported targets
|
||||
|
||||
The order of the `--target` flag does not matter, as long as they're delimited by a `-`.
|
||||
|
||||
| --target | Operating System | Architecture | Modern | Baseline |
|
||||
| --------------------- | ---------------- | ------------ | ------ | -------- |
|
||||
| bun-linux-x64 | Linux | x64 | ✅ | ✅ |
|
||||
| bun-linux-arm64 | Linux | arm64 | ✅ | N/A |
|
||||
| bun-windows-x64 | Windows | x64 | ✅ | ✅ |
|
||||
| ~~bun-windows-arm64~~ | Windows | arm64 | ❌ | ❌ |
|
||||
| bun-darwin-x64 | macOS | x64 | ✅ | ✅ |
|
||||
| bun-darwin-arm64 | macOS | arm64 | ✅ | N/A |
|
||||
|
||||
On x64 platforms, Bun uses SIMD optimizations which require a modern CPU supporting AVX2 instructions. The `-baseline` build of Bun is for older CPUs that don't support these optimizations. Normally, when you install Bun we automatically detect which version to use but this can be harder to do when cross-compiling since you might not know the target CPU. You usually don't need to worry about it on Darwin x64, but it is relevant for Windows x64 and Linux x64. If you or your users see `"Illegal instruction"` errors, you might need to use the baseline version.
|
||||
|
||||
## Deploying to production
|
||||
|
||||
Compiled executables reduce memory usage and improve Bun's start time.
|
||||
|
||||
Normally, Bun reads and transpiles JavaScript and TypeScript files on `import` and `require`. This is part of what makes so much of Bun "just work", but it's not free. It costs time and memory to read files from disk, resolve file paths, parse, transpile, and print source code.
|
||||
Normally, Bun reads and transpiles JavaScript and TypeScript files on `import` and `require`. This is part of what makes so much of Bun "just work", but it's not free. It costs time and memory to read files from disk, resolve file paths, parse, transpile, and print source code.
|
||||
|
||||
With compiled executables, you can move that cost from runtime to build-time.
|
||||
|
||||
@@ -58,7 +113,7 @@ You can use `bun:sqlite` imports with `bun build --compile`.
|
||||
By default, the database is resolved relative to the current working directory of the process.
|
||||
|
||||
```js
|
||||
import db from './my.db' with {type: "sqlite"};
|
||||
import db from "./my.db" with { type: "sqlite" };
|
||||
|
||||
console.log(db.query("select * from users LIMIT 1").get());
|
||||
```
|
||||
@@ -70,42 +125,49 @@ $ cd /home/me/Desktop
|
||||
$ ./hello
|
||||
```
|
||||
|
||||
## Embedding files
|
||||
## Embed assets & files
|
||||
|
||||
Standalone executables support embedding files.
|
||||
|
||||
To embed files into an executable with `bun build --compile`, import the file in your code
|
||||
|
||||
```js
|
||||
```ts
|
||||
// this becomes an internal file path
|
||||
import icon from "./icon.png";
|
||||
|
||||
import icon from "./icon.png" with { type: "file" };
|
||||
import { file } from "bun";
|
||||
|
||||
export default {
|
||||
fetch(req) {
|
||||
// Embedded files can be streamed from Response objects
|
||||
return new Response(file(icon));
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
You may need to specify a `--loader` for it to be treated as a `"file"` loader (so you get back a file path).
|
||||
|
||||
Embedded files can be read using `Bun.file`'s functions or the Node.js `fs.readFile` function (in `"node:fs"`).
|
||||
|
||||
### Embedding SQLite databases
|
||||
For example, to read the contents of the embedded file:
|
||||
|
||||
```js
|
||||
import icon from "./icon.png" with { type: "file" };
|
||||
import { file } from "bun";
|
||||
|
||||
const bytes = await file(icon).arrayBuffer();
|
||||
```
|
||||
|
||||
### Embed SQLite databases
|
||||
|
||||
If your application wants to embed a SQLite database, set `type: "sqlite"` in the import attribute and the `embed` attribute to `"true"`.
|
||||
|
||||
```js
|
||||
import myEmbeddedDb from "./my.db" with {type: "sqlite", embed: "true"};
|
||||
import myEmbeddedDb from "./my.db" with { type: "sqlite", embed: "true" };
|
||||
|
||||
console.log(myEmbeddedDb.query("select * from users LIMIT 1").get());
|
||||
```
|
||||
|
||||
This database is read-write, but all changes are lost when the executable exits (since it's stored in memory).
|
||||
|
||||
### Embedding N-API Addons
|
||||
### Embed N-API Addons
|
||||
|
||||
As of Bun v1.0.23, you can embed `.node` files into executables.
|
||||
|
||||
@@ -120,3 +182,14 @@ Unfortunately, if you're using `@mapbox/node-pre-gyp` or other similar tools, yo
|
||||
## Minification
|
||||
|
||||
To trim down the size of the executable a little, pass `--minify` to `bun build --compile`. This uses Bun's minifier to reduce the code size. Overall though, Bun's binary is still way too big and we need to make it smaller.
|
||||
|
||||
## Unsupported CLI arguments
|
||||
|
||||
Currently, the `--compile` flag can only accept a single entrypoint at a time and does not support the following flags:
|
||||
|
||||
- `--outdir` — use `outfile` instead.
|
||||
- `--splitting`
|
||||
- `--public-path`
|
||||
- `--target=node` or `--target=browser`
|
||||
- `--format` - always outputs a binary executable. Internally, it's almost esm.
|
||||
- `--no-bundle` - we always bundle everything into the executable.
|
||||
|
||||
@@ -156,7 +156,7 @@ Like the Bun runtime, the bundler supports an array of file types out of the box
|
||||
---
|
||||
|
||||
- `.js` `.jsx`, `.cjs` `.mjs` `.mts` `.cts` `.ts` `.tsx`
|
||||
- Uses Bun's built-in transpiler to parse the file and transpile TypeScript/JSX syntax to vanilla JavaScript. The bundler executes a set of default transforms, including dead code elimination, tree shaking, and environment variable inlining. At the moment Bun does not attempt to down-convert syntax; if you use recently ECMAScript syntax, that will be reflected in the bundled code.
|
||||
- Uses Bun's built-in transpiler to parse the file and transpile TypeScript/JSX syntax to vanilla JavaScript. The bundler executes a set of default transforms including dead code elimination and tree shaking. At the moment Bun does not attempt to down-convert syntax; if you use recently ECMAScript syntax, that will be reflected in the bundled code.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Bun uses the file extension to determine which built-in _loader_ should be used
|
||||
|
||||
**JavaScript**. Default for `.cjs` and `.mjs`.
|
||||
|
||||
Parses the code and applies a set of default transforms, like dead-code elimination, tree shaking, and environment variable inlining. Note that Bun does not attempt to down-convert syntax at the moment.
|
||||
Parses the code and applies a set of default transforms like dead-code elimination and tree shaking. Note that Bun does not attempt to down-convert syntax at the moment.
|
||||
|
||||
### `jsx`
|
||||
|
||||
@@ -80,6 +80,9 @@ TOML files can be directly imported. Bun will parse them with its fast native TO
|
||||
```ts
|
||||
import config from "./bunfig.toml";
|
||||
config.logLevel; // => "debug"
|
||||
|
||||
// via import attribute:
|
||||
// import myCustomTOML from './my.config' with {type: "toml"};
|
||||
```
|
||||
|
||||
During bundling, the parsed TOML is inlined into the bundle as a JavaScript object.
|
||||
@@ -122,6 +125,10 @@ Text files can be directly imported. The file is read and returned as a string.
|
||||
```ts
|
||||
import contents from "./file.txt";
|
||||
console.log(contents); // => "Hello, world!"
|
||||
|
||||
// To import an html file as text
|
||||
// The "type' attribute can be used to override the default loader.
|
||||
import html from "./index.html" with { type: "text" };
|
||||
```
|
||||
|
||||
When referenced during a build, the contents are into the bundle as a string.
|
||||
@@ -175,10 +182,10 @@ In the bundler, `.node` files are handled using the [`file`](#file) loader.
|
||||
|
||||
**SQLite loader**. `with { "type": "sqlite" }` import attribute
|
||||
|
||||
In the runtime and bundler, SQLite databases can be directly imported. This will load the database using [`bun:sqlite`](/docs/api/sqlite.md).
|
||||
In the runtime and bundler, SQLite databases can be directly imported. This will load the database using [`bun:sqlite`](/docs/api/sqlite).
|
||||
|
||||
```ts
|
||||
import db from "./my.db" with {type: "sqlite"};
|
||||
import db from "./my.db" with { type: "sqlite" };
|
||||
```
|
||||
|
||||
This is only supported when the `target` is `bun`.
|
||||
@@ -189,21 +196,21 @@ You can change this behavior with the `"embed"` attribute:
|
||||
|
||||
```ts
|
||||
// embed the database into the bundle
|
||||
import db from "./my.db" with {type: "sqlite", embed: "true"};
|
||||
import db from "./my.db" with { type: "sqlite", embed: "true" };
|
||||
```
|
||||
|
||||
When using a [standalone executable](/docs/bundler/executables), the database is embedded into the single-file executable.
|
||||
|
||||
Otherwise, the database to embed is copied into the `outdir` with a hashed filename.
|
||||
|
||||
### `bunshell` loader
|
||||
### `sh` loader
|
||||
|
||||
**Bun Shell loader**. Default for `.bun.sh` files
|
||||
**Bun Shell loader**. Default for `.sh` files
|
||||
|
||||
This loader is used to parse [Bun Shell](/docs/runtime/shell) scripts. It's only supported when starting bun itself, so it's not available in the bundler or in the runtime.
|
||||
This loader is used to parse [Bun Shell](/docs/runtime/shell) scripts. It's only supported when starting Bun itself, so it's not available in the bundler or in the runtime.
|
||||
|
||||
```sh
|
||||
$ bun run ./script.bun.sh
|
||||
$ bun run ./script.sh
|
||||
```
|
||||
|
||||
### `file`
|
||||
|
||||
@@ -207,8 +207,8 @@ After cloning a template, `bun create` will automatically remove the `"bun-creat
|
||||
|
||||
---
|
||||
|
||||
- `GITHUB_ACCESS_TOKEN`
|
||||
- This lets `bun create` work with private repositories or if you get rate-limited
|
||||
- `GITHUB_TOKEN` (or `GITHUB_ACCESS_TOKEN`)
|
||||
- This lets `bun create` work with private repositories or if you get rate-limited. `GITHUB_TOKEN` is chosen over `GITHUB_ACCESS_TOKEN` if both exist.
|
||||
|
||||
{% /table %}
|
||||
|
||||
|
||||
@@ -77,4 +77,4 @@ Bun automatically loads environment variables from `.env` files before running a
|
||||
2. `NODE_ENV` === `"production"` ? `.env.production` : `.env.development`
|
||||
3. `.env`
|
||||
|
||||
To debug environment variables, run `bun run env` to view a list of resolved environment variables. -->
|
||||
To debug environment variables, run `bun --print process.env` to view a list of resolved environment variables. -->
|
||||
|
||||
58
docs/cli/filter.md
Normal file
58
docs/cli/filter.md
Normal file
@@ -0,0 +1,58 @@
|
||||
Use the `--filter` flag to execute lifecycle scripts in multiple packages at once:
|
||||
|
||||
```bash
|
||||
bun --filter <pattern> <script>
|
||||
```
|
||||
|
||||
Say you have a monorepo with two packages: `packages/api` and `packages/frontend`, both with a `dev` script that will start a local development server. Normally, you would have to open two separate terminal tabs, cd into each package directory, and run `bun dev`:
|
||||
|
||||
```bash
|
||||
cd packages/api
|
||||
bun dev
|
||||
|
||||
# in another terminal
|
||||
cd packages/frontend
|
||||
bun dev
|
||||
```
|
||||
|
||||
Using `--filter`, you can run the `dev` script in both packages at once:
|
||||
|
||||
```bash
|
||||
bun --filter '*' dev
|
||||
```
|
||||
|
||||
Both commands will be run in parallel, and you will see a nice terminal UI showing their respective outputs:
|
||||

|
||||
|
||||
|
||||
## Matching
|
||||
|
||||
`--filter` accepts a pattern to match specific packages, either by name or by path. Patterns have full support for glob syntax.
|
||||
|
||||
### Package Name `--filter <pattern>`
|
||||
|
||||
Name patterns select packages based on the package name, as specified in `package.json`. For example, if you have packages `pkga`, `pkgb` and `other`, you can match all packages with `*`, only `pkga` and `pkgb` with `pkg*`, and a specific package by providing the full name of the package.
|
||||
|
||||
### Package Path `--filter ./<glob>`
|
||||
|
||||
Path patterns are specified by starting the pattern with `./`, and will select all packages in directories that match the pattern. For example, to match all packages in subdirectories of `packages`, you can use `--filter './packages/**'`. To match a package located in `pkgs/foo`, use `--filter ./pkgs/foo`.
|
||||
|
||||
## Workspaces
|
||||
|
||||
Filters respect your [workspace configuration](/docs/install/workspaces): If you have a `package.json` file that specifies which packages are part of the workspace,
|
||||
`--filter` will be restricted to only these packages. Also, in a workspace you can use `--filter` to run scripts in packages that are located anywhere in the workspace:
|
||||
|
||||
```bash
|
||||
# Packages
|
||||
# src/foo
|
||||
# src/bar
|
||||
|
||||
# in src/bar: runs myscript in src/foo, no need to cd!
|
||||
bun run --filter foo myscript
|
||||
```
|
||||
|
||||
## Dependency Order
|
||||
Bun will respect package dependency order when running scripts. Say you have a package `foo` that depends on another package `bar` in your workspace, and both packages have a `build` script. When you run `bun --filter '*' build`, you will notice that `foo` will only start running once `bar` is done.
|
||||
|
||||
### Cyclic Dependencies
|
||||
|
||||
@@ -151,6 +151,19 @@ By default, Bun respects this shebang and executes the script with `node`. Howev
|
||||
$ bun run --bun vite
|
||||
```
|
||||
|
||||
### Filtering
|
||||
|
||||
in monorepos containing multiple packages, you can use the `--filter` argument to execute scripts in many packages at once.
|
||||
|
||||
Use `bun run --filter <name_pattern> <script>` to execute `<script>` in all packages whose name matches `<name_pattern>`.
|
||||
For example, if you have subdirectories containing packages named `foo`, `bar` and `baz`, running
|
||||
```bash
|
||||
bun run --filter 'ba*' <script>
|
||||
```
|
||||
will execute `<script>` in both `bar` and `baz`, but not in `foo`.
|
||||
|
||||
Find more details in the docs page for [filter](/docs/cli/filter).
|
||||
|
||||
## `bun run -` to pipe code from stdin
|
||||
|
||||
`bun run -` lets you read JavaScript, TypeScript, TSX, or JSX from stdin and execute it without writing to a temporary file first.
|
||||
|
||||
@@ -77,7 +77,7 @@ coverage*
|
||||
|
||||
---
|
||||
|
||||
We'll now use `docker build` to convert this `Dockerfile` into a _Docker image_, is a self-contained template containing all the dependencies and configuration required to run the application.
|
||||
We'll now use `docker build` to convert this `Dockerfile` into a _Docker image_, a self-contained template containing all the dependencies and configuration required to run the application.
|
||||
|
||||
The `-t` flag lets us specify a name for the image, and `--pull` tells Docker to automatically download the latest version of the base image (`oven/bun`). The initial build will take longer, as Docker will download all the base images and dependencies.
|
||||
|
||||
|
||||
55
docs/guides/ecosystem/neon-serverless-postgres.md
Normal file
55
docs/guides/ecosystem/neon-serverless-postgres.md
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
name: Use Neon's Serverless Postgres with Bun
|
||||
---
|
||||
|
||||
[Neon](https://neon.tech/) is a fully managed serverless Postgres. Neon separates compute and storage to offer modern developer features such as autoscaling, branching, bottomless storage, and more.
|
||||
|
||||
---
|
||||
|
||||
Get started by creating a project directory, initializing the directory using `bun init`, and adding the [Neon serverless driver](https://github.com/neondatabase/serverless/) as a project dependency.
|
||||
|
||||
```sh
|
||||
$ mkdir bun-neon-postgres
|
||||
$ cd bun-neon-postgres
|
||||
$ bun init -y
|
||||
$ bun add @neondatabase/serverless
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Create a `.env.local` file and add your [Neon Postgres connection string](https://neon.tech/docs/connect/connect-from-any-app) to it.
|
||||
|
||||
```sh
|
||||
DATBASE_URL=postgresql://username:password@ep-adj-noun-guid.us-east-1.aws.neon.tech/neondb?sslmode=require
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Paste the following code into your project's `index.ts` file.
|
||||
|
||||
```ts
|
||||
import { neon } from "@neondatabase/serverless";
|
||||
|
||||
// Bun automatically loads the DATABASE_URL from .env.local
|
||||
// Refer to: https://bun.sh/docs/runtime/env for more information
|
||||
const sql = neon(process.env.DATABASE_URL);
|
||||
|
||||
const rows = await sql`SELECT version()`;
|
||||
|
||||
console.log(rows[0].version);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Start the program using `bun ./index.ts`. The Postgres version should be printed to the console.
|
||||
|
||||
```sh
|
||||
$ bun ./index.ts
|
||||
PostgreSQL 16.2 on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
This example used the Neon serverless driver's SQL-over-HTTP functionality. Neon's serverless driver also exposes `Client` and `Pool` constructors to enable sessions, interactive transactions, and node-postgres compatibility.
|
||||
|
||||
Refer to [Neon's documentation](https://neon.tech/docs/serverless/serverless-driver) for a complete overview of the serverless driver.
|
||||
24
docs/guides/http/proxy.md
Normal file
24
docs/guides/http/proxy.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
name: Proxy HTTP requests using fetch()
|
||||
---
|
||||
|
||||
In Bun, `fetch` supports sending requests through an HTTP or HTTPS proxy. This is useful on corporate networks or when you need to ensure a request is sent through a specific IP address.
|
||||
|
||||
```ts
|
||||
await fetch("https://example.com", {
|
||||
// The URL of the proxy server
|
||||
proxy: "https://username:password@proxy.example.com:8080",
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
The `proxy` option is a URL string that specifies the proxy server. It can include the username and password if the proxy requires authentication. It can be `http://` or `https://`.
|
||||
|
||||
---
|
||||
|
||||
You can also set the `$HTTP_PROXY` or `$HTTPS_PROXY` environment variable to the proxy URL. This is useful when you want to use the same proxy for all requests.
|
||||
|
||||
```sh
|
||||
HTTPS_PROXY=https://username:password@proxy.example.com:8080 bun run index.ts
|
||||
```
|
||||
47
docs/guides/http/stream-iterator.md
Normal file
47
docs/guides/http/stream-iterator.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
name: Streaming HTTP Server with Async Iterators
|
||||
---
|
||||
|
||||
In Bun, [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) objects can accept an async generator function as their body. This allows you to stream data to the client as it becomes available, rather than waiting for the entire response to be ready.
|
||||
|
||||
```ts
|
||||
Bun.serve({
|
||||
port: 3000,
|
||||
fetch(req) {
|
||||
return new Response(
|
||||
// An async generator function
|
||||
async function* () {
|
||||
yield "Hello, ";
|
||||
await Bun.sleep(100);
|
||||
yield "world!";
|
||||
|
||||
// you can also yield a TypedArray or Buffer
|
||||
yield new Uint8Array(["\n".charCodeAt(0)]);
|
||||
},
|
||||
{ headers: { "Content-Type": "text/plain" } },
|
||||
);
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
You can pass any async iterable directly to `Response`:
|
||||
|
||||
```ts
|
||||
Bun.serve({
|
||||
port: 3000,
|
||||
fetch(req) {
|
||||
return new Response(
|
||||
{
|
||||
[Symbol.asyncIterator]: async function* () {
|
||||
yield "Hello, ";
|
||||
await Bun.sleep(100);
|
||||
yield "world!";
|
||||
},
|
||||
},
|
||||
{ headers: { "Content-Type": "text/plain" } },
|
||||
);
|
||||
},
|
||||
});
|
||||
```
|
||||
20
docs/guides/http/stream-node-streams-in-bun.md
Normal file
20
docs/guides/http/stream-node-streams-in-bun.md
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Streaming HTTP Server with Node.js Streams
|
||||
---
|
||||
|
||||
In Bun, [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) objects can accept a Node.js [`Readable`](https://nodejs.org/api/stream.html#stream_readable_streams).
|
||||
|
||||
This works because Bun's `Response` object allows any async iterable as its body. Node.js streams are async iterables, so you can pass them directly to `Response`.
|
||||
|
||||
```ts
|
||||
import { Readable } from "stream";
|
||||
import { serve } from "bun";
|
||||
serve({
|
||||
port: 3000,
|
||||
fetch(req) {
|
||||
return new Response(Readable.from(["Hello, ", "world!"]), {
|
||||
headers: { "Content-Type": "text/plain" },
|
||||
});
|
||||
},
|
||||
});
|
||||
```
|
||||
@@ -26,7 +26,7 @@ password = "$NPM_PASSWORD"
|
||||
|
||||
---
|
||||
|
||||
Then assign your Azure Personal Access Token to the the `NPM_PASSWORD` environment variable. Bun [automatically reads](/docs/runtime/env) `.env` files, so create a file called `.env` in your project root. There is no need to base-64 encode this token! Bun will do this for you.
|
||||
Then assign your Azure Personal Access Token to the `NPM_PASSWORD` environment variable. Bun [automatically reads](/docs/runtime/env) `.env` files, so create a file called `.env` in your project root. There is no need to base-64 encode this token! Bun will do this for you.
|
||||
|
||||
```txt#.env
|
||||
NPM_PASSWORD=<paste token here>
|
||||
|
||||
@@ -19,7 +19,9 @@ If you are seeing one of the following errors, you are probably trying to use a
|
||||
|
||||
To tell Bun to allow lifecycle scripts for a particular package, add the package to `trustedDependencies` in your package.json.
|
||||
|
||||
{% callout %}
|
||||
Note that this only allows lifecycle scripts for the specific package listed in `trustedDependencies`, _not_ the dependencies of that dependency!
|
||||
{% /callout %}
|
||||
|
||||
<!-- Bun maintains an allow-list of popular packages containing `postinstall` scripts that are known to be safe. To run lifecycle scripts for packages that aren't on this list, add the package to `trustedDependencies` in your package.json. -->
|
||||
|
||||
@@ -43,8 +45,4 @@ $ bun install
|
||||
|
||||
---
|
||||
|
||||
Note that this only allows lifecycle scripts for the specific package listed in `trustedDependencies`, _not_ the dependencies of that dependency!
|
||||
|
||||
---
|
||||
|
||||
See [Docs > Package manager > Trusted dependencies](/docs/install/lifecycle) for complete documentation of trusted dependencies.
|
||||
|
||||
145
docs/guides/runtime/define-constant.md
Normal file
145
docs/guides/runtime/define-constant.md
Normal file
@@ -0,0 +1,145 @@
|
||||
---
|
||||
name: Define and replace static globals & constants
|
||||
---
|
||||
|
||||
The `--define` flag lets you declare statically-analyzable constants and globals. It replace all usages of an identifier or property in a JavaScript or TypeScript file with a constant value. This feature is supported at runtime and also in `bun build`. This is sort of similar to `#define` in C/C++, except for JavaScript.
|
||||
|
||||
```ts
|
||||
bun --define:process.env.NODE_ENV="'production'" src/index.ts # Runtime
|
||||
bun build --define:process.env.NODE_ENV="'production'" src/index.ts # Build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
These statically-known values are used by Bun for dead code elimination and other optimizations.
|
||||
|
||||
```ts
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
console.log("Production mode");
|
||||
} else {
|
||||
console.log("Development mode");
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Before the code reaches the JavaScript engine, Bun replaces `process.env.NODE_ENV` with `"production"`.
|
||||
|
||||
```ts
|
||||
if ("production" === "production") {
|
||||
console.log("Production mode");
|
||||
} else {
|
||||
console.log("Development mode");
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
It doesn't stop there. Bun's optimizing transpiler is smart enough to do some basic constant folding.
|
||||
|
||||
Since `"production" === "production"` is always `true`, Bun replaces the entire expression with the `true` value.
|
||||
|
||||
```ts
|
||||
if (true) {
|
||||
console.log("Production mode");
|
||||
} else {
|
||||
console.log("Development mode");
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
And finally, Bun detects the `else` branch is not reachable, and eliminates it.
|
||||
|
||||
```ts
|
||||
console.log("Production mode");
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## What types of values are supported?
|
||||
|
||||
Values can be strings, identifiers, properties, or JSON.
|
||||
|
||||
### Replace global identifiers
|
||||
|
||||
To make all usages of `window` be `undefined`, you can use the following command.
|
||||
|
||||
```sh
|
||||
bun --define window="undefined" src/index.ts
|
||||
```
|
||||
|
||||
This can be useful when Server-Side Rendering (SSR) or when you want to make sure that the code doesn't depend on the `window` object.
|
||||
|
||||
```js
|
||||
if (typeof window !== "undefined") {
|
||||
console.log("Client-side code");
|
||||
} else {
|
||||
console.log("Server-side code");
|
||||
}
|
||||
```
|
||||
|
||||
You can also set the value to be another identifier. For example, to make all usages of `global` be `globalThis`, you can use the following command.
|
||||
|
||||
```sh
|
||||
bun --define global="globalThis" src/index.ts
|
||||
```
|
||||
|
||||
`global` is a global object in Node.js, but not in web browsers. So, you can use this to fix some cases where the code assumes that `global` is available.
|
||||
|
||||
### Replace values with JSON
|
||||
|
||||
`--define` can also be used to replace values with JSON objects and arrays.
|
||||
|
||||
To replace all usages of `AWS` with the JSON object `{"ACCESS_KEY":"abc","SECRET_KEY":"def"}`, you can use the following command.
|
||||
|
||||
```sh
|
||||
# JSON
|
||||
bun --define:AWS='{"ACCESS_KEY":"abc","SECRET_KEY":"def"}' src/index.ts
|
||||
```
|
||||
|
||||
Those will be transformed into the equivalent JavaScript code.
|
||||
|
||||
From:
|
||||
|
||||
```ts
|
||||
console.log(AWS.ACCESS_KEY); // => "abc"
|
||||
```
|
||||
|
||||
To:
|
||||
|
||||
```ts
|
||||
console.log("abc");
|
||||
```
|
||||
|
||||
### Replace values with other properties
|
||||
|
||||
You can also pass properties to the `--define` flag.
|
||||
|
||||
For example, to replace all usages of `console.write` with `console.log`, you can use the following command (requires Bun v1.1.5 or later)
|
||||
|
||||
```sh
|
||||
bun --define:console.write=console.log src/index.ts
|
||||
```
|
||||
|
||||
That transforms the following input:
|
||||
|
||||
```ts
|
||||
console.write("Hello, world!");
|
||||
```
|
||||
|
||||
Into the following output:
|
||||
|
||||
```ts
|
||||
console.log("Hello, world!");
|
||||
```
|
||||
|
||||
## How is this different than setting a variable?
|
||||
|
||||
You can also set `process.env.NODE_ENV` to `"production"` in your code, but that won't help with dead code elimination. In JavaScript, property accesses can have side effects. Getters & setters can be functions, and even dynamically defined (due to prototype chains and Proxy). Even if you set `process.env.NODE_ENV` to `"production"`, on the next line, it is not safe for static analysis tools to assume that `process.env.NODE_ENV`is`"production"`.
|
||||
|
||||
## How is this different than find-and-replace or string replacement?
|
||||
|
||||
The `--define` flag operates on the AST (Abstract Syntax Tree) level, not on the text level. It happens during the transpilation process, which means it can be used in optimizations like dead code elimination.
|
||||
|
||||
String replacement tools tend to have escaping issues and replace unintended parts of the code.
|
||||
15
docs/guides/runtime/import-html.md
Normal file
15
docs/guides/runtime/import-html.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
name: Import HTML file as text
|
||||
---
|
||||
|
||||
To import a `.html` file in Bun as a text file, use the `type: "text"` attribute in the import statement.
|
||||
|
||||
```ts
|
||||
import html from "./file.html" with { type: "text" };
|
||||
|
||||
console.log(html); // <!DOCTYPE html><html><head>...
|
||||
```
|
||||
|
||||
This can also be used with hot module reloading and/or watch mode to force Bun to reload whenever the `./file.html` file changes.
|
||||
|
||||
This feature was added in Bun v1.1.5.
|
||||
@@ -18,10 +18,10 @@ Bun.env.API_TOKEN; // => "secret"
|
||||
|
||||
---
|
||||
|
||||
To print all currently-set environment variables to the command line, run `bun run env`. This is useful for debugging.
|
||||
To print all currently-set environment variables to the command line, run `bun --print process.env`. This is useful for debugging.
|
||||
|
||||
```sh
|
||||
$ bun run env
|
||||
$ bun --print process.env
|
||||
BAZ=stuff
|
||||
FOOBAR=aaaaaa
|
||||
<lots more lines>
|
||||
|
||||
11
docs/guides/streams/node-readable-to-arraybuffer.md
Normal file
11
docs/guides/streams/node-readable-to-arraybuffer.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
name: Convert a Node.js Readable to an ArrayBuffer
|
||||
---
|
||||
|
||||
To convert a Node.js `Readable` stream to an `ArrayBuffer` in Bun, you can create a new `Response` object with the stream as the body, then use `arrayBuffer()` to read the stream into an `ArrayBuffer`.
|
||||
|
||||
```ts
|
||||
import { Readable } from "stream";
|
||||
const stream = Readable.from(["Hello, ", "world!"]);
|
||||
const buf = await new Response(stream).arrayBuffer();
|
||||
```
|
||||
11
docs/guides/streams/node-readable-to-blob.md
Normal file
11
docs/guides/streams/node-readable-to-blob.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
name: Convert a Node.js Readable to a Blob
|
||||
---
|
||||
|
||||
To convert a Node.js `Readable` stream to a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) in Bun, you can create a new [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) object with the stream as the body, then use [`response.blob()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/blob) to read the stream into a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).
|
||||
|
||||
```ts
|
||||
import { Readable } from "stream";
|
||||
const stream = Readable.from(["Hello, ", "world!"]);
|
||||
const blob = await new Response(stream).blob();
|
||||
```
|
||||
12
docs/guides/streams/node-readable-to-json.md
Normal file
12
docs/guides/streams/node-readable-to-json.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
name: Convert a Node.js Readable to JSON
|
||||
---
|
||||
|
||||
To convert a Node.js `Readable` stream to a JSON object in Bun, you can create a new [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) object with the stream as the body, then use [`response.json()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json) to read the stream into a JSON object.
|
||||
|
||||
```ts
|
||||
import { Readable } from "stream";
|
||||
const stream = Readable.from([JSON.stringify({ hello: "world" })]);
|
||||
const json = await new Response(stream).json();
|
||||
console.log(json); // { hello: "world" }
|
||||
```
|
||||
12
docs/guides/streams/node-readable-to-string.md
Normal file
12
docs/guides/streams/node-readable-to-string.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
name: Convert a Node.js Readable to a string
|
||||
---
|
||||
|
||||
To convert a Node.js `Readable` stream to a string in Bun, you can create a new [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) object with the stream as the body, then use [`response.text()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/text) to read the stream into a string.
|
||||
|
||||
```ts
|
||||
import { Readable } from "stream";
|
||||
const stream = Readable.from([Buffer.from("Hello, world!")]);
|
||||
const text = await new Response(stream).text();
|
||||
console.log(text); // "Hello, world!"
|
||||
```
|
||||
@@ -4,7 +4,7 @@ name: Migrate from Jest to Bun's test runner
|
||||
|
||||
In many cases, Bun's test runner can run Jest test suites with no code changes. Just run `bun test` instead of `npx jest`, `yarn test`, etc.
|
||||
|
||||
```sh-diff
|
||||
```sh
|
||||
- $ npx jest
|
||||
- $ yarn test
|
||||
+ $ bun test
|
||||
@@ -57,7 +57,7 @@ Replace `bail` in your Jest config with the `--bail` CLI flag.
|
||||
- };
|
||||
``` -->
|
||||
|
||||
```sh-diff
|
||||
```sh
|
||||
$ bun test --bail 3
|
||||
```
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ In the root `package.json`, the `"workspaces"` key is used to indicate which sub
|
||||
```
|
||||
|
||||
{% callout %}
|
||||
**Glob support** — Bun supports simple `<directory>/*` globs in `"workspaces"`. Full glob syntax (e.g. `**` and `?`) is not yet supported.
|
||||
**Glob support** — Bun supports full glob syntax in `"workspaces"` (see [here](/docs/api/glob#supported-glob-patterns) for a comprehensive list of supported syntax), _except_ for exclusions (e.g. `!**/excluded/**`), which are not implemented yet.
|
||||
{% /callout %}
|
||||
|
||||
Each workspace has it's own `package.json` When referencing other packages in the monorepo, use `"workspace:*"` as the version field in your `package.json`.
|
||||
@@ -61,6 +61,7 @@ Workspaces have a couple major benefits.
|
||||
|
||||
- **Code can be split into logical parts.** If one package relies on another, you can simply add it as a dependency in `package.json`. If package `b` depends on `a`, `bun install` will install your local `packages/a` directory into `node_modules` instead of downloading it from the npm registry.
|
||||
- **Dependencies can be de-duplicated.** If `a` and `b` share a common dependency, it will be _hoisted_ to the root `node_modules` directory. This reduces redundant disk usage and minimizes "dependency hell" issues associated with having multiple versions of a package installed simultaneously.
|
||||
- **Run scripts in multiple packages.** You can use the [`--filter` flag](/docs/cli/filter) to easily run `package.json` scripts in multiple packages in your workspace.
|
||||
|
||||
{% callout %}
|
||||
⚡️ **Speed** — Installs are fast, even for big monorepos. Bun installs the [Remix](https://github.com/remix-run/remix) monorepo in about `500ms` on Linux.
|
||||
|
||||
@@ -42,21 +42,20 @@ $ proto install bun
|
||||
Bun requires a minimum of Windows 10 version 1809
|
||||
{% /callout %}
|
||||
|
||||
Bun provides a _limited, experimental_ native build for Windows. It is recommended to use Bun within [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) and follow the above instructions. To help catch bugs, the experimental build enables many debugging assertions, which will make the binary slower than what the stable version will be.
|
||||
|
||||
To install, paste this into a terminal:
|
||||
|
||||
{% codetabs %}
|
||||
|
||||
```powershell#PowerShell/cmd.exe
|
||||
# WARNING: No stability is guaranteed on the experimental Windows builds
|
||||
powershell -c "irm bun.sh/install.ps1|iex"
|
||||
> powershell -c "irm bun.sh/install.ps1|iex"
|
||||
```
|
||||
|
||||
```powershell#npm
|
||||
> npm install -g bun # the last `npm` command you'll ever need
|
||||
```
|
||||
|
||||
```powershell#Scoop
|
||||
# WARNING: No stability is guaranteed on the experimental Windows builds
|
||||
scoop bucket add versions
|
||||
scoop install bun-canary
|
||||
> scoop install bun
|
||||
```
|
||||
|
||||
{% /codetabs %}
|
||||
@@ -145,6 +144,8 @@ $ bun upgrade
|
||||
{% callout %}
|
||||
**Homebrew users** — To avoid conflicts with Homebrew, use `brew upgrade bun` instead.
|
||||
|
||||
**Scoop users** — To avoid conflicts with Scoop, use `scoop upgrade bun` instead.
|
||||
|
||||
**proto users** - Use `proto install bun --pin` instead.
|
||||
{% /callout %}
|
||||
|
||||
@@ -233,10 +234,14 @@ $ rm -rf ~/.bun # for macOS, Linux, and WSL
|
||||
```
|
||||
|
||||
```powershell#Windows
|
||||
powershell -c ~\.bun\uninstall.ps1
|
||||
> powershell -c ~\.bun\uninstall.ps1
|
||||
```
|
||||
|
||||
```bash#NPM
|
||||
```powershell#Scoop
|
||||
> scoop uninstall bun
|
||||
```
|
||||
|
||||
```bash#npm
|
||||
$ npm uninstall -g bun
|
||||
```
|
||||
|
||||
|
||||
@@ -180,6 +180,9 @@ export default {
|
||||
page("install/lifecycle", "Lifecycle scripts", {
|
||||
description: "How Bun handles package lifecycle scripts with trustedDependencies",
|
||||
}),
|
||||
page("cli/filter", "Filter", {
|
||||
description: "Run scripts in multiple packages in parallel",
|
||||
}),
|
||||
page("install/lockfile", "Lockfile", {
|
||||
description:
|
||||
"Bun's binary lockfile `bun.lockb` tracks your resolved dependency tree, making future installs fast and repeatable.",
|
||||
@@ -306,6 +309,9 @@ export default {
|
||||
page("api/tcp", "TCP sockets", {
|
||||
description: `Bun's native API implements Web-standard TCP Sockets, plus a Bun-native API for building fast TCP servers.`,
|
||||
}), // "`Bun.{listen|connect}`")
|
||||
page("api/udp", "UDP sockets", {
|
||||
description: `Bun's native API implements fast and flexible UDP sockets.`,
|
||||
}), // "`Bun.udpSocket`")
|
||||
page("api/globals", "Globals", {
|
||||
description: `Bun implements a range of Web APIs, Node.js APIs, and Bun-native APIs that are available in the global scope.`,
|
||||
}), // "`Bun.write`"),
|
||||
|
||||
@@ -39,7 +39,7 @@ I recommend using VSCode through SSH instead of Tunnels or the Tailscale extensi
|
||||
By default, running unverified scripts are blocked.
|
||||
|
||||
```ps1
|
||||
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
|
||||
> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
|
||||
```
|
||||
|
||||
### System Dependencies
|
||||
@@ -47,7 +47,7 @@ Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
|
||||
- Bun 1.1 or later. We use Bun to run it's own code generators.
|
||||
|
||||
```ps1
|
||||
irm bun.sh/install.ps1 | iex
|
||||
> irm bun.sh/install.ps1 | iex
|
||||
```
|
||||
|
||||
- [Visual Studio](https://visualstudio.microsoft.com) with the "Desktop Development with C++" workload.
|
||||
@@ -70,28 +70,28 @@ The Zig compiler is automatically downloaded, installed, and updated by the buil
|
||||
[Scoop](https://scoop.sh) can be used to install these remaining tools easily:
|
||||
|
||||
```ps1
|
||||
irm https://get.scoop.sh | iex
|
||||
|
||||
scoop install nodejs-lts go rust nasm ruby perl
|
||||
scoop llvm@16.0.4 # scoop bug if you install llvm and the rest at the same time
|
||||
> irm https://get.scoop.sh | iex
|
||||
> scoop install nodejs-lts go rust nasm ruby perl
|
||||
# scoop seems to be buggy if you install llvm and the rest at the same time
|
||||
> scoop install llvm@16.0.6
|
||||
```
|
||||
|
||||
If you intend on building WebKit locally (optional), you should install these packages:
|
||||
|
||||
```ps1
|
||||
scoop install make cygwin python
|
||||
> scoop install make cygwin python
|
||||
```
|
||||
|
||||
From here on out, it is **expected you use a PowerShell Terminal with `.\scripts\env.ps1` sourced**. This script is available in the Bun repository and can be loaded by executing it:
|
||||
|
||||
```ps1
|
||||
.\scripts\env.ps1
|
||||
> .\scripts\env.ps1
|
||||
```
|
||||
|
||||
To verify, you can check for an MSVC-only command line such as `mt.exe`
|
||||
|
||||
```ps1
|
||||
Get-Command mt
|
||||
> Get-Command mt
|
||||
```
|
||||
|
||||
{% callout %}
|
||||
@@ -101,24 +101,24 @@ It is not recommended to install `ninja` / `cmake` into your global path, becaus
|
||||
## Building
|
||||
|
||||
```ps1
|
||||
bun install
|
||||
> bun install
|
||||
|
||||
.\scripts\env.ps1
|
||||
.\scripts\update-submodules.ps1 # this syncs git submodule state
|
||||
.\scripts\all-dependencies.ps1 # this builds all dependencies
|
||||
.\scripts\make-old-js.ps1 # runs some old code generators
|
||||
> .\scripts\env.ps1
|
||||
> .\scripts\update-submodules.ps1 # this syncs git submodule state
|
||||
> .\scripts\all-dependencies.ps1 # this builds all dependencies
|
||||
> .\scripts\make-old-js.ps1 # runs some old code generators
|
||||
|
||||
# Configure build environment
|
||||
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug
|
||||
> cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug
|
||||
|
||||
# Build bun
|
||||
ninja -Cbuild
|
||||
> ninja -Cbuild
|
||||
```
|
||||
|
||||
If this was successful, you should have a `bun-debug.exe` in the `build` folder.
|
||||
|
||||
```ps1
|
||||
.\build\bun-debug.exe --revision
|
||||
> .\build\bun-debug.exe --revision
|
||||
```
|
||||
|
||||
You should add this to `$Env:PATH`. The simplest way to do so is to open the start menu, type "Path", and then navigate the environment variables menu to add `C:\.....\bun\build` to the user environment variable `PATH`. You should then restart your editor (if it does not update still, log out and log back in).
|
||||
@@ -134,15 +134,15 @@ You can run the test suite either using `bun test`, or by using the wrapper scri
|
||||
|
||||
```ps1
|
||||
# Setup
|
||||
bun i --cwd packages\bun-internal-test
|
||||
> bun i --cwd packages\bun-internal-test
|
||||
|
||||
# Run the entire test suite with reporter
|
||||
# the package.json script "test" uses "build/bun-debug.exe" by default
|
||||
bun run test
|
||||
> bun run test
|
||||
|
||||
# Run an individual test file:
|
||||
bun-debug test node\fs
|
||||
bun-debug test "C:\bun\test\js\bun\resolve\import-meta.test.js"
|
||||
> bun-debug test node\fs
|
||||
> bun-debug test "C:\bun\test\js\bun\resolve\import-meta.test.js"
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Configuring a development environment for Bun can take 10-30 minutes depending on your internet connection and computer speed. You will need ~10GB of free disk space for the repository and build artifacts.
|
||||
|
||||
If you are using Windows, you must use a WSL environment as Bun does not yet compile on Windows natively.
|
||||
If you are using Windows, please refer to [this guide](/docs/project/building-windows)
|
||||
|
||||
## Install Dependencies
|
||||
|
||||
@@ -53,7 +53,7 @@ $ brew install bun
|
||||
|
||||
## Install LLVM
|
||||
|
||||
Bun requires LLVM 16 and Clang 16 (`clang` is part of LLVM). This version requirement is to match WebKit (precompiled), as mismatching versions will cause memory allocation failures at runtime. In most cases, you can install LLVM through your system package manager:
|
||||
Bun requires LLVM 16 (`clang` is part of LLVM). This version requirement is to match WebKit (precompiled), as mismatching versions will cause memory allocation failures at runtime. In most cases, you can install LLVM through your system package manager:
|
||||
|
||||
{% codetabs %}
|
||||
|
||||
@@ -84,18 +84,19 @@ $ sudo zypper install clang16 lld16 llvm16
|
||||
|
||||
If none of the above solutions apply, you will have to install it [manually](https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.6).
|
||||
|
||||
Make sure LLVM 16 is in your path:
|
||||
Make sure Clang/LLVM 16 is in your path:
|
||||
|
||||
```bash
|
||||
$ which clang-16
|
||||
```
|
||||
|
||||
If not, run this to manually link it:
|
||||
If not, run this to manually add it:
|
||||
|
||||
{% codetabs %}
|
||||
|
||||
```bash#macOS (Homebrew)
|
||||
# use fish_add_path if you're using fish
|
||||
# use path+="$(brew --prefix llvm@16)/bin" if you are using zsh
|
||||
$ export PATH="$(brew --prefix llvm@16)/bin:$PATH"
|
||||
```
|
||||
|
||||
|
||||
@@ -98,10 +98,10 @@ Bun.env.API_TOKEN; // => "secret"
|
||||
import.meta.env.API_TOKEN; // => "secret"
|
||||
```
|
||||
|
||||
To print all currently-set environment variables to the command line, run `bun run env`. This is useful for debugging.
|
||||
To print all currently-set environment variables to the command line, run `bun --print process.env`. This is useful for debugging.
|
||||
|
||||
```sh
|
||||
$ bun run env
|
||||
$ bun --print process.env
|
||||
BAZ=stuff
|
||||
FOOBAR=aaaaaa
|
||||
<lots more lines>
|
||||
|
||||
@@ -18,7 +18,7 @@ This page is updated regularly to reflect compatibility status of the latest ver
|
||||
|
||||
### [`node:child_process`](https://nodejs.org/api/child_process.html)
|
||||
|
||||
🟡 Missing `Stream` stdio, `proc.gid` `proc.uid`. IPC has partial support and only current only works with other `bun` processes.
|
||||
🟡 Missing `Stream` stdio, `proc.gid` `proc.uid`. IPC cannot send socket handles and only works with other `bun` processes.
|
||||
|
||||
### [`node:cluster`](https://nodejs.org/api/cluster.html)
|
||||
|
||||
@@ -36,7 +36,8 @@ Some methods are not optimized yet.
|
||||
|
||||
### [`node:dgram`](https://nodejs.org/api/dgram.html)
|
||||
|
||||
🔴 Not implemented.
|
||||
🟡 Missing `setBroadcast` `setTTL` `setMulticastTTL` `setMulticastLoopback` `setMulticastInterface` `addMembership` `dropMembership`
|
||||
`addSourceSpecificMembership` `dropSourceSpecificMembership`
|
||||
|
||||
### [`node:diagnostics_channel`](https://nodejs.org/api/diagnostics_channel.html)
|
||||
|
||||
@@ -80,7 +81,7 @@ Some methods are not optimized yet.
|
||||
|
||||
### [`node:net`](https://nodejs.org/api/net.html)
|
||||
|
||||
🟡 Missing `BlockList` `SocketAddress` `Stream` `getDefaultAutoSelectFamily` `getDefaultAutoSelectFamilyAttemptTimeout` `setDefaultAutoSelectFamily` `setDefaultAutoSelectFamilyAttemptTimeout`
|
||||
🟡 Missing `SocketAddress` `Stream`. `BlockList` exists but is a no-op.
|
||||
|
||||
### [`node:os`](https://nodejs.org/api/os.html)
|
||||
|
||||
@@ -340,7 +341,7 @@ The table below lists all globals implemented by Node.js and Bun's current compa
|
||||
|
||||
### [`process`](https://nodejs.org/api/process.html)
|
||||
|
||||
🟡 Missing `domain` `hasUncaughtExceptionCaptureCallback` `initgroups` `resourceUsage` `setUncaughtExceptionCaptureCallback` `setegid` `seteuid` `setgid` `setgroups` `setuid` `allowedNodeEnvironmentFlags` `getActiveResourcesInfo` `setActiveResourcesInfo` `moduleLoadList` `setSourceMapsEnabled` `channel`. `process.binding` is partially implemented.
|
||||
🟡 Missing `domain` `hasUncaughtExceptionCaptureCallback` `initgroups` `setUncaughtExceptionCaptureCallback` `setegid` `seteuid` `setgid` `setgroups` `setuid` `allowedNodeEnvironmentFlags` `getActiveResourcesInfo` `setActiveResourcesInfo` `moduleLoadList` `setSourceMapsEnabled` `channel`. `process.binding` is partially implemented.
|
||||
|
||||
### [`queueMicrotask()`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask)
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
Bun Shell makes shell scripting with JavaScript & TypeScript fun. It's a cross-platform bash-like shell with seamless JavaScript interop.
|
||||
|
||||
{% callout type="note" %}
|
||||
**Alpha-quality software**: Bun Shell is an unstable API still under development. If you have feature requests or run into bugs, please open an issue. There may be breaking changes in the future.
|
||||
{% /callout %}
|
||||
|
||||
Quickstart:
|
||||
|
||||
```js
|
||||
@@ -23,6 +19,8 @@ await $`cat < ${response} | wc -c`; // 1256
|
||||
- **Template literals**: Template literals are used to execute shell commands. This allows for easy interpolation of variables and expressions.
|
||||
- **Safety**: Bun Shell escapes all strings by default, preventing shell injection attacks.
|
||||
- **JavaScript interop**: Use `Response`, `ArrayBuffer`, `Blob`, `Bun.file(path)` and other JavaScript objects as stdin, stdout, and stderr.
|
||||
- **Shell scripting**: Bun Shell can be used to run shell scripts (`.bun.sh` files).
|
||||
- **Custom interpreter**: Bun Shell is written in Zig, along with it's lexer, parser, and interpreter. Bun Shell is a small programming language.
|
||||
|
||||
## Getting started
|
||||
|
||||
@@ -53,16 +51,66 @@ const welcome = await $`echo "Hello World!"`.text();
|
||||
console.log(welcome); // Hello World!\n
|
||||
```
|
||||
|
||||
To get stdout, stderr, and the exit code, use await or `.run`:
|
||||
By default, `await`ing will return stdout and stderr as `Buffer`s.
|
||||
|
||||
```js
|
||||
import { $ } from "bun";
|
||||
|
||||
const { stdout, stderr, exitCode } = await $`echo "Hello World!"`.quiet();
|
||||
const { stdout, stderr } = await $`echo "Hello World!"`.quiet();
|
||||
|
||||
console.log(stdout); // Buffer(6) [ 72, 101, 108, 108, 111, 32 ]
|
||||
console.log(stderr); // Buffer(0) []
|
||||
console.log(exitCode); // 0
|
||||
```
|
||||
|
||||
## Error handling
|
||||
|
||||
By default, non-zero exit codes will throw an error. This `ShellError` contains information about the command run.
|
||||
|
||||
```js
|
||||
import { $ } from "bun";
|
||||
|
||||
try {
|
||||
const output = await $`something-that-may-fail`.text();
|
||||
console.log(output);
|
||||
} catch (err) {
|
||||
console.log(`Failed with code ${err.exitCode}`);
|
||||
console.log(err.stdout.toString());
|
||||
console.log(err.stderr.toString());
|
||||
}
|
||||
```
|
||||
|
||||
Throwing can be disabled with `.nothrow()`. The result's `exitCode` will need to be checked manually.
|
||||
|
||||
```js
|
||||
import { $ } from "bun";
|
||||
|
||||
const { stdout, stderr, exitCode } = await $`something-that-may-fail`
|
||||
.nothrow()
|
||||
.quiet();
|
||||
|
||||
if (exitCode !== 0) {
|
||||
console.log(`Non-zero exit code ${exitCode}`);
|
||||
}
|
||||
|
||||
console.log(stdout);
|
||||
console.log(stderr);
|
||||
```
|
||||
|
||||
The default handling of non-zero exit codes can be configured by calling `.nothrow()` or `.throws(boolean)` on the `$` function itself.
|
||||
|
||||
```js
|
||||
import { $ } from "bun";
|
||||
// shell promises will not throw, meaning you will have to
|
||||
// check for `exitCode` manually on every shell command.
|
||||
$.nothrow(); // equivilent to $.throws(false)
|
||||
|
||||
// default behavior, non-zero exit codes will throw an error
|
||||
$.throws(true);
|
||||
|
||||
// alias for $.nothrow()
|
||||
$.throws(false);
|
||||
|
||||
await $`something-that-may-fail`; // No exception thrown
|
||||
```
|
||||
|
||||
## Redirection
|
||||
@@ -89,9 +137,8 @@ To redirect stdout to a JavaScript object, use the `>` operator:
|
||||
import { $ } from "bun";
|
||||
|
||||
const buffer = Buffer.alloc(100);
|
||||
const result = await $`echo "Hello World!" > ${buffer}`;
|
||||
await $`echo "Hello World!" > ${buffer}`;
|
||||
|
||||
console.log(result.exitCode); // 0
|
||||
console.log(buffer.toString()); // Hello World!\n
|
||||
```
|
||||
|
||||
@@ -105,7 +152,7 @@ The following JavaScript objects are supported for redirection to:
|
||||
To redirect the output from JavaScript objects to stdin, use the `<` operator:
|
||||
|
||||
```js
|
||||
import { $, file } from "bun";
|
||||
import { $ } from "bun";
|
||||
|
||||
const response = new Response("hello i am a response body");
|
||||
|
||||
@@ -144,7 +191,7 @@ import { $ } from "bun";
|
||||
await $`bun run index.ts 2> errors.txt`;
|
||||
```
|
||||
|
||||
### Example: Redirect stdout -> stderr
|
||||
### Example: Redirect stderr -> stdout
|
||||
|
||||
```js
|
||||
import { $ } from "bun";
|
||||
@@ -154,7 +201,7 @@ import { $ } from "bun";
|
||||
await $`bun run ./index.ts 2>&1`;
|
||||
```
|
||||
|
||||
### Example: Redirect stderr -> stdout
|
||||
### Example: Redirect stdout -> stderr
|
||||
|
||||
```js
|
||||
import { $ } from "bun";
|
||||
@@ -352,6 +399,18 @@ For cross-platform compatibility, Bun Shell implements a set of builtin commands
|
||||
- `echo`: print text
|
||||
- `pwd`: print the working directory
|
||||
- `bun`: run bun in bun
|
||||
- `cat`
|
||||
- `touch`
|
||||
- `mkdir`
|
||||
- `which`
|
||||
- `mv`
|
||||
- `exit`
|
||||
- `true`
|
||||
- `false`
|
||||
- `yes`
|
||||
- `seq`
|
||||
- `dirname`
|
||||
- `basename`
|
||||
|
||||
**Partially** implemented:
|
||||
|
||||
@@ -359,9 +418,7 @@ For cross-platform compatibility, Bun Shell implements a set of builtin commands
|
||||
|
||||
**Not** implemented yet, but planned:
|
||||
|
||||
- `mkdir`: create directories
|
||||
- `cp`: copy files and directories
|
||||
- `cat`: concatenate files
|
||||
- See https://github.com/oven-sh/bun/issues/9716 for the full list.
|
||||
|
||||
## Utilities
|
||||
|
||||
@@ -404,24 +461,28 @@ await $`echo ${{ raw: '$(foo) `bar` "baz"' }}`;
|
||||
|
||||
For simple shell scripts, instead of `/bin/sh`, you can use Bun Shell to run shell scripts.
|
||||
|
||||
To do so, just run the script with `bun` on a file with the `.bun.sh` extension.
|
||||
To do so, just run the script with `bun` on a file with the `.sh` extension.
|
||||
|
||||
```sh#script.bun.sh
|
||||
```sh#script.sh
|
||||
echo "Hello World! pwd=$(pwd)"
|
||||
```
|
||||
|
||||
```sh
|
||||
$ bun ./script.bun.sh
|
||||
$ bun ./script.sh
|
||||
Hello World! pwd=/home/demo
|
||||
```
|
||||
|
||||
Scripts with Bun Shell are cross platform, which means they work on Windows:
|
||||
|
||||
```
|
||||
PS C:\Users\Demo> bun .\script.bun.sh
|
||||
```powershell
|
||||
> bun .\script.sh
|
||||
Hello World! pwd=C:\Users\Demo
|
||||
```
|
||||
|
||||
## Implementation notes
|
||||
|
||||
Bun Shell is a small programming language in Bun that is implemented in Zig. It includes a handwritten lexer, parser, and interpreter. Unlike bash, zsh, and other shells, Bun Shell runs operations concurrently.
|
||||
|
||||
## Credits
|
||||
|
||||
Large parts of this API were inspired by [zx](https://github.com/google/zx), [dax](https://github.com/dsherret/dax), and [bnx](https://github.com/wobsoriano/bnx). Thank you to the authors of those projects.
|
||||
|
||||
@@ -57,7 +57,7 @@ coverageThreshold = { lines = 0.9, functions = 0.9 }
|
||||
|
||||
### Sourcemaps
|
||||
|
||||
Internally, Bun transpiles all files by default, so Bun automatically generates an internal [source map](https://web.dev/source-maps/) that maps lines of your original source code onto Bun's internal representation. If for any reason you want to disable this, set `test.coverageIgnoreSourcemaps` to `false`; this will rarely be desirable outside of advanced use cases.
|
||||
Internally, Bun transpiles all files by default, so Bun automatically generates an internal [source map](https://web.dev/source-maps/) that maps lines of your original source code onto Bun's internal representation. If for any reason you want to disable this, set `test.coverageIgnoreSourcemaps` to `true`; this will rarely be desirable outside of advanced use cases.
|
||||
|
||||
```toml
|
||||
[test]
|
||||
|
||||
@@ -156,6 +156,8 @@ test.if(macOS)("runs on macOS", () => {
|
||||
});
|
||||
```
|
||||
|
||||
## `test.skipIf`
|
||||
|
||||
To instead skip a test based on some condition, use `test.skipIf()` or `describe.skipIf()`.
|
||||
|
||||
```ts
|
||||
@@ -166,16 +168,32 @@ test.skipIf(macOS)("runs on non-macOS", () => {
|
||||
});
|
||||
```
|
||||
|
||||
## `test.todoIf`
|
||||
|
||||
If instead you want to mark the test as TODO, use `test.todoIf()` or `describe.todoIf()`. Carefully choosing `skipIf` or `todoIf` can show a difference between, for example, intent of "invalid for this target" and "planned but not implemented yet."
|
||||
|
||||
```ts
|
||||
const macOS = process.arch === "darwin";
|
||||
|
||||
// TODO: we've only implemented this for Linux so far.
|
||||
test.todoIf(macOS)("runs on posix", () => {
|
||||
// runs if *not* macOS
|
||||
});
|
||||
```
|
||||
|
||||
## `test.each`
|
||||
|
||||
To return a function for multiple cases in a table of tests, use `test.each`.
|
||||
|
||||
```ts
|
||||
const cases = [[1, 2, 3], [3, 4, 5]];
|
||||
const cases = [
|
||||
[1, 2, 3],
|
||||
[3, 4, 5],
|
||||
];
|
||||
|
||||
test.each(cases)("%p + %p should be %p", (a, b, expected) => {
|
||||
// runs once for each test case provided
|
||||
})
|
||||
// runs once for each test case provided
|
||||
});
|
||||
```
|
||||
|
||||
There are a number of options available for formatting the case label depending on its type.
|
||||
|
||||
18
misctools/bun-feature-data.ts
Normal file
18
misctools/bun-feature-data.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
let internal;
|
||||
try {
|
||||
internal = require("bun:internal-for-testing");
|
||||
} catch {
|
||||
const result = Bun.spawnSync({
|
||||
cmd: [process.execPath, import.meta.file],
|
||||
env: {
|
||||
...process.env,
|
||||
BUN_DEBUG_QUIET_LOGS: "1",
|
||||
BUN_GARBAGE_COLLECTOR_LEVEL: "0",
|
||||
BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "1",
|
||||
},
|
||||
});
|
||||
process.exit(result.exitCode);
|
||||
}
|
||||
if (internal) {
|
||||
console.log(JSON.stringify(internal.crash_handler.getFeatureData(), null, 2));
|
||||
}
|
||||
@@ -14,13 +14,13 @@ pub usingnamespace @import("root").bun;
|
||||
const clap = bun.clap;
|
||||
|
||||
const URL = @import("../src/url.zig").URL;
|
||||
const Headers = @import("root").bun.http.Headers;
|
||||
const Headers = bun.http.Headers;
|
||||
const Method = @import("../src/http/method.zig").Method;
|
||||
const ColonListType = @import("../src/cli/colon_list_type.zig").ColonListType;
|
||||
const HeadersTuple = ColonListType(string, noop_resolver);
|
||||
const path_handler = @import("../src/resolver/resolve_path.zig");
|
||||
const HTTPThread = @import("root").bun.http.HTTPThread;
|
||||
const HTTP = @import("root").bun.http;
|
||||
const HTTPThread = bun.http.HTTPThread;
|
||||
const HTTP = bun.http;
|
||||
fn noop_resolver(in: string) !string {
|
||||
return in;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ pub const Arguments = struct {
|
||||
}
|
||||
};
|
||||
|
||||
const HTTP = @import("root").bun.http;
|
||||
const HTTP = bun.http;
|
||||
const NetworkThread = HTTP.NetworkThread;
|
||||
|
||||
var stdout_: std.fs.File = undefined;
|
||||
|
||||
@@ -13,13 +13,13 @@ const C = bun.C;
|
||||
const clap = @import("../src/deps/zig-clap/clap.zig");
|
||||
|
||||
const URL = @import("../src/url.zig").URL;
|
||||
const Headers = @import("root").bun.http.Headers;
|
||||
const Headers = bun.http.Headers;
|
||||
const Method = @import("../src/http/method.zig").Method;
|
||||
const ColonListType = @import("../src/cli/colon_list_type.zig").ColonListType;
|
||||
const HeadersTuple = ColonListType(string, noop_resolver);
|
||||
const path_handler = @import("../src/resolver/resolve_path.zig");
|
||||
const NetworkThread = @import("root").bun.http.NetworkThread;
|
||||
const HTTP = @import("root").bun.http;
|
||||
const NetworkThread = bun.http.NetworkThread;
|
||||
const HTTP = bun.http;
|
||||
fn noop_resolver(in: string) !string {
|
||||
return in;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
"build:release": "cmake . -DCMAKE_BUILD_TYPE=Release -GNinja -Bbuild-release && ninja -Cbuild-release",
|
||||
"build:debug-zig-release": "cmake . -DCMAKE_BUILD_TYPE=Release -DZIG_OPTIMIZE=Debug -GNinja -Bbuild-debug-zig-release && ninja -Cbuild-debug-zig-release",
|
||||
"build:safe": "cmake . -DZIG_OPTIMIZE=ReleaseSafe -DUSE_DEBUG_JSC=ON -DCMAKE_BUILD_TYPE=Release -GNinja -Bbuild-safe && ninja -Cbuild-safe",
|
||||
"build:windows": "cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=Debug && ninja -Cbuild",
|
||||
"typecheck": "tsc --noEmit && cd test && bun run typecheck",
|
||||
"fmt": "prettier --write --cache './{.vscode,src,test,bench,packages/{bun-types,bun-inspector-*,bun-vscode,bun-debug-adapter-protocol}}/**/*.{mjs,ts,tsx,js,jsx}'",
|
||||
"fmt:zig": "zig fmt src/*.zig src/*/*.zig src/*/*/*.zig src/*/*/*/*.zig",
|
||||
"lint": "eslint './**/*.d.ts' --cache",
|
||||
"lint:fix": "eslint './**/*.d.ts' --cache --fix",
|
||||
"test": "node packages/bun-internal-test/src/runner.node.mjs ./build/bun-debug",
|
||||
"test:release": "node packages/bun-internal-test/src/runner.node.mjs ./build-release/bun",
|
||||
"update-known-failures": "node packages/bun-internal-test/src/update-known-windows-failures.mjs"
|
||||
"test:release": "node packages/bun-internal-test/src/runner.node.mjs ./build-release/bun"
|
||||
}
|
||||
}
|
||||
|
||||
13
packages/bun-internal-test/src/banned.json
Normal file
13
packages/bun-internal-test/src/banned.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
" != undefined": "This is by definition Undefined Behavior.",
|
||||
" == undefined": "This is by definition Undefined Behavior.",
|
||||
"@import(\"root\").bun.": "Only import 'bun' once",
|
||||
"std.debug.assert": "Use bun.assert instead",
|
||||
"std.debug.dumpStackTrace": "Use bun.handleErrorReturnTrace or bun.crash_handler.dumpStackTrace instead",
|
||||
"std.debug.print": "Don't let this be committed",
|
||||
"std.mem.indexOfAny": "Use bun.strings.indexAny or bun.strings.indexAnyComptime",
|
||||
"undefined != ": "This is by definition Undefined Behavior.",
|
||||
"undefined == ": "This is by definition Undefined Behavior.",
|
||||
"bun.toFD(std.fs.cwd().fd)": "Use bun.FD.cwd()",
|
||||
"": ""
|
||||
}
|
||||
72
packages/bun-internal-test/src/linter.ts
Normal file
72
packages/bun-internal-test/src/linter.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { $ } from "bun";
|
||||
import BANNED from "./banned.json";
|
||||
import * as action from "@actions/core";
|
||||
|
||||
const IGNORED_FOLDERS = [
|
||||
// list of folders to ignore
|
||||
"windows-shim",
|
||||
];
|
||||
|
||||
const ci = !!process.env["GITHUB_ACTIONS"];
|
||||
process.chdir(require("path").join(import.meta.dir, "../../../"));
|
||||
let bad = [];
|
||||
let report = "";
|
||||
const write = (text: string) => {
|
||||
process.stdout.write(text);
|
||||
report += text;
|
||||
};
|
||||
for (const [banned, suggestion] of Object.entries(BANNED)) {
|
||||
if (banned.length === 0) continue;
|
||||
// Run git grep to find occurrences of std.debug.assert in .zig files
|
||||
// .nothrow() is here since git will exit with non-zero if no matches are found.
|
||||
let stdout = await $`git grep -n -F "${banned}" "src/**/**.zig" | grep -v -F '//' | grep -v -F bench`
|
||||
.nothrow()
|
||||
.text();
|
||||
|
||||
stdout = stdout.trim();
|
||||
if (stdout.length === 0) continue;
|
||||
|
||||
let lines = stdout.split("\n");
|
||||
// Parse each line to extract filename and line number
|
||||
const matches = lines
|
||||
.filter(line => !IGNORED_FOLDERS.some(folder => line.includes(folder)))
|
||||
.map(line => {
|
||||
const [path, lineNumber, ...text] = line.split(":");
|
||||
return { path, lineNumber, banned, suggestion, text: text.join(":") };
|
||||
});
|
||||
// Check if we got any output
|
||||
// Split the output into lines
|
||||
if (matches.length === 0) continue;
|
||||
|
||||
write(`Banned **'${banned}'** found in the following locations:` + "\n");
|
||||
matches.forEach(match => {
|
||||
write(`${match.path}:${match.lineNumber}: ${match.text.trim()}` + "\n");
|
||||
});
|
||||
bad = bad.concat(matches);
|
||||
}
|
||||
|
||||
if (report.length === 0) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
function link({ path, lineNumber, suggestion, banned }) {
|
||||
action.error(`Lint failure: ${banned} is banned, ${suggestion}`, {
|
||||
file: path,
|
||||
startLine: Number(lineNumber),
|
||||
endLine: Number(lineNumber),
|
||||
});
|
||||
return `[\`${path}:${lineNumber}\`](https://github.com/oven-sh/bun/blob/${process.env.GITHUB_SHA}/${path}#L${lineNumber})`;
|
||||
}
|
||||
|
||||
if (ci) {
|
||||
if (report.length > 0) {
|
||||
action.setFailed(`${bad.length} lint failures`);
|
||||
}
|
||||
action.setOutput("count", bad.length);
|
||||
action.setOutput("text_output", bad.map(m => `- ${link(m)}: ${m.banned} is banned, ${m.suggestion}`).join("\n"));
|
||||
action.setOutput("json_output", JSON.stringify(bad));
|
||||
action.summary.addRaw(report);
|
||||
await action.summary.write();
|
||||
}
|
||||
|
||||
process.exit(1);
|
||||
@@ -1,11 +1,10 @@
|
||||
import * as action from "@actions/core";
|
||||
import { spawn, spawnSync } from "child_process";
|
||||
import { rmSync, writeFileSync, readFileSync, mkdirSync, openSync, close, closeSync } from "fs";
|
||||
import { readFile, rm } from "fs/promises";
|
||||
import { rmSync, writeFileSync, readFileSync, mkdirSync, openSync, closeSync } from "fs";
|
||||
import { readdirSync } from "node:fs";
|
||||
import { resolve, basename } from "node:path";
|
||||
import { constants, cpus, hostname, tmpdir, totalmem, userInfo } from "os";
|
||||
import { join, normalize } from "path";
|
||||
import { cpus, hostname, tmpdir, totalmem, userInfo } from "os";
|
||||
import { join, normalize, posix, relative } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import PQueue from "p-queue";
|
||||
|
||||
@@ -22,9 +21,7 @@ function defaultConcurrency() {
|
||||
|
||||
return Math.min(Math.floor((cpus().length - 2) / 2), 2);
|
||||
}
|
||||
|
||||
const windows = process.platform === "win32";
|
||||
const KEEP_TMPDIR = process.env["BUN_KEEP_TMPDIR"] === "1";
|
||||
const nativeMemory = totalmem();
|
||||
const force_ram_size_input = parseInt(process.env["BUN_JSC_forceRAMSize"] || "0", 10);
|
||||
let force_ram_size = Number(BigInt(nativeMemory) >> BigInt(2)) + "";
|
||||
@@ -147,8 +144,6 @@ function lookupWindowsError(code) {
|
||||
|
||||
const failing_tests = [];
|
||||
const passing_tests = [];
|
||||
const fixes = [];
|
||||
const regressions = [];
|
||||
let maxFd = -1;
|
||||
function getMaxFileDescriptor(path) {
|
||||
if (process.platform === "win32") {
|
||||
@@ -210,21 +205,15 @@ function checkSlowTests() {
|
||||
setInterval(checkSlowTests, SHORT_TIMEOUT_DURATION).unref();
|
||||
var currentTestNumber = 0;
|
||||
async function runTest(path) {
|
||||
const pathOnDisk = resolve(path);
|
||||
const thisTestNumber = currentTestNumber++;
|
||||
const name = path.replace(cwd, "").slice(1);
|
||||
const testFileName = posix.normalize(relative(cwd, path).replaceAll("\\", "/"));
|
||||
let exitCode, signal, err, output;
|
||||
|
||||
const expected_crash_reason = windows
|
||||
? await readFile(resolve(path), "utf-8").then(data => {
|
||||
const match = data.match(/@known-failing-on-windows:(.*)\n/);
|
||||
return match ? match[1].trim() : null;
|
||||
})
|
||||
: null;
|
||||
|
||||
const start = Date.now();
|
||||
|
||||
const activeTestObject = { start, proc: undefined };
|
||||
activeTests.set(path, activeTestObject);
|
||||
activeTests.set(testFileName, activeTestObject);
|
||||
|
||||
try {
|
||||
await new Promise((finish, reject) => {
|
||||
@@ -234,12 +223,12 @@ async function runTest(path) {
|
||||
at ${((start - run_start.getTime()) / 1000).toFixed(2)}s, file ${thisTestNumber
|
||||
.toString()
|
||||
.padStart(total.toString().length, "0")}/${total}, ${failing_tests.length} failing files
|
||||
Starting "${name}"
|
||||
Starting "${testFileName}"
|
||||
|
||||
`,
|
||||
);
|
||||
const TMPDIR = maketemp();
|
||||
const proc = spawn(bunExe, ["test", resolve(path)], {
|
||||
const proc = spawn(bunExe, ["test", pathOnDisk], {
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
env: {
|
||||
...process.env,
|
||||
@@ -249,6 +238,8 @@ Starting "${name}"
|
||||
BUN_RUNTIME_TRANSPILER_CACHE_PATH: "0",
|
||||
GITHUB_ACTIONS: process.env.GITHUB_ACTIONS ?? "true",
|
||||
BUN_DEBUG_QUIET_LOGS: "1",
|
||||
BUN_INSTALL_CACHE_DIR: join(TMPDIR, ".bun-install-cache"),
|
||||
BUN_ENABLE_CRASH_REPORTING: "1",
|
||||
[windows ? "TEMP" : "TMPDIR"]: TMPDIR,
|
||||
},
|
||||
});
|
||||
@@ -309,7 +300,7 @@ Starting "${name}"
|
||||
});
|
||||
});
|
||||
} finally {
|
||||
activeTests.delete(path);
|
||||
activeTests.delete(testFileName);
|
||||
}
|
||||
|
||||
if (!hasInitialMaxFD) {
|
||||
@@ -319,7 +310,7 @@ Starting "${name}"
|
||||
maxFd = getMaxFileDescriptor();
|
||||
if (maxFd > prevMaxFd + queue.concurrency * 2) {
|
||||
process.stderr.write(
|
||||
`\n\x1b[31mewarn\x1b[0;2m:\x1b[0m file descriptor leak in ${name}, delta: ${
|
||||
`\n\x1b[31mewarn\x1b[0;2m:\x1b[0m file descriptor leak in ${testFileName}, delta: ${
|
||||
maxFd - prevMaxFd
|
||||
}, current: ${maxFd}, previous: ${prevMaxFd}\n`,
|
||||
);
|
||||
@@ -370,8 +361,8 @@ Starting "${name}"
|
||||
|
||||
console.log(
|
||||
`\x1b[2m${formatTime(duration).padStart(6, " ")}\x1b[0m ${
|
||||
passed ? "\x1b[32m✔" : expected_crash_reason ? "\x1b[33m⚠" : "\x1b[31m✖"
|
||||
} ${name}\x1b[0m${reason ? ` (${reason})` : ""}`,
|
||||
passed ? "\x1b[32m✔" : "\x1b[31m✖"
|
||||
} ${testFileName}\x1b[0m${reason ? ` (${reason})` : ""}`,
|
||||
);
|
||||
|
||||
finished++;
|
||||
@@ -385,21 +376,11 @@ Starting "${name}"
|
||||
}
|
||||
|
||||
if (!passed) {
|
||||
if (reason) {
|
||||
if (windows && !expected_crash_reason) {
|
||||
regressions.push({ path: name, reason, output });
|
||||
}
|
||||
}
|
||||
|
||||
failing_tests.push({ path: name, reason, output, expected_crash_reason });
|
||||
failing_tests.push({ path: testFileName, reason, output });
|
||||
process.exitCode = 1;
|
||||
if (err) console.error(err);
|
||||
} else {
|
||||
if (windows && expected_crash_reason !== null) {
|
||||
fixes.push({ path: name, output, expected_crash_reason });
|
||||
}
|
||||
|
||||
passing_tests.push(name);
|
||||
passing_tests.push(testFileName);
|
||||
}
|
||||
|
||||
return passed;
|
||||
@@ -496,30 +477,6 @@ ${header}
|
||||
|
||||
`;
|
||||
|
||||
if (fixes.length > 0) {
|
||||
report += `## Fixes\n\n`;
|
||||
report += "The following tests had @known-failing-on-windows but now pass:\n\n";
|
||||
report += fixes
|
||||
.map(
|
||||
({ path, expected_crash_reason }) => `- [\`${path}\`](${sectionLink(path)}) (before: ${expected_crash_reason})`,
|
||||
)
|
||||
.join("\n");
|
||||
report += "\n\n";
|
||||
}
|
||||
|
||||
if (regressions.length > 0) {
|
||||
report += `## Regressions\n\n`;
|
||||
report += regressions
|
||||
.map(
|
||||
({ path, reason, expected_crash_reason }) =>
|
||||
`- [\`${path}\`](${sectionLink(path)}) ${reason}${
|
||||
expected_crash_reason ? ` (expected: ${expected_crash_reason})` : ""
|
||||
}`,
|
||||
)
|
||||
.join("\n");
|
||||
report += "\n\n";
|
||||
}
|
||||
|
||||
if (failingTestDisplay.length > 0) {
|
||||
report += `## Failing tests\n\n`;
|
||||
report += failingTestDisplay;
|
||||
@@ -534,21 +491,22 @@ if (failingTestDisplay.length > 0) {
|
||||
|
||||
if (failing_tests.length) {
|
||||
report += `## Failing tests log output\n\n`;
|
||||
for (const { path, output, reason, expected_crash_reason } of failing_tests) {
|
||||
for (const { path, output, reason } of failing_tests) {
|
||||
report += `### ${path}\n\n`;
|
||||
report += "[Link to file](" + linkToGH(path) + ")\n\n";
|
||||
if (windows && reason !== expected_crash_reason) {
|
||||
report += `To mark this as a known failing test, add this to the start of the file:\n`;
|
||||
report += `\`\`\`ts\n`;
|
||||
report += `// @known-failing-on-windows: ${reason}\n`;
|
||||
report += `\`\`\`\n\n`;
|
||||
} else {
|
||||
report += `${reason}\n\n`;
|
||||
}
|
||||
report += `${reason}\n\n`;
|
||||
report += "```\n";
|
||||
report += output
|
||||
|
||||
let failing_output = output
|
||||
.replace(/\x1b\[[0-9;]*m/g, "")
|
||||
.replace(/^::(group|endgroup|error|warning|set-output|add-matcher|remove-matcher).*$/gm, "");
|
||||
|
||||
if (failing_output.length > 1024 * 64) {
|
||||
failing_output = failing_output.slice(0, 1024 * 64) + `\n\n[truncated output (length: ${failing_output.length})]`;
|
||||
}
|
||||
|
||||
report += failing_output;
|
||||
|
||||
report += "```\n\n";
|
||||
}
|
||||
}
|
||||
@@ -559,35 +517,96 @@ writeFileSync(
|
||||
JSON.stringify({
|
||||
failing_tests,
|
||||
passing_tests,
|
||||
fixes,
|
||||
regressions,
|
||||
}),
|
||||
);
|
||||
|
||||
function mabeCapitalize(str) {
|
||||
str = str.toLowerCase();
|
||||
if (str.includes("arm64") || str.includes("aarch64")) {
|
||||
return str.toUpperCase();
|
||||
}
|
||||
|
||||
if (str.includes("x64")) {
|
||||
return "x64";
|
||||
}
|
||||
|
||||
if (str.includes("baseline")) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return str[0].toUpperCase() + str.slice(1);
|
||||
}
|
||||
|
||||
console.log("-> test-report.md, test-report.json");
|
||||
function linkify(text, url) {
|
||||
if (url?.startsWith?.("https://")) {
|
||||
return `[${text}](${url})`;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
if (ci) {
|
||||
if (windows) {
|
||||
action.setOutput("regressing_tests", regressions.map(({ path }) => `- \`${path}\``).join("\n"));
|
||||
action.setOutput("regressing_test_count", regressions.length);
|
||||
}
|
||||
if (failing_tests.length > 0) {
|
||||
action.setFailed(`${failing_tests.length} files with failing tests`);
|
||||
}
|
||||
action.setOutput("failing_tests", failingTestDisplay);
|
||||
action.setOutput("failing_tests_count", failing_tests.length);
|
||||
if (failing_tests.length) {
|
||||
const { env } = process;
|
||||
const tag = process.env.BUN_TAG || "unknown";
|
||||
const url = `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}`;
|
||||
|
||||
let comment = `## ${linkify(`${emojiTag(tag)}${failing_tests.length} failing tests`, url)} ${tag
|
||||
.split("-")
|
||||
.map(mabeCapitalize)
|
||||
.join(" ")}
|
||||
|
||||
${failingTestDisplay}
|
||||
|
||||
`;
|
||||
writeFileSync("comment.md", comment);
|
||||
}
|
||||
let truncated_report = report;
|
||||
if (truncated_report.length > 512 * 1000) {
|
||||
truncated_report = truncated_report.slice(0, 512 * 1000) + "\n\n...truncated...";
|
||||
}
|
||||
action.summary.addRaw(truncated_report);
|
||||
await action.summary.write();
|
||||
} else {
|
||||
if (windows && (regressions.length > 0 || fixes.length > 0)) {
|
||||
console.log(
|
||||
"\n\x1b[34mnote\x1b[0;2m:\x1b[0m If you would like to update the @known-failing-on-windows annotations, run `bun update-known-failures`",
|
||||
);
|
||||
}
|
||||
|
||||
function emojiTag(tag) {
|
||||
let emojiText = "";
|
||||
tag = tag.toLowerCase();
|
||||
if (tag.includes("win32") || tag.includes("windows")) {
|
||||
emojiText += "🪟";
|
||||
}
|
||||
|
||||
if (tag.includes("linux")) {
|
||||
emojiText += "🐧";
|
||||
}
|
||||
|
||||
if (tag.includes("macos") || tag.includes("darwin")) {
|
||||
emojiText += "";
|
||||
}
|
||||
|
||||
if (tag.includes("x86") || tag.includes("x64") || tag.includes("_64") || tag.includes("amd64")) {
|
||||
if (!tag.includes("linux")) {
|
||||
emojiText += "💻";
|
||||
} else {
|
||||
emojiText += "🖥";
|
||||
}
|
||||
}
|
||||
|
||||
if (tag.includes("arm64") || tag.includes("aarch64")) {
|
||||
emojiText += "💪";
|
||||
}
|
||||
|
||||
if (emojiText) {
|
||||
emojiText += " ";
|
||||
}
|
||||
|
||||
return emojiText;
|
||||
}
|
||||
|
||||
process.exit(failing_tests.length ? 1 : process.exitCode);
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
import assert from "assert";
|
||||
import { existsSync, readFileSync, writeFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
if (process.platform !== "win32") {
|
||||
console.log("This script is only intended to be run on Windows.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.chdir(join(fileURLToPath(import.meta.url), "../../../../"));
|
||||
|
||||
if (!existsSync("test-report.json")) {
|
||||
console.log("No test report found. Please run `bun run test` first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const test_report = JSON.parse(readFileSync("test-report.json", "utf8"));
|
||||
assert(Array.isArray(test_report.failing_tests));
|
||||
|
||||
for (const { path, reason, expected_crash_reason } of test_report.failing_tests) {
|
||||
assert(path);
|
||||
assert(reason);
|
||||
|
||||
if (expected_crash_reason !== reason) {
|
||||
const old_content = readFileSync(path, "utf8");
|
||||
if (!old_content.includes("// @known-failing-on-windows")) {
|
||||
let content = old_content.replace(/\/\/\s*@known-failing-on-windows:.*\n/, "");
|
||||
if (reason) {
|
||||
content = `// @known-failing-on-windows: ${reason}\n` + content;
|
||||
}
|
||||
writeFileSync(path, content, "utf8");
|
||||
console.log(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const { path } of test_report.fixes) {
|
||||
assert(path);
|
||||
|
||||
const old_content = readFileSync(path, "utf8");
|
||||
|
||||
let content = old_content.replace(/\/\/\s*@known-failing-on-windows:.*\n/, "");
|
||||
|
||||
if (content !== old_content) {
|
||||
writeFileSync(path, content, "utf8");
|
||||
console.log(path);
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,7 @@ export default function polyfillImportMeta(metaIn: ImportMeta) {
|
||||
dir: path.dirname(metapath),
|
||||
file: path.basename(metapath),
|
||||
require: require2,
|
||||
async resolve(id: string, parent?: string) {
|
||||
return this.resolveSync(id, parent);
|
||||
},
|
||||
resolve: metaIn.resolve,
|
||||
resolveSync(id: string, parent?: string) {
|
||||
return require2.resolve(id, {
|
||||
paths: typeof parent === 'string' ? [
|
||||
|
||||
14
packages/bun-release/.gitignore
vendored
14
packages/bun-release/.gitignore
vendored
@@ -1,6 +1,8 @@
|
||||
.DS_Store
|
||||
.env
|
||||
node_modules
|
||||
/npm/**/bin
|
||||
/npm/**/*.js
|
||||
/npm/**/.npmrc
|
||||
.DS_Store
|
||||
.env
|
||||
node_modules
|
||||
/npm/**/bin
|
||||
/npm/**/*.js
|
||||
/npm/**/package.json
|
||||
/npm/**/.npmrc
|
||||
*.tgz
|
||||
|
||||
Binary file not shown.
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "@oven/bun-darwin-aarch64",
|
||||
"version": "0.5.3",
|
||||
"description": "This is the macOS arm64 binary for Bun, a fast all-in-one JavaScript runtime.",
|
||||
"homepage": "https://bun.sh",
|
||||
"bugs": "https://github.com/oven-sh/issues",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/oven-sh/bun",
|
||||
"preferUnplugged": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"cpu": [
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "@oven/bun-darwin-x64-baseline",
|
||||
"version": "0.5.3",
|
||||
"description": "This is the macOS x64 binary for Bun, a fast all-in-one JavaScript runtime.",
|
||||
"homepage": "https://bun.sh",
|
||||
"bugs": "https://github.com/oven-sh/issues",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/oven-sh/bun",
|
||||
"preferUnplugged": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user