Skip to content

Commit

Permalink
Support canary builds, closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Electroid committed Oct 21, 2022
1 parent 945696c commit ba7768e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: test
on:
push:
paths:
- formula/**.rb
- formula/bun.rb
branches:
- main
pull_request:
paths:
- formula/**.rb
- formula/bun.rb
branches:
- main
workflow_dispatch:
Expand Down
37 changes: 37 additions & 0 deletions formula/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class BunATcanary < Formula
desc "Incredibly fast JavaScript runtime, bundler, transpiler and package manager - all in one."
homepage "https://bun.sh/"
license "MIT"
version "canary"

if OS.mac?
if Hardware::CPU.arm? || Hardware::CPU.in_rosetta2?
url "https://github.com/oven-sh/bun/releases/download/canary/bun-darwin-aarch64.zip"
elsif Hardware::CPU.avx2?
url "https://github.com/oven-sh/bun/releases/download/canary/bun-darwin-x64.zip"
else
url "https://github.com/oven-sh/bun/releases/download/canary/bun-darwin-x64-baseline.zip"
end
elsif OS.linux?
if Hardware::CPU.arm?
url "https://github.com/oven-sh/bun/releases/download/canary/bun-linux-aarch64.zip"
elsif Hardware::CPU.avx2?
url "https://github.com/oven-sh/bun/releases/download/canary/bun-linux-x64.zip"
else
url "https://github.com/oven-sh/bun/releases/download/canary/bun-linux-x64-baseline.zip"
end
else
odie "Unsupported platform. Please submit a bug report here: https://bun.sh/issues\n#{OS.report}"
end

# TODO: to become an official formula we need to build from source
def install
bin.install "bun"
ENV["BUN_INSTALL"] = "#{bin}"
generate_completions_from_executable(bin/"bun", "completions")
end

def test
shell_output("#{bin}/bun -v")
end
end

0 comments on commit ba7768e

Please sign in to comment.