-
Notifications
You must be signed in to change notification settings - Fork 18
Add Homebrew tap support #527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
anirudhwarrier
wants to merge
3
commits into
main
Choose a base branch
from
aw/homebrew-tap
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| name: Homebrew | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| pull_request: | ||
| paths: | ||
| - Formula/** | ||
| - .github/workflows/homebrew.yml | ||
|
|
||
| jobs: | ||
| update-formula: | ||
| name: Update Homebrew Formula | ||
| if: github.event_name == 'release' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2 | ||
|
Check warning on line 20 in .github/workflows/homebrew.yml
|
||
| with: | ||
| ref: main | ||
|
|
||
| - name: Update Formula | ||
| run: ./scripts/update-homebrew-formula.sh "${{ github.event.release.tag_name }}" | ||
|
|
||
| - name: Commit and Push Formula Update | ||
| run: | | ||
| if git diff --quiet -- Formula/cre.rb; then | ||
| echo "Formula already up to date." | ||
| exit 0 | ||
| fi | ||
|
|
||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git add Formula/cre.rb | ||
| git commit -m "chore(homebrew): update cre formula to ${{ github.event.release.tag_name }}" | ||
| git push | ||
|
|
||
| validate-formula: | ||
| name: Validate Homebrew Formula (${{ matrix.os }}) | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ${{ matrix.runner }} | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: macOS | ||
| runner: macos-latest | ||
| - os: Linux | ||
| runner: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2 | ||
|
Check warning on line 56 in .github/workflows/homebrew.yml
|
||
|
|
||
| - name: Set up Homebrew | ||
| if: matrix.os == 'Linux' | ||
| run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Install Formula | ||
| env: | ||
| HOMEBREW_NO_REQUIRE_TAP_TRUST: 1 | ||
| run: | | ||
| brew tap smartcontractkit/cre-cli "${{ github.workspace }}" | ||
| brew install smartcontractkit/cre-cli/cre | ||
|
|
||
| - name: Test Formula | ||
| run: brew test cre | ||
|
|
||
| - name: Audit Formula | ||
| run: brew audit --strict cre | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| class Cre < Formula | ||
| desc "Chainlink Runtime Environment CLI" | ||
| homepage "https://chain.link/chainlink-runtime-environment" | ||
| version "1.24.0" | ||
| license "MIT" | ||
|
|
||
| on_macos do | ||
| on_arm do | ||
| url "https://github.com/smartcontractkit/cre-cli/releases/download/v1.24.0/cre_darwin_arm64.zip" | ||
| sha256 "f4fb8837a6100f9c60cdf78af8fa7f3add681b2fa1938d47cd2786f195ee8756" | ||
| end | ||
| on_intel do | ||
| url "https://github.com/smartcontractkit/cre-cli/releases/download/v1.24.0/cre_darwin_amd64.zip" | ||
| sha256 "98f88553f98830cf275cfa935f83b080839a833691ebe6946f8e7592e88b5c38" | ||
| end | ||
| end | ||
|
|
||
| on_linux do | ||
| on_arm do | ||
| url "https://github.com/smartcontractkit/cre-cli/releases/download/v1.24.0/cre_linux_arm64.tar.gz" | ||
| sha256 "302cf8356618c7f02191a2ed1c04544d31dea5014f1f16736e7ca66dd9fb17ff" | ||
| end | ||
| on_intel do | ||
| url "https://github.com/smartcontractkit/cre-cli/releases/download/v1.24.0/cre_linux_amd64.tar.gz" | ||
| sha256 "68e93dcda31ee02cee956575f5455e90748e5dba2971ee7868e33e82f8be6027" | ||
| end | ||
| end | ||
|
|
||
| def install | ||
| arch = Hardware::CPU.arm? ? "arm64" : "amd64" | ||
| platform = OS.mac? ? "darwin" : "linux" | ||
| bin.install Dir["cre_v*_#{platform}_#{arch}"].first => "cre" | ||
| end | ||
|
|
||
| def caveats | ||
| <<~EOS | ||
| Go 1.25.3 or later and Bun 1.0.0 or later are recommended for developing | ||
| and running TypeScript CRE workflows. | ||
| EOS | ||
| end | ||
|
|
||
| test do | ||
| assert_match "CRE CLI version v#{version}", shell_output("#{bin}/cre version") | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Homebrew Core Prerequisites | ||
|
|
||
| This document tracks blockers for submitting `cre` to [homebrew-core](https://github.com/Homebrew/homebrew-core) so users can run `brew install cre` without a tap. | ||
|
|
||
| The in-repo formula at [Formula/cre.rb](Formula/cre.rb) is the supported distribution path until these prerequisites are met. | ||
|
|
||
| ## Current blockers | ||
|
|
||
| | Blocker | Status | Notes | | ||
| |---|---|---| | ||
| | Notability | Blocked | Homebrew requires ~225 GitHub stars for self-submitted software. cre-cli currently has low adoption relative to that threshold. | | ||
| | Source build | Blocked | Production builds use `CGO_ENABLED=1` and a GitHub token for `smartcontractkit/*` modules. Homebrew CI cannot use private credentials. | | ||
| | Go version alignment | Blocked | `go.mod` specifies Go 1.26.4 while CI/release workflows use Go 1.25.x. Versions should be aligned before submission. | | ||
| | Stable test output | Ready | `cre version` prints `CRE CLI version vX.Y.Z`, suitable for a `test do` block. | | ||
|
|
||
| ## Required before opening a homebrew-core PR | ||
|
|
||
| 1. Grow project notability (stars, forks, documented adoption). | ||
| 2. Ensure `go build` succeeds on a clean machine without `GITHUB_TOKEN` (all modules publicly resolvable). | ||
| 3. Document and satisfy any CGO/system library requirements for source builds. | ||
| 4. Align Go versions across `go.mod`, CI, and release workflows. | ||
| 5. Fork `homebrew/homebrew-core`, add `Formula/c/cre.rb` as a **source-build** formula, and pass: | ||
| - `brew audit --new-formula --strict cre` | ||
| - `brew install --build-from-source cre` | ||
| - `brew test cre` | ||
|
|
||
| ## Source-build formula sketch | ||
|
|
||
| When the blockers above are resolved, use a source-build formula similar to: | ||
|
|
||
| ```ruby | ||
| class Cre < Formula | ||
| desc "Chainlink Runtime Environment CLI" | ||
| homepage "https://chain.link/chainlink-runtime-environment" | ||
| url "https://github.com/smartcontractkit/cre-cli/archive/refs/tags/vX.Y.Z.tar.gz" | ||
| sha256 "..." | ||
| license "MIT" | ||
|
|
||
| depends_on "go" => :build | ||
|
|
||
| def install | ||
| ldflags = "-s -w -X github.com/smartcontractkit/cre-cli/cmd/version.Version=version v#{version}" | ||
| system "go", "build", *std_go_args(ldflags:), "." | ||
| end | ||
|
|
||
| test do | ||
| assert_match "CRE CLI version v#{version}", shell_output("#{bin}/cre version") | ||
| end | ||
| end | ||
| ``` | ||
|
|
||
| ## Submission checklist | ||
|
|
||
| 1. Confirm all blockers above are resolved. | ||
| 2. Open a PR titled `cre X.Y.Z (new formula)` against `homebrew/homebrew-core`. | ||
| 3. Respond to maintainer review feedback until CI passes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Update Formula/cre.rb with version and checksums from a published GitHub release. | ||
| # | ||
| # Usage: | ||
| # ./scripts/update-homebrew-formula.sh v1.24.0 | ||
| # ./scripts/update-homebrew-formula.sh # uses latest published release | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| REPO="smartcontractkit/cre-cli" | ||
| FORMULA_FILE="Formula/cre.rb" | ||
| GITHUB_API="https://api.github.com/repos/${REPO}" | ||
|
|
||
| fail() { | ||
| echo "Error: $1" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| TAG="${1:-}" | ||
| if [[ -z "${TAG}" ]]; then | ||
| TAG="$(curl -fsSL "${GITHUB_API}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')" | ||
| fi | ||
|
|
||
| [[ "${TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || fail "Invalid tag format: ${TAG} (expected vX.Y.Z)" | ||
|
|
||
| VERSION="${TAG#v}" | ||
| CHECKSUMS_URL="https://github.com/${REPO}/releases/download/${TAG}/checksums.txt" | ||
| CHECKSUMS="$(curl -fsSL "${CHECKSUMS_URL}")" | ||
|
|
||
| lookup_checksum() { | ||
| local versioned_name="$1" | ||
| local checksum | ||
| checksum="$(printf '%s\n' "${CHECKSUMS}" | grep "^${versioned_name}:" | head -1 | awk '{print $2}')" | ||
| [[ -n "${checksum}" ]] || fail "Checksum not found for ${versioned_name}" | ||
| printf '%s' "${checksum}" | ||
| } | ||
|
|
||
| DARWIN_ARM64_SHA="$(lookup_checksum "cre_v${VERSION}_darwin_arm64.zip")" | ||
| DARWIN_AMD64_SHA="$(lookup_checksum "cre_v${VERSION}_darwin_amd64.zip")" | ||
| LINUX_ARM64_SHA="$(lookup_checksum "cre_v${VERSION}_linux_arm64.tar.gz")" | ||
| LINUX_AMD64_SHA="$(lookup_checksum "cre_v${VERSION}_linux_amd64.tar.gz")" | ||
|
|
||
| cat > "${FORMULA_FILE}" <<EOF | ||
| class Cre < Formula | ||
| desc "Chainlink Runtime Environment CLI" | ||
| homepage "https://chain.link/chainlink-runtime-environment" | ||
| version "${VERSION}" | ||
| license "MIT" | ||
|
|
||
| on_macos do | ||
| on_arm do | ||
| url "https://github.com/smartcontractkit/cre-cli/releases/download/${TAG}/cre_darwin_arm64.zip" | ||
| sha256 "${DARWIN_ARM64_SHA}" | ||
| end | ||
| on_intel do | ||
| url "https://github.com/smartcontractkit/cre-cli/releases/download/${TAG}/cre_darwin_amd64.zip" | ||
| sha256 "${DARWIN_AMD64_SHA}" | ||
| end | ||
| end | ||
|
|
||
| on_linux do | ||
| on_arm do | ||
| url "https://github.com/smartcontractkit/cre-cli/releases/download/${TAG}/cre_linux_arm64.tar.gz" | ||
| sha256 "${LINUX_ARM64_SHA}" | ||
| end | ||
| on_intel do | ||
| url "https://github.com/smartcontractkit/cre-cli/releases/download/${TAG}/cre_linux_amd64.tar.gz" | ||
| sha256 "${LINUX_AMD64_SHA}" | ||
| end | ||
| end | ||
|
|
||
| def install | ||
| arch = Hardware::CPU.arm? ? "arm64" : "amd64" | ||
| platform = OS.mac? ? "darwin" : "linux" | ||
| bin.install Dir["cre_v*_#{platform}_#{arch}"].first => "cre" | ||
| end | ||
|
|
||
| def caveats | ||
| <<~EOS | ||
| Go 1.25.3 or later and Bun 1.0.0 or later are recommended for developing | ||
| and running TypeScript CRE workflows. | ||
| EOS | ||
| end | ||
|
|
||
| test do | ||
| assert_match "CRE CLI version v#{version}", shell_output("#{bin}/cre version") | ||
| end | ||
| end | ||
| EOF | ||
|
|
||
| echo "Updated ${FORMULA_FILE} for ${TAG}" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.