Compare commits

...

12 Commits

Author SHA1 Message Date
Ashcon Partovi
28ba9d487f Add test workflow 2024-03-21 12:49:58 -07:00
Ashcon Partovi
2e0a939a6d T 2024-03-21 09:22:18 -07:00
Ashcon Partovi
382cad526b Test changes 2 2024-03-20 16:18:19 -07:00
Ashcon Partovi
757110e9d6 Test changes 2024-03-20 16:14:19 -07:00
Ashcon Partovi
43bf319fc4 Trigger workflow 2024-03-20 14:41:36 -07:00
Ashcon Partovi
e27aac1557 Try it out 2024-03-20 14:40:46 -07:00
Ashcon Partovi
7575ad5560 Changes 4 2024-03-20 14:28:14 -07:00
Ashcon Partovi
130853efd2 Changes 3 2024-03-20 14:01:00 -07:00
Ashcon Partovi
c239989815 Changes 2 2024-03-20 13:22:30 -07:00
Ashcon Partovi
56dcb4ef3d Changes 2024-03-20 13:21:05 -07:00
Ashcon Partovi
ff8fda2b34 Activate workflow 2024-03-20 13:12:20 -07:00
Ashcon Partovi
b082e557c3 Add workflow 2024-03-20 13:09:56 -07:00
4 changed files with 270 additions and 45 deletions

View File

@@ -10,8 +10,11 @@ env:
on:
push:
branches: [main]
branches:
- main
- ci-*
paths:
- ".github/workflows/bun-mac-x64.yml"
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
@@ -21,8 +24,11 @@ on:
- "Makefile"
- "Dockerfile"
pull_request:
branches: [main]
branches:
- main
- ci-*
paths:
- ".github/workflows/bun-mac-x64.yml"
- "src/**/*"
- "test/**/*"
- "packages/bun-usockets/src/**/*"
@@ -37,46 +43,12 @@ on:
jobs:
macOS-zig:
name: macOS Zig Object
runs-on: namespace-profile-zig-build
if: github.repository_owner == 'oven-sh'
strategy:
matrix:
include:
# - cpu: nehalem
# arch: x86_64
# tag: bun-obj-darwin-x64-baseline
- cpu: haswell
arch: x86_64
tag: bun-obj-darwin-x64
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compile Zig Object
uses: docker/build-push-action@v5
with:
context: .
push: false
build-args: |
BUILDARCH=${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
BUILD_MACHINE_ARCH=${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}
ARCH=${{ matrix.arch }}
CPU_TARGET=${{ matrix.cpu }}
TRIPLET=${{ matrix.arch }}-macos-none
GIT_SHA=${{ github.sha }}
platforms: linux/${{ runner.arch == 'X64' && 'amd64' || 'arm64' }}
target: build_release_obj
outputs: type=local,dest=${{runner.temp}}/release
- name: Upload Zig Object
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.tag }}
path: ${{runner.temp}}/release/bun-zig.o
if-no-files-found: "error"
uses: ./.github/workflows/zig-build.yml
secrets: inherit
with:
os: darwin
arch: x64
baseline: true
macOS-dependencies:
name: macOS Dependencies
@@ -89,7 +61,6 @@ jobs:
- cpu: haswell
arch: x86_64
tag: bun-darwin-x64
obj: bun-obj-darwin-x64
runner: macos-12-large
artifact: bun-obj-darwin-x64
steps:
@@ -164,7 +135,6 @@ jobs:
- cpu: haswell
arch: x86_64
tag: bun-darwin-x64
obj: bun-obj-darwin-x64
runner: macos-12-large
artifact: bun-obj-darwin-x64
steps:
@@ -237,7 +207,7 @@ jobs:
- cpu: haswell
arch: x86_64
tag: bun-darwin-x64
obj: bun-obj-darwin-x64
obj: bun-zig-x86_64-macos-none-haswell # ${{ jobs.macOS-zig.outputs.artifact }}
package: bun-darwin-x64
runner: macos-12-large
artifact: bun-obj-darwin-x64

65
.github/workflows/bun-test.yml vendored Normal file
View File

