Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/update-formula.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Update Homebrew Formula

on:
release:
types: [published]

jobs:
update-formula:
runs-on: ubuntu-latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

We use fixed version by convention.

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'

- name: Install dependencies
run: |
gem install bundler
bundle install

- name: Update Formula
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get the release version and SHA256
VERSION=$(echo ${{ github.ref }} | sed 's/refs\/tags\/v//')
SHA256=$(curl -sL https://github.com/paritytech/revive/archive/refs/tags/v${VERSION}.tar.gz | shasum -a 256 | cut -d' ' -f1)
Comment on lines +29 to +32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also do LLVM releases from this repo. So we need to detect this here and skip if it is a LLVM release.


# Update the Formula file
sed -i "s/url .*/url \"https:\/\/github.com\/paritytech\/revive\/archive\/refs\/tags\/v${VERSION}.tar.gz\"/" Formula/resolc.rb
sed -i "s/sha256 .*/sha256 \"${SHA256}\"/" Formula/resolc.rb

# Commit and push changes
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Formula/resolc.rb
git commit -m "Update resolc to v${VERSION}"
git push
28 changes: 28 additions & 0 deletions Formula/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Revive Homebrew Tap

This repository contains the Homebrew formula for the Revive Solidity Compiler (resolc).

## Installation

To install resolc using Homebrew:

```bash
brew tap paritytech/revive
brew install resolc
```

## Updating

To update the formula:

1. Create a new release on GitHub
2. Update the `url` and `sha256` in `Formula/resolc.rb`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment? This should be handled by the github workflow?

3. Commit and push the changes

## Development

To install the development version:

```bash
brew install --HEAD resolc
```
33 changes: 33 additions & 0 deletions Formula/resolc.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
class Resolc < Formula
desc "Revive Solidity Compiler"
homepage "https://github.com/paritytech/revive"
url "https://github.com/paritytech/revive/releases/download/v0.1.0-dev.14/resolc-universal-apple-darwin"
sha256 "7d5b3cd4233e60e8bfaade398062f1b609166dcb251424cd9d402e51126d8b4f"
license "MIT/Apache-2.0"

# If someone wants to build from latest source:
head "https://github.com/paritytech/revive.git", branch: "master"
depends_on "llvm@18" => :build if build.head? # only needed when building from source
Comment on lines +8 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work because we need our custom LLVM in order to build resolc. So either remove or add a second Formula for our LLVM build. We also do binary releases of those in our repo.


def install
if build.head?
# ensure they have a working rust toolchain via rustup
odie "rustup is required to build Resolc from source; please install it from https://rustup.rs/" \
unless Utils.which("rustup")

# use rustup's stable toolchain to build in release mode
system "rustup", "run", "stable", "cargo", "install",
"--locked", # lock Cargo.lock for reproducible builds
"--root", prefix, # install into Homebrew prefix
"--path", "." # current repo
else
# just strip any quarantine attribute and install the universal binary
system "xattr", "-c", "resolc-universal-apple-darwin"
bin.install "resolc-universal-apple-darwin" => "resolc"
end
end

test do
assert_match version.to_s, shell_output("#{bin}/resolc --version")
end
end