Skip to content

Update build.yml

Update build.yml #205

Workflow file for this run

name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
macos:
name: macOS
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
strategy:
matrix:
include:
- runner: macos-12
lto_flag: ""
cpu: haswell
label: bun-webkit-macos-amd64-debug
brew_prefix: /usr/local/opt
package_json_arch: "x64"
CMAKE_BUILD_TYPE: Debug
- runner: macOS-arm64
lto_flag: ""
cpu: native
label: bun-webkit-macos-arm64-debug
brew_prefix: /opt/homebrew/opt
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: Debug
- runner: macos-12
lto_flag: -flto='full'
cpu: haswell
label: bun-webkit-macos-amd64-lto
brew_prefix: /usr/local/opt
package_json_arch: "x64"
CMAKE_BUILD_TYPE: Release
- runner: macos-12
lto_flag: ""
cpu: haswell
label: bun-webkit-macos-amd64
brew_prefix: /usr/local/opt
package_json_arch: "x64"
CMAKE_BUILD_TYPE: Release
- runner: macOS-arm64
lto_flag: -flto='full'
cpu: native
label: bun-webkit-macos-arm64-lto
brew_prefix: /opt/homebrew/opt
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: Release
- runner: macOS-arm64
lto_flag: ""
cpu: native
label: bun-webkit-macos-arm64
brew_prefix: /opt/homebrew/opt
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: Release
steps:
- uses: actions/checkout@v3
- name: PATH
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
run: |
echo "${{matrix.brew_prefix}}/llvm@16/bin" >> $GITHUB_PATH
brew install llvm@16 python icu4c ninja -f --overwrite
brew link llvm@16 -f --overwrite
- name: Run
env:
ICU_INCLUDE_DIRS: ${{matrix.brew_prefix}}/icu4c/include
LDFLAGS: "${{env.LDFLAGS}} -L${{matrix.brew_prefix}}/llvm/lib/c++ -Wl,-rpath,${{matrix.brew_prefix}}/llvm/lib/c++"
CC: "${{matrix.brew_prefix}}/llvm@16/bin/clang"
CXX: "${{matrix.brew_prefix}}/llvm@16/bin/clang++"
CMAKE_C_COMPILER: "${{matrix.brew_prefix}}/llvm@16/bin/clang"
CMAKE_CXX_COMPILER: "${{matrix.brew_prefix}}/llvm@16/bin/clang++"
CMAKE_C_FLAGS: "-fuse-ld=lld -fno-exceptions ${{matrix.lto_flag}} -fvisibility=hidden -fvisibility-inlines-hidden -O3"
CMAKE_CXX_FLAGS: "-fuse-ld=lld -I${{matrix.brew_prefix}}/llvm/include -fno-exceptions ${{matrix.lto_flag}} -fvisibility=hidden -fvisibility-inlines-hidden -O3"
CMAKE_OSX_DEPLOYMENT_TARGET: "12.0"
CMAKE_BUILD_TYPE: ${{matrix.CMAKE_BUILD_TYPE}}
PACKAGE_JSON_ARCH: ${{matrix.package_json_arch}}
PACKAGE_JSON_LABEL: ${{matrix.label}}
run: GITHUB_REPOSITORY=$GITHUB_REPOSITORY bash mac-release.bash
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.label}}
path: ${{runner.temp}}/bun-webkit.tar.gz
linux:
name: Linux
runs-on: ${{matrix.os}}
strategy:
matrix:
include:
- lto_flag: ""
label: bun-webkit-linux-amd64-debug
os: big-ubuntu
package_json_arch: "x64"
CMAKE_BUILD_TYPE: "Debug"
- lto_flag: ""
label: bun-webkit-linux-arm64-debug
os: big-ubuntu
package_json_arch: "x64"
CMAKE_BUILD_TYPE: "Debug"
- lto_flag: "-flto='full'"
label: bun-webkit-linux-arm64-lto
os: linux-arm64
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: "Release"
- lto_flag: ""
label: bun-webkit-linux-arm64
os: linux-arm64
package_json_arch: "arm64"
CMAKE_BUILD_TYPE: "Release"
- lto_flag: "-flto='full'"
label: bun-webkit-linux-amd64-lto
os: big-ubuntu
package_json_arch: "x64"
CMAKE_BUILD_TYPE: "Release"
- lto_flag: ""
label: bun-webkit-linux-amd64
os: big-ubuntu
package_json_arch: "x64"
CMAKE_BUILD_TYPE: "Release"
timeout-minutes: 90
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
- name: Run
run: |
rm -rf ${{runner.temp}}/bun-webkit ${{runner.temp}}/bun-webkit.tar.gz
WEBKIT_RELEASE_TYPE=${{matrix.CMAKE_BUILD_TYPE}} CPU="native" cpu=native LTO_FLAG=${{matrix.lto_flag}} temp=${{runner.temp}} bash release.sh
cd ${{runner.temp}}
echo "#define BUN_WEBKIT_VERSION \"${{github.sha}}\"" >> bun-webkit/include/cmakeconfig.h
echo '{ "name": "${{matrix.label}}", "version": "0.0.1-${{github.sha}}", "os": ["linux"], "cpu": ["${{matrix.package_json_arch}}"], "repository": "https://github.com/${{github.repository}}" }' > bun-webkit/package.json
rm -rf bun-webkit/lib/*.so
rm -rf bun-webkit/lib/*.so.*
tar -czf bun-webkit.tar.gz bun-webkit
rm -rf bun-webkit
- uses: actions/upload-artifact@v3
with:
name: ${{matrix.label}}
path: ${{runner.temp}}/bun-webkit.tar.gz
release:
name: release
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 90
needs:
- linux
- macos
steps:
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-amd64
path: ${{runner.temp}}/bun-webkit-linux-amd64
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-arm64
path: ${{runner.temp}}/bun-webkit-linux-arm64
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-amd64-debug
path: ${{runner.temp}}/bun-webkit-linux-amd64-debug
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-arm64-debug
path: ${{runner.temp}}/bun-webkit-linux-arm64-debug
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-arm64
path: ${{runner.temp}}/bun-webkit-macos-arm64
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-arm64-debug
path: ${{runner.temp}}/bun-webkit-macos-arm64-debug
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-arm64-lto
path: ${{runner.temp}}/bun-webkit-macos-arm64-lto
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-amd64
path: ${{runner.temp}}/bun-webkit-macos-amd64
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-amd64-debug
path: ${{runner.temp}}/bun-webkit-macos-amd64-debug
- uses: actions/download-artifact@v3
with:
name: bun-webkit-macos-amd64-lto
path: ${{runner.temp}}/bun-webkit-macos-amd64-lto
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-amd64-lto
path: ${{runner.temp}}/bun-webkit-linux-amd64-lto
- uses: actions/download-artifact@v3
with:
name: bun-webkit-linux-arm64-lto
path: ${{runner.temp}}/bun-webkit-linux-arm64-lto
- name: Rename files
run: |
mv ${{runner.temp}}/bun-webkit-linux-amd64/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-amd64.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-arm64/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-arm64.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-arm64/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-arm64.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-amd64/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-amd64.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-amd64-debug/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-amd64-debug.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-arm64-debug/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-arm64-debug.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-arm64-debug/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-arm64-debug.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-amd64-debug/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-amd64-debug.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-arm64-lto/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-arm64-lto.tar.gz
mv ${{runner.temp}}/bun-webkit-macos-amd64-lto/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-macos-amd64-lto.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-arm64-lto/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-arm64-lto.tar.gz
mv ${{runner.temp}}/bun-webkit-linux-amd64-lto/bun-webkit.tar.gz ${{runner.temp}}/bun-webkit-linux-amd64-lto.tar.gz
- name: Release
uses: softprops/action-gh-release@v1
id: release
with:
prerelease: true
generate_release_notes: true
tag_name: "autobuild-${{github.sha}}"
files: |
${{runner.temp}}/bun-webkit-linux-amd64-debug.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64-debug.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64-debug.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64-debug.tar.gz
${{runner.temp}}/bun-webkit-linux-amd64.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64.tar.gz
${{runner.temp}}/bun-webkit-linux-amd64-lto.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64-lto.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64-lto.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64-lto.tar.gz
- name: Canary
uses: softprops/action-gh-release@v1
with:
prerelease: true
generate_release_notes: true
tag_name: "canary"
files: |
${{runner.temp}}/bun-webkit-linux-amd64.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64.tar.gz
${{runner.temp}}/bun-webkit-linux-amd64-debug.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64-debug.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64-debug.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64-debug.tar.gz
${{runner.temp}}/bun-webkit-linux-amd64-lto.tar.gz
${{runner.temp}}/bun-webkit-linux-arm64-lto.tar.gz
${{runner.temp}}/bun-webkit-macos-arm64-lto.tar.gz
${{runner.temp}}/bun-webkit-macos-amd64-lto.tar.gz
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: |
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-linux-amd64-lto.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-linux-arm64-lto.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-macos-arm64-lto.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-macos-amd64-lto.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-linux-amd64.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-linux-arm64.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-macos-arm64.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit
cd ${{runner.temp}}
tar -xzf bun-webkit-macos-amd64.tar.gz
cd bun-webkit
npm publish --tag next --access=public
rm -rf ${{runner.temp}}/bun-webkit-lto ${{runner.temp}}/bun-webkit ${{runner.temp}}/bun-webkit-debug
mkdir -p ${{runner.temp}}/bun-webkit-lto ${{runner.temp}}/bun-webkit ${{runner.temp}}/bun-webkit-debug
echo '{ "name": "bun-webkit", "version": "0.0.1-${{github.sha}}", "repository": "https://github.com/${{github.repository}}", "optionalDependencies": {"bun-webkit-linux-amd64": "0.0.1-${{github.sha}}", "bun-webkit-linux-arm64": "0.0.1-${{github.sha}}", "bun-webkit-macos-arm64": "0.0.1-${{github.sha}}", "bun-webkit-macos-amd64": "0.0.1-${{github.sha}}"} }' > ${{runner.temp}}/bun-webkit/package.json
echo '{ "name": "bun-webkit-lto", "version": "0.0.1-${{github.sha}}", "repository": "https://github.com/${{github.repository}}", "optionalDependencies": {"bun-webkit-linux-amd64-lto": "0.0.1-${{github.sha}}", "bun-webkit-linux-arm64-lto": "0.0.1-${{github.sha}}", "bun-webkit-macos-arm64-lto": "0.0.1-${{github.sha}}", "bun-webkit-macos-amd64-lto": "0.0.1-${{github.sha}}"} }' > ${{runner.temp}}/bun-webkit-lto/package.json
echo '{ "name": "bun-webkit-debug", "version": "0.0.1-${{github.sha}}", "repository": "https://github.com/${{github.repository}}", "config": {"bun-webkit-linux-amd64-debug": "${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }}", "bun-webkit-linux-arm64-debug": "${{ fromJSON(steps.release.outputs.assets)[1].browser_download_url }}", "bun-webkit-macos-arm64-debug": "${{ fromJSON(steps.release.outputs.assets)[2].browser_download_url }}", "bun-webkit-macos-amd64-debug": "${{ fromJSON(steps.release.outputs.assets)[3].browser_download_url }}"} }' > ${{runner.temp}}/bun-webkit-debug/package.json
echo "$README_TEXT" > ${{runner.temp}}/bun-webkit/README.md
echo "$README_TEXT" > ${{runner.temp}}/bun-webkit-lto/README.md
echo "$README_TEXT" > ${{runner.temp}}/bun-webkit-debug/README.md
cd ${{runner.temp}}/bun-webkit
npm publish --tag next --access=public
cd ${{runner.temp}}/bun-webkit-lto
npm publish --tag next --access=public
cd ${{runner.temp}}/bun-webkit-debug
npm publish --tag next --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
README_TEXT: |
# WebKit
[Bun](https://bun.sh) is a new all-in-one JavaScript runtime.
This is Bun's WebKit build. The optional dependencies of this package have prebuilt JavaScriptCore/WebKit static libraries.
The goal of this package is to simplify contributing to Bun. Instead of cloning and building WebKit yourself, you can use this package.
This version corresponds to #[${{github.sha}}](https://github.com/${{github.repository}}/commit/${{github.sha}}).