Compare commits

...

34 Commits

Author SHA1 Message Date
Ashcon Partovi
b9a016ddd9 Testing workflows 2024-04-23 15:09:40 -07:00
Ashcon Partovi
b7cf9fc211 Testing workflows 2024-04-23 15:08:49 -07:00
Ashcon Partovi
845d3dd7ad Testing workflows 2024-04-23 15:07:31 -07:00
Ashcon Partovi
98c109c98e Testing workflows 2024-04-23 15:05:44 -07:00
Ashcon Partovi
668a3a292e Testing workflows 2024-04-23 15:04:36 -07:00
Ashcon Partovi
4797eea6cb Testing workflows 2024-04-23 14:14:41 -07:00
Ashcon Partovi
95a8437132 Testing workflows 2024-04-23 14:10:56 -07:00
Ashcon Partovi
4f471de788 Testing workflows 2024-04-23 14:05:28 -07:00
Ashcon Partovi
5762866fe2 Testing workflows 2024-04-23 13:59:51 -07:00
Ashcon Partovi
e29d428528 Testing workflows 2024-04-23 13:47:55 -07:00
Ashcon Partovi
68552563ef Testing workflows 2024-04-23 13:40:10 -07:00
Ashcon Partovi
65ef9f62e5 Testing workflows 2024-04-23 13:24:11 -07:00
Ashcon Partovi
a65ec3f757 Testing workflows 2024-04-23 11:30:18 -07:00
Ashcon Partovi
5c1b746e64 Testing workflows 2024-04-23 11:29:22 -07:00
Ashcon Partovi
2741c15fd4 Testing workflows 2024-04-23 11:28:06 -07:00
Ashcon Partovi
c3c9d6bb52 Testing workflows 2024-04-23 11:26:08 -07:00
Ashcon Partovi
ab3b546e16 Testing workflows 2024-04-23 11:24:00 -07:00
Ashcon Partovi
5673941d15 Testing workflows 2024-04-23 11:21:05 -07:00
Ashcon Partovi
b8f1e0d7fb Testing workflows 2024-04-23 11:20:04 -07:00
Ashcon Partovi
ec64932eee Testing workflows 2024-04-23 10:47:03 -07:00
Ashcon Partovi
de920925f5 Testing workflows 2024-04-23 10:42:41 -07:00
Ashcon Partovi
28ea6295bc Testing workflows 2024-04-23 10:39:45 -07:00
Ashcon Partovi
9974d38691 Testing workflows 2024-04-23 10:36:55 -07:00
Ashcon Partovi
a8ed9b1d67 Testing workflows 2024-04-23 10:34:27 -07:00
Ashcon Partovi
c388faa14d Fix workflow 2024-04-23 10:32:18 -07:00
Ashcon Partovi
b816d40502 Merge branch 'main' into selfhosted-ci 2024-04-22 18:04:15 -07:00
Ashcon Partovi
f0ee9ce983 Fix workflow 2024-04-22 18:02:56 -07:00
Ashcon Partovi
4c124e58ea Fix workflow 2024-04-22 17:55:03 -07:00
Ashcon Partovi
0f57de0897 Fix workflow 2024-04-22 17:50:27 -07:00
Ashcon Partovi
dc78043603 Fix workflow 2024-04-22 17:41:07 -07:00
Ashcon Partovi
3dcfbb6c8d Fix workflow 2024-04-22 17:36:51 -07:00
Ashcon Partovi
1dd63b175c Fix workflow 2024-04-22 17:31:00 -07:00
Ashcon Partovi
1652da76f4 Fix workflow 2024-04-22 17:27:45 -07:00
Ashcon Partovi
e0f9ada5e6 Use self-hosted cache action 2024-04-22 17:24:33 -07:00
22 changed files with 245341 additions and 421 deletions

2
.github/actions/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# GitHub Actions need to specify the bundled script
!dist

28
.github/actions/cache-key/action.mjs vendored Normal file
View File

@@ -0,0 +1,28 @@
import { spawnSync } from "node:child_process";
import { createHash } from "node:crypto";
import { getMultilineInput, setOutput } from "@actions/core";
const paths = getMultilineInput("paths", { required: true });
function getCacheKey() {
console.log("Getting cache key...", paths);
const { error, status, stdout, stderr } = spawnSync("git", ["ls-files", "-s", ...paths], {
encoding: "utf-8",
stdio: "pipe",
});
if (error) {
throw error;
}
if (status !== 0) {
throw new Error(`git ls-files failed: ${stderr}`);
}
return createHash("sha256").update(stdout).digest("hex");
}
function main() {
const cacheKey = getCacheKey();
console.log("Cache key:", cacheKey);
setOutput("cache-key", cacheKey);
}
main();

