From 916b3340bc68fcbe6f4a608834e2ea08956d64c0 Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Tue, 16 Apr 2024 14:01:21 -0700 Subject: [PATCH 1/7] Testing workflows --- .github/actions/setup-bun/action.yml | 2 +- .github/workflows/build-darwin.yml | 302 +++++++++++ .github/workflows/build-linux.yml | 59 ++ .github/workflows/build-windows.yml | 322 +++++++++++ .github/workflows/build-zig.yml | 118 ++++ .github/workflows/bun-deploy-site.yml | 18 - .github/workflows/bun-linux-aarch64.yml | 142 ----- .github/workflows/bun-linux-build.yml | 319 ----------- .github/workflows/bun-mac-aarch64.yml | 481 ----------------- .github/workflows/bun-mac-x64-baseline.yml | 472 ---------------- .github/workflows/bun-mac-x64.yml | 467 ---------------- .github/workflows/bun-release-test.yml | 44 -- .github/workflows/bun-types-tests.yml | 41 -- .github/workflows/bun-windows.yml | 508 ------------------ .github/workflows/ci.yml | 199 +++++++ .github/workflows/docs.yml | 20 + .github/workflows/lint.yml | 86 --- .github/workflows/release-canary.yml | 49 ++ .../{bun-release.yml => release.yml} | 5 +- .../workflows/{format.yml => run-format.yml} | 32 +- .github/workflows/run-lint.yml | 27 + .github/workflows/run-test.yml | 124 +++++ Dockerfile | 115 ++-- .../bun-internal-test/src/runner.node.mjs | 1 + 24 files changed, 1324 insertions(+), 2629 deletions(-) create mode 100644 .github/workflows/build-darwin.yml create mode 100644 .github/workflows/build-linux.yml create mode 100644 .github/workflows/build-windows.yml create mode 100644 .github/workflows/build-zig.yml delete mode 100644 .github/workflows/bun-deploy-site.yml delete mode 100644 .github/workflows/bun-linux-aarch64.yml delete mode 100644 .github/workflows/bun-linux-build.yml delete mode 100644 .github/workflows/bun-mac-aarch64.yml delete mode 100644 .github/workflows/bun-mac-x64-baseline.yml delete mode 100644 .github/workflows/bun-mac-x64.yml delete mode 100644 .github/workflows/bun-release-test.yml delete mode 100644 .github/workflows/bun-types-tests.yml delete mode 100644 .github/workflows/bun-windows.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/release-canary.yml rename .github/workflows/{bun-release.yml => release.yml} (99%) rename .github/workflows/{format.yml => run-format.yml} (57%) create mode 100644 .github/workflows/run-lint.yml create mode 100644 .github/workflows/run-test.yml diff --git a/.github/actions/setup-bun/action.yml b/.github/actions/setup-bun/action.yml index 19efd7c8f91891..9d04e28cc4d684 100644 --- a/.github/actions/setup-bun/action.yml +++ b/.github/actions/setup-bun/action.yml @@ -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 diff --git a/.github/workflows/build-darwin.yml b/.github/workflows/build-darwin.yml new file mode 100644 index 00000000000000..9125b3d82f21e8 --- /dev/null +++ b/.github/workflows/build-darwin.yml @@ -0,0 +1,302 @@ +name: Build Darwin + +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 \ + gnu-sed --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 + - 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 \ + gnu-sed --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 + - 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 \ + gnu-sed --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 + - 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 + 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/oven-sh/bun/actions/runs/${{ github.run_id }})** diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 00000000000000..ba27e6c1dcbe1d --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,59 @@ +name: Build Linux + +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 + 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/oven-sh/bun/actions/runs/${{ github.run_id }})** diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 00000000000000..b025fb3ae97014 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,322 @@ +name: Build Windows + +on: + workflow_call: + inputs: + runs-on: + type: string + default: windows-latest + 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@1a3da29f56261a1e1f937ec88f0856a9b8321d7e + 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@1a3da29f56261a1e1f937ec88f0856a9b8321d7e + 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@1a3da29f56261a1e1f937ec88f0856a9b8321d7e + 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" + - 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 + 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 + 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/oven-sh/bun/actions/runs/${{ github.run_id }})** diff --git a/.github/workflows/build-zig.yml b/.github/workflows/build-zig.yml new file mode 100644 index 00000000000000..7761c3ad7cc9c6 --- /dev/null +++ b/.github/workflows/build-zig.yml @@ -0,0 +1,118 @@ +name: Build Zig + +on: + workflow_call: + inputs: + runs-on: + type: string + default: ${{ github.repository_owner != 'oven-sh' && 'ubuntu-latest' || 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 }} + 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 diff --git a/.github/workflows/bun-deploy-site.yml b/.github/workflows/bun-deploy-site.yml deleted file mode 100644 index 9783668fbfe588..00000000000000 --- a/.github/workflows/bun-deploy-site.yml +++ /dev/null @@ -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 }} diff --git a/.github/workflows/bun-linux-aarch64.yml b/.github/workflows/bun-linux-aarch64.yml deleted file mode 100644 index 78697356483947..00000000000000 --- a/.github/workflows/bun-linux-aarch64.yml +++ /dev/null @@ -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" diff --git a/.github/workflows/bun-linux-build.yml b/.github/workflows/bun-linux-build.yml deleted file mode 100644 index b758f7e71243b8..00000000000000 --- a/.github/workflows/bun-linux-build.yml +++ /dev/null @@ -1,319 +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 - - # Split these into multiple steps to make it clear which one fails - - name: Install dependencies (apt-get) - run: sudo apt-get update && sudo apt-get install -y openssl - - name: Install dependencies (root) - run: bun install --verbose - - name: Install dependencies (test) - run: bun install --cwd=test --verbose - - name: Install dependencies (runner) - run: bun install --cwd=packages/bun-internal-test --verbose - - name: Install dependencies (prisma) - run: 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 }} - BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "true" - # 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}})** - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - 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. Thank you. - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - id: fail - name: Fail the build - if: steps.test.outputs.failing_tests != '' - run: exit 1 diff --git a/.github/workflows/bun-mac-aarch64.yml b/.github/workflows/bun-mac-aarch64.yml deleted file mode 100644 index 9a21861e452689..00000000000000 --- a/.github/workflows/bun-mac-aarch64.yml +++ /dev/null @@ -1,481 +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 - # Split these into multiple steps to make it clear which one fails - - name: "Install dependencies (root)" - run: bun install --verbose - - name: "Install dependencies (test)" - run: bun install --cwd=test --verbose - - name: "Install dependencies (runner)" - run: 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 }} - BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "true" - # 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}})** - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - 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. Thank you. - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - id: fail - name: Fail the build - if: steps.test.outputs.failing_tests != '' - run: exit 1 diff --git a/.github/workflows/bun-mac-x64-baseline.yml b/.github/workflows/bun-mac-x64-baseline.yml deleted file mode 100644 index 1111c592feb27a..00000000000000 --- a/.github/workflows/bun-mac-x64-baseline.yml +++ /dev/null @@ -1,472 +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: 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 - 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 }} - BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "true" - # 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}})** - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - 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. Thank you. - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - id: fail - name: Fail the build - if: steps.test.outputs.failing_tests != '' - run: exit 1 diff --git a/.github/workflows/bun-mac-x64.yml b/.github/workflows/bun-mac-x64.yml deleted file mode 100644 index 9ccf09c7ae052a..00000000000000 --- a/.github/workflows/bun-mac-x64.yml +++ /dev/null @@ -1,467 +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: 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 - 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 - # Split these into multiple steps to make it clear which one fails - - name: "Install dependencies (root)" - run: bun install --verbose - - name: "Install dependencies (test)" - run: bun install --cwd=test --verbose - - name: "Install dependencies (runner)" - run: 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 }} - BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "true" - # 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}})** - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - 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. Thank you. - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - id: fail - name: Fail the build - if: steps.test.outputs.failing_tests != '' - run: exit 1 diff --git a/.github/workflows/bun-release-test.yml b/.github/workflows/bun-release-test.yml deleted file mode 100644 index 2af8e2d0afc745..00000000000000 --- a/.github/workflows/bun-release-test.yml +++ /dev/null @@ -1,44 +0,0 @@ -# This workflow tests bun-release's code and the packages to ensure that npm, -# yarn, and pnpm can install bun on all platforms. This does not test that bun -# itself works as it hardcodes 1.1.0 as the version to package. -name: bun-release-test -concurrency: release-test - -on: - pull_request: - paths: - - "packages/bun-release/**" - - ".github/workflows/bun-release-test.yml" - -jobs: - test-release-script: - name: Test Release Script - strategy: - matrix: - machine: [namespace-profile-bun-linux-x64, linux-arm64, macos-arm64, macos-12-large, windows-latest] - fail-fast: false - runs-on: ${{ matrix.machine }} - permissions: - contents: read - defaults: - run: - working-directory: packages/bun-release - timeout-minutes: 5 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Bun - uses: ./.github/actions/setup-bun - with: - bun-version: "1.1.0" - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install Dependencies - run: bun install && npm i -g pnpm yarn npm - - - name: Release - run: bun upload-npm -- 1.1.0 test - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/bun-types-tests.yml b/.github/workflows/bun-types-tests.yml deleted file mode 100644 index 6fe222e71cf8fc..00000000000000 --- a/.github/workflows/bun-types-tests.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/bun-windows.yml b/.github/workflows/bun-windows.yml deleted file mode 100644 index f30b98b4bd4506..00000000000000 --- a/.github/workflows/bun-windows.yml +++ /dev/null @@ -1,508 +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: - - ".github/workflows/*.yml" - - "src/**/*" - - "test/**/*" - - "packages/bun-usockets/src/**/*" - - "packages/bun-uws/src/**/*" - - "CMakeLists.txt" - - "build.zig" - - "Makefile" - - "Dockerfile" - pull_request: - branches: [main] - paths: - - ".github/workflows/*.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: - # 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: 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: 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=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" } - $CANARY_REVISION = 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" } - $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)" ` - ${{ 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@v3 - with: - packages: bash - # Split these into multiple steps to make it clear which one fails - - name: Install dependencies (root) - run: bun install --verbose - - name: Install dependencies (test) - run: bun install --cwd=test --verbose - - name: Install dependencies (runner) - run: bun install --cwd=packages/bun-internal-test --verbose - - 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 }} - BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "true" - 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.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 bun-windows-${{ matrix.arch }}-${{ matrix.cpu }} - - ${{ steps.test.outputs.failing_tests }} - - **[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})** - - name: Comment on PR - if: always() && steps.test.outputs.failing_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 }} ${{ steps.test.outputs.failing_tests_count }} files with test failures on bun-windows-${{ matrix.arch }}-${{ matrix.cpu }} - - ${{ steps.test.outputs.failing_tests }} - - **[View test output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})** - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - 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-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. Thank you. - - id: fail - name: Fail the build - if: steps.test.outputs.failing_tests != '' - run: exit 1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000000..17138040277197 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,199 @@ +name: CI + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + format: + name: Format + uses: ./.github/workflows/run-format.yml + with: + zig-version: 0.12.0-dev.1828+225fe6ddb + lint: + name: Lint + uses: ./.github/workflows/run-lint.yml + linux-x64: + name: Build linux-x64 + uses: ./.github/workflows/build-linux.yml + with: + runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }} + tag: linux-x64 + arch: x64 + cpu: haswell + linux-x64-baseline: + name: Build linux-x64-baseline + uses: ./.github/workflows/build-linux.yml + with: + runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }} + tag: linux-x64-baseline + arch: x64 + cpu: nehalem + linux-aarch64: + if: ${{ github.repository_owner == 'oven-sh' }} + name: Build linux-aarch64 + uses: ./.github/workflows/build-linux.yml + with: + runs-on: namespace-profile-bun-ci-linux-aarch64 + tag: linux-aarch64 + arch: aarch64 + cpu: native + darwin-x64: + name: Build darwin-x64 + uses: ./.github/workflows/build-darwin.yml + with: + runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }} + tag: darwin-x64 + arch: x64 + cpu: haswell + darwin-x64-baseline: + name: Build darwin-x64-baseline + uses: ./.github/workflows/build-darwin.yml + with: + runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }} + tag: darwin-x64-baseline + arch: x64 + cpu: nehalem + darwin-aarch64: + name: Build darwin-aarch64 + uses: ./.github/workflows/build-darwin.yml + with: + runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-darwin-aarch64' || 'macos-14' }} + tag: darwin-aarch64 + arch: aarch64 + cpu: native + windows-x64: + name: Build windows-x64 + uses: ./.github/workflows/build-windows.yml + with: + runs-on: windows-latest + tag: windows-x64 + arch: x64 + cpu: haswell + windows-x64-baseline: + name: Build windows-x64-baseline + uses: ./.github/workflows/build-windows.yml + with: + runs-on: windows-latest + tag: windows-x64-baseline + arch: x64 + cpu: nehalem + linux-x64-test: + if: ${{ github.event_name == 'pull_request' }} + name: Test linux-x64 + needs: linux-x64 + uses: ./.github/workflows/run-test.yml + with: + 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: ${{ github.event_name == 'pull_request' }} + name: Test linux-x64-baseline + needs: linux-x64-baseline + uses: ./.github/workflows/run-test.yml + with: + 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: ${{ github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'}} + name: Test linux-aarch64 + needs: linux-aarch64 + uses: ./.github/workflows/run-test.yml + with: + pr-number: ${{ github.event.number }} + runs-on: namespace-profile-bun-ci-linux-aarch64 + tag: linux-aarch64 + darwin-x64-test: + if: ${{ github.event_name == 'pull_request' }} + name: Test darwin-x64 + needs: darwin-x64 + uses: ./.github/workflows/run-test.yml + with: + 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: ${{ github.event_name == 'pull_request' }} + name: Test darwin-x64-baseline + needs: darwin-x64-baseline + uses: ./.github/workflows/run-test.yml + with: + 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: ${{ github.event_name == 'pull_request' }} + name: Test darwin-aarch64 + needs: darwin-aarch64 + uses: ./.github/workflows/run-test.yml + with: + pr-number: ${{ github.event.number }} + runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-darwin-aarch64' || 'macos-14' }} + tag: darwin-aarch64 + windows-x64-test: + if: ${{ github.event_name == 'pull_request' }} + name: Test windows-x64 + needs: windows-x64 + uses: ./.github/workflows/run-test.yml + with: + pr-number: ${{ github.event.number }} + runs-on: windows-latest + tag: windows-x64 + windows-x64-baseline-test: + if: ${{ github.event_name == 'pull_request' }} + name: Test windows-x64-baseline + needs: windows-x64-baseline + uses: ./.github/workflows/run-test.yml + with: + pr-number: ${{ github.event.number }} + runs-on: windows-latest + tag: windows-x64-baseline + summary: + if: ${{ always() && github.repository_owner == 'oven-sh' }} + name: Summarize + needs: + - linux-x64-test + - linux-x64-baseline-test + - linux-aarch64-test + - darwin-x64-test + - darwin-x64-baseline-test + - darwin-aarch64-test + - windows-x64-test + - windows-x64-baseline-test + runs-on: ubuntu-latest + steps: + - name: Download Results + uses: actions/download-artifact@v4 + with: + pattern: bun-*-tests + - name: Parse Results + id: results + run: | + cat bun-*-tests/comment.md > comment.md + if [ -s comment.md ]; then + echo -e "❌ @${{ github.actor }}, there are failing tests: \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/oven-sh/bun/actions/runs/${{ github.run_id }})**" >> comment.md + echo -e "" >> comment.md + echo "pr-number=$(> $GITHUB_OUTPUT + - name: Find Comment + id: comment + uses: peter-evans/find-comment@v3 + with: + issue-number: ${{ steps.results.outputs.pr-number }} + comment-author: github-actions[bot] + body-includes: + - name: Post Comment + uses: peter-evans/create-or-update-comment@v4 + with: + comment-id: ${{ steps.comment.outputs.comment-id }} + issue-number: ${{ steps.results.outputs.pr-number }} + body-path: comment.md + edit-mode: replace diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000000000..93a62fec1d1d4b --- /dev/null +++ b/.github/workflows/docs.yml @@ -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 }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index e5e3a0aece2458..00000000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: lint - -permissions: - contents: read - -on: - workflow_dispatch: - pull_request: - push: - branches: - - main - - jarred/assert - paths: - - ".github/workflows/lint.yml" - - "src/**/*.zig" - - "src/*.zig" - -jobs: - format: - name: lint - runs-on: ${{ vars.RUNNER_LINUX_X64 || 'ubuntu-latest' }} - if: github.repository_owner == 'oven-sh' - permissions: write-all - 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 || true - - uses: sarisia/actions-status-discord@v1 - if: always() && steps.lint.outputs.text_output != '' && 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.lint.outputs.count }} lint errors on ${{ github.ref_name }} - - ${{ steps.lint.outputs.text_output }} - - **[View linter output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})** - - name: Comment on PR - if: steps.lint.outputs.text_output != '' && github.event_name == 'pull_request' - uses: thollander/actions-comment-pull-request@v2 - with: - comment_tag: lint-failures - message: | - ❌ @${{ github.actor }} ${{ steps.lint.outputs.count }} lint errors - - ${{ steps.lint.outputs.text_output }} - - **[View linter output](https://github.com/oven-sh/bun/actions/runs/${{github.run_id}})** - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - name: Uncomment on PR - if: steps.lint.outputs.text_output == '' && github.event_name == 'pull_request' - uses: thollander/actions-comment-pull-request@v2 - with: - comment_tag: lint-failures - mode: upsert - create_if_not_exists: false - message: | - ✅ lint failures have been resolved. Thank you. - - [#${{github.sha}}](https://github.com/oven-sh/bun/commits/${{github.sha}}) - - id: fail - name: Fail the build - if: steps.lint.outputs.text_output != '' - run: exit 1 diff --git a/.github/workflows/release-canary.yml b/.github/workflows/release-canary.yml new file mode 100644 index 00000000000000..10ca8de0622c04 --- /dev/null +++ b/.github/workflows/release-canary.yml @@ -0,0 +1,49 @@ +name: Release Canary + +on: + workflow_run: + workflows: + - CI + types: + - completed + branches: + - main + +jobs: + release: + if: ${{ github.repository_owner == 'oven-sh' }} + 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: Upload to GitHub Releases + uses: softprops/action-gh-release@v2 + with: + tag_name: canary + make_latest: false + generate_release_notes: false + files: bun/* + - 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 }} + - 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 diff --git a/.github/workflows/bun-release.yml b/.github/workflows/release.yml similarity index 99% rename from .github/workflows/bun-release.yml rename to .github/workflows/release.yml index b523388e4e189b..3d7dd5c52f69c6 100644 --- a/.github/workflows/bun-release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/format.yml b/.github/workflows/run-format.yml similarity index 57% rename from .github/workflows/format.yml rename to .github/workflows/run-format.yml index 85d09b3a9ff7cc..8ddab51d018547 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/run-format.yml @@ -1,22 +1,16 @@ -name: autofix.ci # Must be named this for autofix.ci to work - -permissions: - contents: read +name: Format 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 +28,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 diff --git a/.github/workflows/run-lint.yml b/.github/workflows/run-lint.yml new file mode 100644 index 00000000000000..8471c78252376d --- /dev/null +++ b/.github/workflows/run-lint.yml @@ -0,0 +1,27 @@ +name: Lint + +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 diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml new file mode 100644 index 00000000000000..79f0b8fa50e6cf --- /dev/null +++ b/.github/workflows/run-test.yml @@ -0,0 +1,124 @@ +name: Test + +on: + workflow_call: + inputs: + runs-on: + type: string + required: true + tag: + type: string + required: true + pr-number: + type: string + required: true + workflow_dispatch: + inputs: + runs-on: + type: string + description: The runner used to run the tests + required: true + tag: + type: string + description: The tag of the build to use + required: true + pr-number: + type: string + description: The pull request from where to download Bun + required: true + +jobs: + test: + name: Test + runs-on: ${{ inputs.runs-on }} + steps: + - 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: dawidd6/action-download-artifact@v3 + with: + name: bun-${{ inputs.tag }} + path: bun + github_token: ${{ github.token }} + pr: ${{ inputs.pr-number }} + workflow_search: true + workflow_conclusion: "" # ignore conclusion + check_artifacts: true + search_artifacts: true + - if: ${{ runner.os == 'Windows' }} + name: Setup Cygwin + uses: secondlife/setup-cygwin@v3 + with: + packages: bash + - name: Setup Bun + shell: bash + run: | + unzip bun/bun-*.zip + cd bun-* + pwd >> ${GITHUB_PATH} + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install Dependencies + shell: bash + run: | + bun install + bun install --cwd test + bun install --cwd packages/bun-internal-test + - name: Run Tests + id: test + shell: bash + env: + TMPDIR: ${{ runner.temp }} + 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 }} + run: | + node packages/bun-internal-test/src/runner.node.mjs || true + - name: Write Comment + run: | + echo "There are ${{ steps.test.outputs.failing_tests_count }} failing tests on bun-${{ inputs.tag }}." > comment.md + echo "" >> comment.md + echo "${{ steps.test.outputs.failing_tests }}" >> comment.md + - 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: ${{ steps.test.outputs.failing_tests != '' && github.repository_owner == 'oven-sh' }} + name: Send Message + uses: sarisia/actions-status-discord@v1 + with: + webhook: ${{ secrets.DISCORD_WEBHOOK }} + nodetail: true + title: "" + description: | + ### [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) + + @${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} failing tests on bun-${{ inputs.tag }}. + + ${{ steps.test.outputs.failing_tests }} + + **[View logs](https://github.com/oven-sh/bun/actions/runs/${{ github.run_id }})** + - name: Fail + if: ${{ steps.test.outputs.failing_tests != ''}} + run: | + echo "Failing tests: ${{ steps.test.outputs.failing_tests }}" + exit 1 diff --git a/Dockerfile b/Dockerfile index 538dbd8b613005..4fd86328f950d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -138,6 +138,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 +154,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 +178,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 +197,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 +215,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 +256,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 +283,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 +312,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 +331,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 +356,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 +399,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 +420,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 +435,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,7 +450,9 @@ COPY --from=bun-codegen-for-zig ${BUN_DIR}/packages/bun-error/dist ${BUN_DIR}/pa WORKDIR $BUN_DIR -RUN mkdir -p 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 .. \ @@ -446,6 +485,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 @@ -473,7 +516,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 \ @@ -504,6 +549,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 @@ -530,7 +579,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 \ diff --git a/packages/bun-internal-test/src/runner.node.mjs b/packages/bun-internal-test/src/runner.node.mjs index 267bdef75a6a45..3a3352b73143b7 100644 --- a/packages/bun-internal-test/src/runner.node.mjs +++ b/packages/bun-internal-test/src/runner.node.mjs @@ -409,6 +409,7 @@ for (const path of allTests) { process.exit(1); }), ); + break; // HACK } await queue.onIdle(); console.log(` From 8ce6df1c705ec3c246980539ae16bb6b9492ad4a Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Tue, 16 Apr 2024 14:47:43 -0700 Subject: [PATCH 2/7] Testing workflows --- .github/workflows/ci.yml | 48 ++--------------- .github/workflows/comment.yml | 54 +++++++++++++++++++ .../{release-canary.yml => upload.yml} | 4 +- .../bun-internal-test/src/runner.node.mjs | 7 +-- 4 files changed, 62 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/comment.yml rename .github/workflows/{release-canary.yml => upload.yml} (97%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17138040277197..8147996664564f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,9 @@ name: CI +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + on: workflow_dispatch: pull_request: @@ -153,47 +157,3 @@ jobs: pr-number: ${{ github.event.number }} runs-on: windows-latest tag: windows-x64-baseline - summary: - if: ${{ always() && github.repository_owner == 'oven-sh' }} - name: Summarize - needs: - - linux-x64-test - - linux-x64-baseline-test - - linux-aarch64-test - - darwin-x64-test - - darwin-x64-baseline-test - - darwin-aarch64-test - - windows-x64-test - - windows-x64-baseline-test - runs-on: ubuntu-latest - steps: - - name: Download Results - uses: actions/download-artifact@v4 - with: - pattern: bun-*-tests - - name: Parse Results - id: results - run: | - cat bun-*-tests/comment.md > comment.md - if [ -s comment.md ]; then - echo -e "❌ @${{ github.actor }}, there are failing tests: \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/oven-sh/bun/actions/runs/${{ github.run_id }})**" >> comment.md - echo -e "" >> comment.md - echo "pr-number=$(> $GITHUB_OUTPUT - - name: Find Comment - id: comment - uses: peter-evans/find-comment@v3 - with: - issue-number: ${{ steps.results.outputs.pr-number }} - comment-author: github-actions[bot] - body-includes: - - name: Post Comment - uses: peter-evans/create-or-update-comment@v4 - with: - comment-id: ${{ steps.comment.outputs.comment-id }} - issue-number: ${{ steps.results.outputs.pr-number }} - body-path: comment.md - edit-mode: replace diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml new file mode 100644 index 00000000000000..7fe6f9d1d10863 --- /dev/null +++ b/.github/workflows/comment.yml @@ -0,0 +1,54 @@ +name: Comment on PR + +on: + workflow_run: + workflows: + - CI + types: + - completed + branches: + - main + +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 + merge-multiple: true + github-token: ${{ github.token }} + run-id: ${{ github.event.workflow_run.id }} + - name: Setup Environment + id: env + shell: bash + run: | + echo "pr-number=$(> $GITHUB_OUTPUT + - name: Generate Comment + run: | + cat bun-*-tests/comment.md > comment.md + if [ -s comment.md ]; then + echo -e "❌ @${{ github.actor }}, there are failing tests: \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/oven-sh/bun/actions/runs/${{ github.event.workflow_run.id }})**" >> comment.md + echo -e "" >> 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: + - 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 diff --git a/.github/workflows/release-canary.yml b/.github/workflows/upload.yml similarity index 97% rename from .github/workflows/release-canary.yml rename to .github/workflows/upload.yml index 10ca8de0622c04..f9bb5ca1585ab5 100644 --- a/.github/workflows/release-canary.yml +++ b/.github/workflows/upload.yml @@ -1,4 +1,4 @@ -name: Release Canary +name: Upload Artifacts on: workflow_run: @@ -10,7 +10,7 @@ on: - main jobs: - release: + upload: if: ${{ github.repository_owner == 'oven-sh' }} runs-on: ubuntu-latest steps: diff --git a/packages/bun-internal-test/src/runner.node.mjs b/packages/bun-internal-test/src/runner.node.mjs index 3a3352b73143b7..eaa53451196ca5 100644 --- a/packages/bun-internal-test/src/runner.node.mjs +++ b/packages/bun-internal-test/src/runner.node.mjs @@ -1,10 +1,9 @@ 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 { cpus, hostname, tmpdir, totalmem, userInfo } from "os"; import { join, normalize } from "path"; import { fileURLToPath } from "url"; import PQueue from "p-queue"; @@ -24,7 +23,6 @@ function defaultConcurrency() { } 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)) + ""; @@ -409,7 +407,6 @@ for (const path of allTests) { process.exit(1); }), ); - break; // HACK } await queue.onIdle(); console.log(` From 8d084b0f0eb1b96f29c3ac61998ac1071ed8ad42 Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Tue, 16 Apr 2024 15:53:13 -0700 Subject: [PATCH 3/7] Testing workflows --- .github/workflows/ci.yml | 18 ++++++++++++++++++ .github/workflows/run-test.yml | 2 ++ 2 files changed, 20 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8147996664564f..1ff318fdbd94f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,14 +15,17 @@ jobs: format: name: Format uses: ./.github/workflows/run-format.yml + secrets: inherit with: zig-version: 0.12.0-dev.1828+225fe6ddb lint: name: Lint uses: ./.github/workflows/run-lint.yml + secrets: inherit 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 @@ -31,6 +34,7 @@ jobs: 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 @@ -40,6 +44,7 @@ jobs: if: ${{ 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 @@ -48,6 +53,7 @@ jobs: 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 @@ -56,6 +62,7 @@ jobs: 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 @@ -64,6 +71,7 @@ jobs: 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-14' }} tag: darwin-aarch64 @@ -72,6 +80,7 @@ jobs: windows-x64: name: Build windows-x64 uses: ./.github/workflows/build-windows.yml + secrets: inherit with: runs-on: windows-latest tag: windows-x64 @@ -80,6 +89,7 @@ jobs: windows-x64-baseline: name: Build windows-x64-baseline uses: ./.github/workflows/build-windows.yml + secrets: inherit with: runs-on: windows-latest tag: windows-x64-baseline @@ -90,6 +100,7 @@ jobs: name: Test linux-x64 needs: linux-x64 uses: ./.github/workflows/run-test.yml + secrets: inherit with: pr-number: ${{ github.event.number }} runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }} @@ -99,6 +110,7 @@ jobs: name: Test linux-x64-baseline needs: linux-x64-baseline uses: ./.github/workflows/run-test.yml + secrets: inherit with: pr-number: ${{ github.event.number }} runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }} @@ -108,6 +120,7 @@ jobs: name: Test linux-aarch64 needs: linux-aarch64 uses: ./.github/workflows/run-test.yml + secrets: inherit with: pr-number: ${{ github.event.number }} runs-on: namespace-profile-bun-ci-linux-aarch64 @@ -117,6 +130,7 @@ jobs: name: Test darwin-x64 needs: darwin-x64 uses: ./.github/workflows/run-test.yml + secrets: inherit with: pr-number: ${{ github.event.number }} runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }} @@ -126,6 +140,7 @@ jobs: name: Test darwin-x64-baseline needs: darwin-x64-baseline uses: ./.github/workflows/run-test.yml + secrets: inherit with: pr-number: ${{ github.event.number }} runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-12-large' || 'macos-12' }} @@ -135,6 +150,7 @@ jobs: name: Test darwin-aarch64 needs: darwin-aarch64 uses: ./.github/workflows/run-test.yml + secrets: inherit with: pr-number: ${{ github.event.number }} runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-darwin-aarch64' || 'macos-14' }} @@ -144,6 +160,7 @@ jobs: name: Test windows-x64 needs: windows-x64 uses: ./.github/workflows/run-test.yml + secrets: inherit with: pr-number: ${{ github.event.number }} runs-on: windows-latest @@ -153,6 +170,7 @@ jobs: name: Test windows-x64-baseline needs: windows-x64-baseline uses: ./.github/workflows/run-test.yml + secrets: inherit with: pr-number: ${{ github.event.number }} runs-on: windows-latest diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 79f0b8fa50e6cf..46a37789f89835 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -71,6 +71,7 @@ jobs: with: node-version: 20 - name: Install Dependencies + timeout-minutes: 5 shell: bash run: | bun install @@ -78,6 +79,7 @@ jobs: bun install --cwd packages/bun-internal-test - name: Run Tests id: test + timeout-minutes: 30 shell: bash env: TMPDIR: ${{ runner.temp }} From 7f169ebe96c07956709ff46b1ac895777a50fd42 Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Tue, 16 Apr 2024 15:56:31 -0700 Subject: [PATCH 4/7] Testing workflows --- .github/workflows/run-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 46a37789f89835..6d045b73b804a5 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -120,7 +120,7 @@ jobs: **[View logs](https://github.com/oven-sh/bun/actions/runs/${{ github.run_id }})** - name: Fail - if: ${{ steps.test.outputs.failing_tests != ''}} + if: ${{ steps.test.outputs.failing_tests != '' }} run: | - echo "Failing tests: ${{ steps.test.outputs.failing_tests }}" + echo "There are ${{ steps.test.outputs.failing_tests_count }} failing tests on bun-${{ inputs.tag }}." exit 1 From c3adc448db81d6ffd1ecbc0ece7ca159ff234b97 Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Tue, 16 Apr 2024 16:35:57 -0700 Subject: [PATCH 5/7] Testing workflows --- .github/workflows/build-darwin.yml | 2 +- .github/workflows/build-linux.yml | 2 +- .github/workflows/build-windows.yml | 2 +- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ .github/workflows/comment.yml | 2 -- .github/workflows/run-test.yml | 20 +++++++++++++------- 6 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-darwin.yml b/.github/workflows/build-darwin.yml index 9125b3d82f21e8..ec46f952478cb9 100644 --- a/.github/workflows/build-darwin.yml +++ b/.github/workflows/build-darwin.yml @@ -295,7 +295,7 @@ jobs: nodetail: true title: "" description: | - ### [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) + ### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) @${{ github.actor }}, the build for bun-${{ inputs.tag }} failed. diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index ba27e6c1dcbe1d..59fe757f447723 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -52,7 +52,7 @@ jobs: nodetail: true title: "" description: | - ### [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) + ### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) @${{ github.actor }}, the build for bun-${{ inputs.tag }} failed. diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index b025fb3ae97014..689e30c667dd2d 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -315,7 +315,7 @@ jobs: nodetail: true title: "" description: | - ### [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) + ### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) @${{ github.actor }}, the build for bun-${{ inputs.tag }} failed. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ff318fdbd94f4..ac80625d9a4d8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -175,3 +175,25 @@ jobs: pr-number: ${{ github.event.number }} runs-on: windows-latest 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@v2 + with: + name: | + bun-*-cpp + bun-*-zig + bun-*-deps + bun-*-codegen diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml index 7fe6f9d1d10863..c8da3258c05fb9 100644 --- a/.github/workflows/comment.yml +++ b/.github/workflows/comment.yml @@ -6,8 +6,6 @@ on: - CI types: - completed - branches: - - main jobs: comment: diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 6d045b73b804a5..0f4b1ae8cd38c1 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -65,7 +65,11 @@ jobs: run: | unzip bun/bun-*.zip cd bun-* - pwd >> ${GITHUB_PATH} + if [ "$RUNNER_OS" == "Windows" ]; then + pwd >> $env:GITHUB_PATH + else + pwd >> ${GITHUB_PATH} + fi - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -88,13 +92,15 @@ jobs: TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }} TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }} run: | - node packages/bun-internal-test/src/runner.node.mjs || true - - name: Write Comment + node packages/bun-internal-test/src/runner.node.mjs + - if: ${{ failure()}} + name: Write Comment run: | echo "There are ${{ steps.test.outputs.failing_tests_count }} failing tests on bun-${{ inputs.tag }}." > comment.md echo "" >> comment.md echo "${{ steps.test.outputs.failing_tests }}" >> comment.md - - name: Upload Results + - if: ${{ always()}} + name: Upload Results uses: actions/upload-artifact@v4 with: name: bun-${{ inputs.tag }}-tests @@ -104,7 +110,7 @@ jobs: pr-number.txt if-no-files-found: error overwrite: true - - if: ${{ steps.test.outputs.failing_tests != '' && github.repository_owner == 'oven-sh' }} + - if: ${{ failure() && github.repository_owner == 'oven-sh' }} name: Send Message uses: sarisia/actions-status-discord@v1 with: @@ -120,7 +126,7 @@ jobs: **[View logs](https://github.com/oven-sh/bun/actions/runs/${{ github.run_id }})** - name: Fail - if: ${{ steps.test.outputs.failing_tests != '' }} + if: ${{ failure() }} run: | - echo "There are ${{ steps.test.outputs.failing_tests_count }} failing tests on bun-${{ inputs.tag }}." + echo "There are ${{ steps.test.outputs.failing_tests_count || 'some' }} failing tests on bun-${{ inputs.tag }}." exit 1 From d2e3575effbf136c0c606daeb34791bd706dffde Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Tue, 16 Apr 2024 16:57:48 -0700 Subject: [PATCH 6/7] Testing workflows --- .github/workflows/run-test.yml | 8 +------- packages/bun-internal-test/src/runner.node.mjs | 8 ++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 0f4b1ae8cd38c1..8b58db2acf195d 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -93,12 +93,6 @@ jobs: TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }} run: | node packages/bun-internal-test/src/runner.node.mjs - - if: ${{ failure()}} - name: Write Comment - run: | - echo "There are ${{ steps.test.outputs.failing_tests_count }} failing tests on bun-${{ inputs.tag }}." > comment.md - echo "" >> comment.md - echo "${{ steps.test.outputs.failing_tests }}" >> comment.md - if: ${{ always()}} name: Upload Results uses: actions/upload-artifact@v4 @@ -118,7 +112,7 @@ jobs: nodetail: true title: "" description: | - ### [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) + ### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) @${{ github.actor }}, there are ${{ steps.test.outputs.failing_tests_count }} failing tests on bun-${{ inputs.tag }}. diff --git a/packages/bun-internal-test/src/runner.node.mjs b/packages/bun-internal-test/src/runner.node.mjs index eaa53451196ca5..08e3639385dadc 100644 --- a/packages/bun-internal-test/src/runner.node.mjs +++ b/packages/bun-internal-test/src/runner.node.mjs @@ -527,6 +527,14 @@ if (ci) { } action.setOutput("failing_tests", failingTestDisplay); action.setOutput("failing_tests_count", failing_tests.length); + if (failing_tests.length) { + const tag = action.getInput("tag") || "unknown"; + let comment = `There are ${failing_tests.length} failing tests on bun-${tag}. + +${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..."; From 80404be0d9f96cd921f097fe6bdc8feb4f317e26 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 16 Apr 2024 19:36:40 -0700 Subject: [PATCH 7/7] Update .github/workflows/run-test.yml --- .github/workflows/run-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 8b58db2acf195d..8d4018b8d14848 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -92,7 +92,7 @@ jobs: TLS_MONGODB_DATABASE_URL: ${{ secrets.TLS_MONGODB_DATABASE_URL }} TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }} run: | - node packages/bun-internal-test/src/runner.node.mjs + node packages/bun-internal-test/src/runner.node.mjs || true - if: ${{ always()}} name: Upload Results uses: actions/upload-artifact@v4