@@ -0,0 +1,65 @@
name: Test
on:
push:
workflow_call:
inputs:
runs-on:
type: string
required: true
artifact:
type: string
required: true
jobs:
test:
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
test
packages/bun-internal-test/src
packages/bun-internal-test/package.json
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Download Bun from URL
if: ${{ startsWith(inputs.artifact, 'http://') || startsWith(inputs.artifact, 'https://') }}
shell: bash
run: |
mkdir -p ${{ runner.temp }}/bun
curl -L ${{ inputs.artifact }} -o ${{ runner.temp }}/bun/${{ inputs.artifact }}.zip
- name: Download Bun from Github Action
if: ${{ !startsWith(inputs.artifact, 'http://') && !startsWith(inputs.artifact, 'https://') }}
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact }}
path: ${{ runner.temp }}/bun
- name: Setup Bun
shell: bash
run: |
cd ${{ runner.temp }}/bun
unzip ${{ inputs.artifact }}.zip
cd ${{ inputs.artifact }}
chmod +x bun
pwd >> $GITHUB_PATH
- name: Install Dependencies
shell: bash
run: |
bun --version
bun install
bun install --cwd=test
bun install --cwd=packages/bun-internal-test
- name: Run Tests
shell: bash
run: |
node packages/bun-internal-test/src/runner.node.mjs || true

93
.github/workflows/dependencies.yml vendored Normal file
View File

@@ -0,0 +1,93 @@
name: zig-build
on:
workflow_call:
inputs:
cpu:
type: string
required: true
runner:
type: string
required: true
env:
LLVM_VERSION: 16
jobs:
dependencies:
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages (macOS)
if: ${{ runner.os == 'macOS' }}
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install --force \
ccache \
rust \
llvm@${LLVM_VERSION} \
pkg-config \
coreutils \
libtool \
cmake \
libiconv \
automake \
openssl@1.1 \
ninja \
gnu-sed
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: Hash Dependencies
id: dependencies
run: |
print_versions() {
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_versions | sha1sum | cut -c 1-10)" >> $GITHUB_OUTPUT
- name: Cache Dependencies
id: cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ runner.temp }}/bun-deps
key: bun-deps-${{ inputs.runner }}-${{ steps.dependencies.outputs.sha }}
- name: Build Dependencies
if: ${{ !steps.cache-restore.outputs.cache-hit }}
env:
CPU_TARGET: ${{ inputs.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 Dependencies
if: ${{ !steps.cache-restore.outputs.cache-hit }}
id: cache-save
uses: actions/cache/save@v4
with:
path: ${{ runner.temp }}/bun-deps
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: Upload Dependencies
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.runner }}-deps
path: ${{ runner.temp }}/bun-deps
if-no-files-found: error

97
.github/workflows/zig-build.yml vendored Normal file
View File

@@ -0,0 +1,97 @@
name: zig-build
on:
workflow_call:
inputs:
os:
type: string # e.g. 'linux', 'darwin', 'windows'
required: true
arch:
type: string # e.g. 'x64' or 'arm64'
required: true
baseline:
type: boolean
required: false
jobs:
zig-build:
name: zig-build
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-zig-build' || 'ubuntu-latest' }}
steps:
- name: Detect Target
run: |
case "${{ inputs.arch }}" in
x64 | x86_64)
arch="x86_64"
buildarch="amd64"
;;
arm64 | aarch64)
arch="aarch64"
buildarch="arm64"
;;
*)
echo "Unsupported architecture"
exit 1
;;
esac
case "${{ inputs.os }}" in
linux)
triplet="${arch}-linux-gnu"
;;
darwin | macos)
triplet="${arch}-macos-none"
;;
windows | win32)
triplet="${arch}-windows-msvc"
;;
*)
echo "Unsupported operating system"
exit 1
;;
esac
if [ "$arch" = "x86_64" ]; then
if [ -n "${{ inputs.baseline }}" ]; then
cpu="nehalem"
else
cpu="haswell"
fi
else
cpu="native"
fi
echo "ARCH=$arch" >> $GITHUB_ENV
echo "BUILDARCH=$buildarch" >> $GITHUB_ENV
echo "CPU_TARGET=$cpu" >> $GITHUB_ENV
echo "TRIPLET=$triplet" >> $GITHUB_ENV
artifact="bun-zig-$triplet-$cpu"
echo "ARTIFACT=$artifact" >> $GITHUB_ENV
echo "artifact=$artifact" >> $GITHUB_OUTPUT
- name: Login to 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:
push: false
target: build_release_obj
build-args: |
TRIPLET=${{ env.TRIPLET }}
BUILD_MACHINE_ARCH=${{ env.ARCH }}
ARCH=${{ env.ARCH }}
CPU_TARGET=${{ env.CPU_TARGET }}
GIT_SHA=${{ github.sha }}
platforms: |
linux/${{ env.ARCH }}
outputs: |
type=local,dest=${{ runner.temp }}/release
- name: Upload Zig Object
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT }}
path: ${{ runner.temp }}/release/bun-zig.o
if-no-files-found: error