15
.github/actions/cache-key/action.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: Cache Key
description: Generate a cache key based on a set of inputs
inputs:
paths:
description: The paths to use for the cache key
required: true
outputs:
cache-key:
description: The cache key
runs:
using: node20
main: dist/action.mjs

BIN
.github/actions/cache-key/bun.lockb vendored Executable file

Binary file not shown.

18070
.github/actions/cache-key/dist/action.mjs vendored Normal file

File diff suppressed because one or more lines are too long

11
.github/actions/cache-key/package.json vendored Normal file
View File

@@ -0,0 +1,11 @@
{
"name": "cache-key",
"module": "index.ts",
"type": "module",
"dependencies": {
"@actions/core": "^1.10.1"
},
"scripts": {
"build": "bun build --target=node --outdir dist action.mjs && mv dist/action.js dist/action.mjs"
}
}

89
.github/actions/cache/action.mjs vendored Normal file
View File

@@ -0,0 +1,89 @@
import { getInput, getMultilineInput } from "@actions/core";
import { restoreCache as restoreGithubCache, saveCache as saveGithubCache } from "@actions/cache";
import { cpSync, existsSync, mkdirSync, readdirSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
const path = getInput("path", { required: true });
const key = getInput("key", { required: true });
const restoreKeys = getMultilineInput("restore-keys");
const cacheDir = getInput("cache-dir") || join(tmpdir(), ".github", "cache");
console.log("Received inputs:", { path, key, restoreKeys, cacheDir });
export async function restoreCache() {
if (isGithubHosted()) {
console.log("Using GitHub cache...");
const cacheKey = await restoreGithubCache([path], key, restoreKeys);
return {
cacheHit: !!cacheKey,
cacheKey: cacheKey ?? key,
};
}
console.log("Using local cache...", cacheDir);
if (!existsSync(cacheDir)) {
console.log("Cache directory does not exist, creating it...");
mkdirSync(cacheDir, { recursive: true });
}
const cacheEntry = join(cacheDir, key);
if (existsSync(cacheEntry)) {
console.log("Found cache directory, restoring...", cacheEntry, "(hit)");
copyFiles(cacheEntry, path);
return {
cacheHit: true,
cacheKey: key,
};
}
for (const dirname of readdirSync(cacheDir)) {
if (!dirname.startsWith(key)) {
continue;
}
const cacheEntry = join(cacheDir, dirname);
console.log("Found cache directory, restoring...", cacheEntry, "(miss)");
copyFiles(cacheEntry, path);
return {
cacheHit: false,
cacheKey: key,
cacheMatchedKey: dirname,
};
}
console.log("No cache found...", key);
return {
cacheHit: false,
cacheKey: key,
};
}
export async function saveCache() {
if (isGithubHosted()) {
console.log("Using GitHub cache...");
const cacheId = await saveGithubCache([path], key);
return !!cacheId;
}
console.log("Using local cache...", cacheDir);
if (!existsSync(cacheDir)) {
console.log("Cache directory does not exist, creating it...");
mkdirSync(cacheDir, { recursive: true });
}
const cacheEntry = join(cacheDir, key);
console.log("Copying files to cache...", cacheEntry);
copyFiles(path, cacheEntry);
}
function copyFiles(src, dst) {
cpSync(src, dst, {
recursive: true,
force: true,
preserveTimestamps: true,
});
}
function isGithubHosted() {
return process.env.RUNNER_ENVIRONMENT === "github-hosted" || process.env.RUNNER_NAME?.startsWith("nsc-runner-");
}

27
.github/actions/cache/action.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Cache
description: An internal version of the 'actions/cache' action.
inputs:
path:
description: The path to save the cache
required: true
key:
description: The key to use for the cache
required: true
restore-keys:
description: The restoring keys to use for the cache
required: false
outputs:
cache-hit:
description: If the cache was hit
cache-primary-key:
description: A resolved cache key for which cache match was attempted
cache-matched-key:
description: Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys
runs:
using: node20
main: dist/restore/action.cjs
post: dist/save/action.cjs
post-if: success() || github.event.inputs.save-always

BIN
.github/actions/cache/bun.lockb vendored Executable file

Binary file not shown.

75564
.github/actions/cache/dist/action.cjs vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

75520
.github/actions/cache/dist/save/action.cjs vendored Normal file

File diff suppressed because one or more lines are too long

12
.github/actions/cache/package.json vendored Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "cache",
"module": "action.mjs",
"dependencies": {
"@actions/cache": "^3.2.4",
"@actions/core": "^1.10.1"
},
"scripts": {
"build:bun": "bun build --target=node --outdir dist action.mjs restore/action.mjs save/action.mjs && mv dist/action.js dist/action.mjs && mv dist/restore/action.js dist/restore/action.mjs && mv dist/save/action.js dist/save/action.mjs",
"build:esbuild": "bunx esbuild --bundle --platform=node --target=node20 --outdir=dist action.mjs restore/action.mjs save/action.mjs && mv dist/action.js dist/action.cjs && mv dist/restore/action.js dist/restore/action.cjs && mv dist/save/action.js dist/save/action.cjs"
}
}

View File

@@ -0,0 +1,20 @@
import { setOutput } from "@actions/core";
import { restoreCache } from "../action.mjs";
async function main() {
const { cacheHit, cacheKey, cacheMatchedKey } = await restoreCache();
const outputs = {
"cache-hit": cacheHit,
"cache-primary-key": cacheKey,
"cache-matched-key": cacheMatchedKey ?? cacheKey,
};
for (const [key, value] of Object.entries(outputs)) {
setOutput(key, value);
}
console.log("Set outputs:", outputs);
}
main().catch(error => {
console.error("Failed to restore cache:", error);
process.exit(1);
});

View File

@@ -0,0 +1,25 @@
name: Restore Cache
description: An internal version of the 'actions/cache' action.
inputs:
path:
description: The path to save the cache
required: true
key:
description: The key to use for the cache
required: true
restore-keys:
description: The restoring keys to use for the cache
required: false
outputs:
cache-hit:
description: If the cache was hit
cache-primary-key:
description: A resolved cache key for which cache match was attempted
cache-matched-key:
description: Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys
runs:
using: node20
main: ../dist/restore/action.cjs

10
.github/actions/cache/save/action.mjs vendored Normal file
View File

@@ -0,0 +1,10 @@
import { saveCache } from "../action.mjs";
async function main() {
await saveCache();
}
main().catch(error => {
console.error("Failed to save cache:", error);
process.exit(1);
});

14
.github/actions/cache/save/action.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Save Cache
description: An internal version of the 'actions/cache' action.
inputs:
path:
description: The path to save the cache
required: true
key:
description: The key to use for the cache
required: true
runs:
using: node20
main: ../dist/save/action.cjs

View File

@@ -0,0 +1,18 @@
name: Setup Dependencies
description: Sets up system dependencies needed to build bun.
env:
LLVM_VERSION: 17
runs:
using: composite
steps:
- if: ${{ runner.os == 'Darwin' }}
name: Setup Dependencies
shell: bash
run: |
brew install --force llvm@${{ env.LLVM_VERSION }} ccache rust pkg-config coreutils libtool cmake libiconv automake openssl@1.1 ninja golang 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

View File

@@ -7,9 +7,6 @@ permissions:
on:
workflow_call:
inputs:
runs-on:
type: string
default: macos-12-large
tag:
type: string
required: true
@@ -33,63 +30,34 @@ env:
jobs:
build-submodules:
name: Build Submodules
runs-on: ${{ inputs.runs-on }}
runs-on: darwin-aarch64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Key
id: cache-key
uses: ./.github/actions/cache-key
with:
sparse-checkout: |
.gitmodules
paths: |
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
uses: ./.github/actions/cache/restore
with:
path: ${{ runner.temp }}/bun-deps
key: bun-${{ inputs.tag }}-deps-${{ steps.hash.outputs.hash }}
# TODO: Figure out how to cache homebrew dependencies
- if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
name: Install Dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install \
llvm@${{ env.LLVM_VERSION }} \
ccache \
rust \
pkg-config \
coreutils \
libtool \
cmake \
libiconv \
automake \
openssl@1.1 \
ninja \
golang \
gnu-sed --force
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 }}
key: bun-${{ inputs.tag }}-deps-${{ steps.cache-key.outputs.cache-key }}
restore-keys: |
bun-${{ inputs.tag }}-deps-
- name: Setup Dependencies
uses: ./.github/actions/setup-dependencies
- if: ${{ inputs.no-cache || steps.cache.outputs.cache-hit != 'true' }}
name: Clone Submodules
run: |
./scripts/update-submodules.sh
- name: Build Submodules
if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
if: ${{ inputs.no-cache || steps.cache.outputs.cache-hit != 'true' }}
env:
CPU_TARGET: ${{ inputs.cpu }}
BUN_DEPS_OUT_DIR: ${{ runner.temp }}/bun-deps
@@ -97,8 +65,8 @@ jobs:
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
if: ${{ inputs.no-cache || steps.cache.outputs.cache-hit != 'true' }}
uses: ./.github/actions/cache/save
with:
path: ${{ runner.temp }}/bun-deps
key: ${{ steps.cache.outputs.cache-primary-key }}
@@ -110,47 +78,24 @@ jobs:
if-no-files-found: error
build-cpp:
name: Build C++
runs-on: ${{ inputs.runs-on }}
runs-on: darwin-aarch64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# TODO: Figure out how to cache homebrew dependencies
- name: Install Dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install \
llvm@${{ env.LLVM_VERSION }} \
ccache \
rust \
pkg-config \
coreutils \
libtool \
cmake \
libiconv \
automake \
openssl@1.1 \
ninja \
golang \
gnu-sed --force
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 Dependencies
uses: ./.github/actions/setup-dependencies
- 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
uses: ./.github/actions/cache
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/**') }}
key: bun-${{ inputs.tag }}-cpp-${{ github.ref }}
restore-keys: |
bun-${{ inputs.tag }}-cpp-
- name: Compile
@@ -177,134 +122,134 @@ jobs:
name: bun-${{ inputs.tag }}-cpp
path: ${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a
if-no-files-found: error
build-zig:
name: Build Zig
uses: ./.github/workflows/build-zig.yml
with:
os: darwin
only-zig: true
tag: ${{ inputs.tag }}
arch: ${{ inputs.arch }}
cpu: ${{ inputs.cpu }}
assertions: ${{ inputs.assertions }}
canary: ${{ inputs.canary }}
no-cache: ${{ inputs.no-cache }}
link:
name: Link
runs-on: ${{ inputs.runs-on }}
needs:
- build-submodules
- build-cpp
- build-zig
steps:
- uses: actions/checkout@v4
# TODO: Figure out how to cache homebrew dependencies
- name: Install Dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install \
llvm@${{ env.LLVM_VERSION }} \
ccache \
rust \
pkg-config \
coreutils \
libtool \
cmake \
libiconv \
automake \
openssl@1.1 \
ninja \
golang \
gnu-sed --force
echo "$(brew --prefix ccache)/bin" >> $GITHUB_PATH
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
brew link --overwrite llvm@$LLVM_VERSION
- name: Setup Bun
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Download bun-${{ inputs.tag }}-deps
uses: actions/download-artifact@v4
with:
name: bun-${{ inputs.tag }}-deps
path: ${{ runner.temp }}/bun-deps
- name: Download bun-${{ inputs.tag }}-cpp
uses: actions/download-artifact@v4
with:
name: bun-${{ inputs.tag }}-cpp
path: ${{ runner.temp }}/bun-cpp-obj
- name: Download bun-${{ inputs.tag }}-zig
uses: actions/download-artifact@v4
with:
name: bun-${{ inputs.tag }}-zig
path: ${{ runner.temp }}/release
- if: ${{ !inputs.no-cache }}
name: Restore Cache
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/ccache
key: bun-${{ inputs.tag }}-cpp-${{ hashFiles('Dockerfile', 'Makefile', 'CMakeLists.txt', 'build.zig', 'scripts/**', 'src/**', 'packages/bun-usockets/src/**', 'packages/bun-uws/src/**') }}
restore-keys: |
bun-${{ inputs.tag }}-cpp-
- name: Link
env:
CPU_TARGET: ${{ inputs.cpu }}
CCACHE_DIR: ${{ runner.temp }}/ccache
run: |
SRC_DIR=$PWD
mkdir ${{ runner.temp }}/link-build
cd ${{ runner.temp }}/link-build
cmake $SRC_DIR \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_LTO=ON \
-DBUN_LINK_ONLY=1 \
-DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
-DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
-DBUN_DEPS_OUT_DIR="${{ runner.temp }}/bun-deps" \
-DNO_CONFIGURE_DEPENDS=1
ninja -v
- name: Prepare
run: |
cd ${{ runner.temp }}/link-build
chmod +x bun-profile bun
mkdir -p bun-${{ inputs.tag }}-profile/ bun-${{ inputs.tag }}/
mv bun-profile bun-${{ inputs.tag }}-profile/bun-profile
mv bun bun-${{ inputs.tag }}/bun
zip -r bun-${{ inputs.tag }}-profile.zip bun-${{ inputs.tag }}-profile
zip -r bun-${{ inputs.tag }}.zip bun-${{ inputs.tag }}
- name: Upload bun-${{ inputs.tag }}
uses: actions/upload-artifact@v4
with:
name: bun-${{ inputs.tag }}
path: ${{ runner.temp }}/link-build/bun-${{ inputs.tag }}.zip
if-no-files-found: error
- name: Upload bun-${{ inputs.tag }}-profile
uses: actions/upload-artifact@v4
with:
name: bun-${{ inputs.tag }}-profile
path: ${{ runner.temp }}/link-build/bun-${{ inputs.tag }}-profile.zip
if-no-files-found: error
on-failure:
if: ${{ github.repository_owner == 'oven-sh' && failure() }}
name: On Failure
needs: link
runs-on: ubuntu-latest
steps:
- name: Send Message
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
color: "#FF0000"
title: ""
description: |
### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})
# 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: darwin-aarch64
# needs:
# - build-submodules
# - build-cpp
# - build-zig
# steps:
# - uses: actions/checkout@v4
# # TODO: Figure out how to cache homebrew dependencies
# - name: Install Dependencies
# env:
# HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
# HOMEBREW_NO_AUTO_UPDATE: 1
# HOMEBREW_NO_INSTALL_CLEANUP: 1
# run: |
# brew install \
# llvm@${{ env.LLVM_VERSION }} \
# ccache \
# rust \
# pkg-config \
# coreutils \
# libtool \
# cmake \
# libiconv \
# automake \
# openssl@1.1 \
# ninja \
# golang \
# gnu-sed --force
# 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: ./.github/actions/cache
# with:
# path: ${{ runner.temp }}/ccache
# key: bun-${{ inputs.tag }}-cpp-${{ hashFiles('Dockerfile', 'Makefile', 'CMakeLists.txt', 'build.zig', 'scripts/**', 'src/**', 'packages/bun-usockets/src/**', 'packages/bun-uws/src/**') }}
# restore-keys: |
# bun-${{ inputs.tag }}-cpp-
# - name: Link
# env:
# CPU_TARGET: ${{ inputs.cpu }}
# CCACHE_DIR: ${{ runner.temp }}/ccache
# run: |
# SRC_DIR=$PWD
# mkdir ${{ runner.temp }}/link-build
# cd ${{ runner.temp }}/link-build
# cmake $SRC_DIR \
# -G Ninja \
# -DCMAKE_BUILD_TYPE=Release \
# -DUSE_LTO=ON \
# -DBUN_LINK_ONLY=1 \
# -DBUN_ZIG_OBJ="${{ runner.temp }}/release/bun-zig.o" \
# -DBUN_CPP_ARCHIVE="${{ runner.temp }}/bun-cpp-obj/bun-cpp-objects.a" \
# -DBUN_DEPS_OUT_DIR="${{ runner.temp }}/bun-deps" \
# -DNO_CONFIGURE_DEPENDS=1
# ninja -v
# - name: Prepare
# run: |
# cd ${{ runner.temp }}/link-build
# chmod +x bun-profile bun
# mkdir -p bun-${{ inputs.tag }}-profile/ bun-${{ inputs.tag }}/
# mv bun-profile bun-${{ inputs.tag }}-profile/bun-profile
# mv bun bun-${{ inputs.tag }}/bun
# zip -r bun-${{ inputs.tag }}-profile.zip bun-${{ inputs.tag }}-profile
# zip -r bun-${{ inputs.tag }}.zip bun-${{ inputs.tag }}
# - name: Upload bun-${{ inputs.tag }}
# uses: actions/upload-artifact@v4
# with:
# name: bun-${{ inputs.tag }}
# path: ${{ runner.temp }}/link-build/bun-${{ inputs.tag }}.zip
# if-no-files-found: error
# - name: Upload bun-${{ inputs.tag }}-profile
# uses: actions/upload-artifact@v4
# with:
# name: bun-${{ inputs.tag }}-profile
# path: ${{ runner.temp }}/link-build/bun-${{ inputs.tag }}-profile.zip
# if-no-files-found: error
# on-failure:
# if: ${{ github.repository_owner == 'oven-sh' && failure() }}
# name: On Failure
# needs: link
# runs-on: ubuntu-latest
# steps:
# - name: Send Message
# uses: sarisia/actions-status-discord@v1
# with:
# webhook: ${{ secrets.DISCORD_WEBHOOK }}
# nodetail: true
# color: "#FF0000"
# title: ""
# description: |
# ### ❌ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }})
@${{ github.actor }}, the build for bun-${{ inputs.tag }} failed.
# @${{ github.actor }}, the build for bun-${{ inputs.tag }} failed.
**[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})**
# **[View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})**

View File

@@ -44,6 +44,7 @@ jobs:
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
.gitmodules
src/deps
scripts
@@ -61,7 +62,7 @@ jobs:
- if: ${{ !inputs.no-cache }}
name: Restore Cache
id: cache
uses: actions/cache/restore@v4
uses: ./.github/actions/cache/restore
with:
path: bun-deps
key: bun-${{ inputs.tag }}-deps-${{ steps.hash.outputs.hash }}
@@ -93,7 +94,7 @@ jobs:
.\scripts\all-dependencies.ps1
- name: Save Cache
if: ${{ inputs.no-cache || !steps.cache.outputs.cache-hit }}
uses: actions/cache/save@v4
uses: ./.github/actions/cache/save
with:
path: bun-deps
key: ${{ steps.cache.outputs.cache-primary-key }}
@@ -157,7 +158,7 @@ jobs:
bun-version: ${{ env.BUN_VERSION }}
- if: ${{ !inputs.no-cache }}
name: Restore Cache
uses: actions/cache@v4
uses: ./.github/actions/cache
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/**') }}
@@ -256,7 +257,7 @@ jobs:
path: build
- if: ${{ !inputs.no-cache }}
name: Restore Cache
uses: actions/cache@v4
uses: ./.github/actions/cache
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/**') }}

View File

@@ -51,7 +51,7 @@ jobs:
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
uses: ./.github/actions/cache
with:
key: bun-${{ inputs.tag }}-docker-${{ steps.cache.outputs.key }}
restore-keys: |

View File

@@ -5,7 +5,7 @@ permissions:
actions: write
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.run-id || github.ref }}
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.run-id || github.ref }}
cancel-in-progress: true
on:
@@ -15,228 +15,218 @@ on:
type: string
description: The workflow ID to download artifacts (skips the build step)
pull_request:
paths-ignore:
- .vscode/**/*
- docs/**/*
- examples/**/*
push:
branches:
- main
paths-ignore:
- .vscode/**/*
- docs/**/*
- examples/**/*
jobs:
format:
if: ${{ !inputs.run-id }}
name: Format
uses: ./.github/workflows/run-format.yml
secrets: inherit
with:
zig-version: 0.12.0-dev.1828+225fe6ddb
permissions:
contents: write
lint:
if: ${{ !inputs.run-id }}
name: Lint
uses: ./.github/workflows/run-lint.yml
secrets: inherit
linux-x64:
if: ${{ !inputs.run-id }}
name: Build linux-x64
uses: ./.github/workflows/build-linux.yml
secrets: inherit
with:
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
tag: linux-x64
arch: x64
cpu: haswell
canary: true
linux-x64-baseline:
if: ${{ !inputs.run-id }}
name: Build linux-x64-baseline
uses: ./.github/workflows/build-linux.yml
secrets: inherit
with:
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
tag: linux-x64-baseline
arch: x64
cpu: nehalem
canary: true
linux-aarch64:
if: ${{ !inputs.run-id && github.repository_owner == 'oven-sh' }}
name: Build linux-aarch64
uses: ./.github/workflows/build-linux.yml
secrets: inherit
with:
runs-on: namespace-profile-bun-ci-linux-aarch64
tag: linux-aarch64
arch: aarch64
cpu: native
canary: true
darwin-x64:
if: ${{ !inputs.run-id }}
name: Build darwin-x64
uses: ./.github/workflows/build-darwin.yml
secrets: inherit
with:
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
tag: darwin-x64
arch: x64
cpu: haswell
canary: true
darwin-x64-baseline:
if: ${{ !inputs.run-id }}
name: Build darwin-x64-baseline
uses: ./.github/workflows/build-darwin.yml
secrets: inherit
with:
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
tag: darwin-x64-baseline
arch: x64
cpu: nehalem
canary: true
# format:
# if: ${{ !github.event.inputs.run-id }}
# name: Format
# uses: ./.github/workflows/run-format.yml
# secrets: inherit
# with:
# zig-version: 0.12.0-dev.1828+225fe6ddb
# permissions:
# contents: write
# lint:
# if: ${{ !github.event.inputs.run-id }}
# name: Lint
# uses: ./.github/workflows/run-lint.yml
# secrets: inherit
# linux-x64:
# if: ${{ !github.event.inputs.run-id }}
# name: Build linux-x64
# uses: ./.github/workflows/build-linux.yml
# secrets: inherit
# with:
# runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
# tag: linux-x64
# arch: x64
# cpu: haswell
# canary: true
# linux-x64-baseline:
# if: ${{ !github.event.inputs.run-id }}
# name: Build linux-x64-baseline
# uses: ./.github/workflows/build-linux.yml
# secrets: inherit
# with:
# runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
# tag: linux-x64-baseline
# arch: x64
# cpu: nehalem
# canary: true
# linux-aarch64:
# if: ${{ !github.event.inputs.run-id && github.repository_owner == 'oven-sh' }}
# name: Build linux-aarch64
# uses: ./.github/workflows/build-linux.yml
# secrets: inherit
# with:
# runs-on: namespace-profile-bun-ci-linux-aarch64
# tag: linux-aarch64
# arch: aarch64
# cpu: native
# canary: true
# darwin-x64:
# if: ${{ !github.event.inputs.run-id }}
# name: Build darwin-x64
# uses: ./.github/workflows/build-darwin.yml
# secrets: inherit
# with:
# runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
# tag: darwin-x64
# arch: x64
# cpu: haswell
# canary: true
# darwin-x64-baseline:
# if: ${{ !github.event.inputs.run-id }}
# name: Build darwin-x64-baseline
# uses: ./.github/workflows/build-darwin.yml
# secrets: inherit
# with:
# runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
# tag: darwin-x64-baseline
# arch: x64
# cpu: nehalem
# canary: true
darwin-aarch64:
if: ${{ !inputs.run-id }}
name: Build darwin-aarch64
uses: ./.github/workflows/build-darwin.yml
secrets: inherit
with:
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-darwin-aarch64' || 'macos-13' }}
tag: darwin-aarch64
arch: aarch64
cpu: native
canary: true
windows-x64:
if: ${{ !inputs.run-id }}
name: Build windows-x64
uses: ./.github/workflows/build-windows.yml
secrets: inherit
with:
runs-on: windows
tag: windows-x64
arch: x64
cpu: haswell
canary: true
windows-x64-baseline:
if: ${{ !inputs.run-id }}
name: Build windows-x64-baseline
uses: ./.github/workflows/build-windows.yml
secrets: inherit
with:
runs-on: windows
tag: windows-x64-baseline
arch: x64
cpu: nehalem
canary: true
linux-x64-test:
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
name: Test linux-x64
needs: linux-x64
uses: ./.github/workflows/run-test.yml
secrets: inherit
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
tag: linux-x64
linux-x64-baseline-test:
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
name: Test linux-x64-baseline
needs: linux-x64-baseline
uses: ./.github/workflows/run-test.yml
secrets: inherit
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
tag: linux-x64-baseline
linux-aarch64-test:
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'}}
name: Test linux-aarch64
needs: linux-aarch64
uses: ./.github/workflows/run-test.yml
secrets: inherit
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: namespace-profile-bun-ci-linux-aarch64
tag: linux-aarch64
darwin-x64-test:
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
name: Test darwin-x64
needs: darwin-x64
uses: ./.github/workflows/run-test.yml
secrets: inherit
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
tag: darwin-x64
darwin-x64-baseline-test:
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
name: Test darwin-x64-baseline
needs: darwin-x64-baseline
uses: ./.github/workflows/run-test.yml
secrets: inherit
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
tag: darwin-x64-baseline
darwin-aarch64-test:
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
name: Test darwin-aarch64
needs: darwin-aarch64
uses: ./.github/workflows/run-test.yml
secrets: inherit
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-darwin-aarch64' || 'macos-13' }}
tag: darwin-aarch64
windows-x64-test:
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
name: Test windows-x64
needs: windows-x64
uses: ./.github/workflows/run-test.yml
secrets: inherit
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: windows
tag: windows-x64
windows-x64-baseline-test:
if: ${{ inputs.run-id && always() || github.event_name == 'pull_request' }}
name: Test windows-x64-baseline
needs: windows-x64-baseline
uses: ./.github/workflows/run-test.yml
secrets: inherit
with:
run-id: ${{ inputs.run-id }}
pr-number: ${{ github.event.number }}
runs-on: windows
tag: windows-x64-baseline
cleanup:
if: ${{ always() }}
name: Cleanup
needs:
- linux-x64
- linux-x64-baseline
- linux-aarch64
- darwin-x64
- darwin-x64-baseline
- darwin-aarch64
- windows-x64
- windows-x64-baseline
runs-on: ubuntu-latest
steps:
- name: Cleanup Artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
bun-*-cpp
bun-*-zig
bun-*-deps
bun-*-codegen
# windows-x64:
# if: ${{ !github.event.inputs.run-id }}
# name: Build windows-x64
# uses: ./.github/workflows/build-windows.yml
# secrets: inherit
# with:
# runs-on: windows
# tag: windows-x64
# arch: x64
# cpu: haswell
# canary: true
# windows-x64-baseline:
# if: ${{ !github.event.inputs.run-id }}
# name: Build windows-x64-baseline
# uses: ./.github/workflows/build-windows.yml
# secrets: inherit
# with:
# runs-on: windows
# tag: windows-x64-baseline
# arch: x64
# cpu: nehalem
# canary: true
# linux-x64-test:
# if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
# name: Test linux-x64
# needs: linux-x64
# uses: ./.github/workflows/run-test.yml
# secrets: inherit
# with:
# run-id: ${{ inputs.run-id }}
# pr-number: ${{ github.event.number }}
# runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
# tag: linux-x64
# linux-x64-baseline-test:
# if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
# name: Test linux-x64-baseline
# needs: linux-x64-baseline
# uses: ./.github/workflows/run-test.yml
# secrets: inherit
# with:
# run-id: ${{ inputs.run-id }}
# pr-number: ${{ github.event.number }}
# runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-linux-x64' || 'ubuntu-latest' }}
# tag: linux-x64-baseline
# linux-aarch64-test:
# if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' && github.repository_owner == 'oven-sh'}}
# name: Test linux-aarch64
# needs: linux-aarch64
# uses: ./.github/workflows/run-test.yml
# secrets: inherit
# with:
# run-id: ${{ inputs.run-id }}
# pr-number: ${{ github.event.number }}
# runs-on: namespace-profile-bun-ci-linux-aarch64
# tag: linux-aarch64
# darwin-x64-test:
# if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
# name: Test darwin-x64
# needs: darwin-x64
# uses: ./.github/workflows/run-test.yml
# secrets: inherit
# with:
# run-id: ${{ inputs.run-id }}
# pr-number: ${{ github.event.number }}
# runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
# tag: darwin-x64
# darwin-x64-baseline-test:
# if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
# name: Test darwin-x64-baseline
# needs: darwin-x64-baseline
# uses: ./.github/workflows/run-test.yml
# secrets: inherit
# with:
# run-id: ${{ inputs.run-id }}
# pr-number: ${{ github.event.number }}
# runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-large' || 'macos-13' }}
# tag: darwin-x64-baseline
# darwin-aarch64-test:
# if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
# name: Test darwin-aarch64
# needs: darwin-aarch64
# uses: ./.github/workflows/run-test.yml
# secrets: inherit
# with:
# run-id: ${{ inputs.run-id }}
# pr-number: ${{ github.event.number }}
# runs-on: ${{ github.repository_owner == 'oven-sh' && 'namespace-profile-bun-ci-darwin-aarch64' || 'macos-13' }}
# tag: darwin-aarch64
# windows-x64-test:
# if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
# name: Test windows-x64
# needs: windows-x64
# uses: ./.github/workflows/run-test.yml
# secrets: inherit
# with:
# run-id: ${{ inputs.run-id }}
# pr-number: ${{ github.event.number }}
# runs-on: windows
# tag: windows-x64
# windows-x64-baseline-test:
# if: ${{ github.event.inputs.run-id && always() || github.event_name == 'pull_request' }}
# name: Test windows-x64-baseline
# needs: windows-x64-baseline
# uses: ./.github/workflows/run-test.yml
# secrets: inherit
# with:
# run-id: ${{ inputs.run-id }}
# pr-number: ${{ github.event.number }}
# runs-on: windows
# tag: windows-x64-baseline
# cleanup:
# if: ${{ always() }}
# name: Cleanup
# needs:
# - linux-x64
# - linux-x64-baseline
# - linux-aarch64
# - darwin-x64
# - darwin-x64-baseline
# - darwin-aarch64
# - windows-x64
# - windows-x64-baseline
# runs-on: ubuntu-latest
# steps:
# - name: Cleanup Artifacts
# uses: geekyeggo/delete-artifact@v5
# with:
# name: |
# bun-*-cpp
# bun-*-zig
# bun-*-deps
# bun-*-codegen