Skip to content

Commit a3b0d23

Browse files
MrRoudykdmirgaleev
andauthored
Native packages for Homebrew (#71)
* Native packages for Homebrew #17 Co-authored-by: Dmitry Mirgaleev <35151170+dmirgaleev@users.noreply.github.com>
1 parent e7111e9 commit a3b0d23

File tree

2 files changed

+137
-4
lines changed

2 files changed

+137
-4
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Release Homebrew Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
build:
10+
runs-on: macos-14
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.9'
20+
21+
- name: Install dependencies
22+
run: |
23+
brew install gmp bazelisk
24+
pip3 install cpplint pytest numpy sympy==1.12.1 cairo-lang==0.12.0
25+
26+
- name: Build binaries
27+
run: |
28+
chmod +x ./build.sh
29+
./build.sh
30+
31+
- name: Test binaries
32+
run: |
33+
chmod +x ./test.sh
34+
./test.sh
35+
36+
- name: Copy and rename binaries for Homebrew
37+
run: |
38+
cp /tmp/stone-prover/build/bazelbin/src/starkware/main/cpu/cpu_air_prover ./cpu_air_prover-arm64
39+
cp /tmp/stone-prover/build/bazelbin/src/starkware/main/cpu/cpu_air_verifier ./cpu_air_verifier-arm64
40+
chmod +x cpu_air_prover-arm64 cpu_air_verifier-arm64
41+
42+
- name: Package binaries
43+
run: tar -czvf stone-prover-macos-arm64.tar.gz cpu_air_prover-arm64 cpu_air_verifier-arm64
44+
45+
- name: Compute SHA256
46+
id: compute_sha
47+
run: |
48+
SHA256=$(shasum -a 256 stone-prover-macos-arm64.tar.gz | awk '{ print $1 }')
49+
echo "${SHA256}" > sha256_arm64.txt
50+
51+
- name: Upload binaries
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: stone-prover-macos-arm64
55+
path: |
56+
stone-prover-macos-arm64.tar.gz
57+
58+
- name: Upload sha256
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: sha256_arm64
62+
path: |
63+
sha256_arm64.txt
64+
65+
release:
66+
needs: build
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Download binaries and SHA256 artifacts for arm64
70+
uses: actions/download-artifact@v3
71+
with:
72+
name: stone-prover-macos-arm64
73+
path: ./release_assets/arm64
74+
75+
- name: Create GitHub Release
76+
uses: softprops/action-gh-release@v2
77+
with:
78+
files: |
79+
./release_assets/arm64/stone-prover-macos-arm64.tar.gz
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
83+
update_formula:
84+
needs: release
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Checkout Homebrew Formula Repository
88+
uses: actions/checkout@v3
89+
with:
90+
repository: dipdup-io/homebrew-stone-prover
91+
token: ${{ secrets.HOMEBREW_ACCESS_TOKEN }}
92+
path: homebrew-stone-prover
93+
94+
- name: Set up Git
95+
working-directory: homebrew-stone-prover
96+
run: |
97+
git config user.name "GitHub Actions"
98+
git config user.email "actions@github.com"
99+
100+
- name: Download arm64 SHA256 Artifact
101+
uses: actions/download-artifact@v3
102+
with:
103+
name: sha256_arm64
104+
path: ./release_assets/arm64
105+
106+
- name: Read SHA256
107+
run: |
108+
SHA256_arm64=$(cat ./release_assets/arm64/sha256_arm64.txt)
109+
echo "SHA256_arm64=${SHA256_arm64}" >> $GITHUB_ENV
110+
111+
- name: Update Homebrew Formula
112+
working-directory: homebrew-stone-prover
113+
run: |
114+
VERSION=${GITHUB_REF#refs/tags/v}
115+
ROOT_URL="https://github.com/dipdup-io/stone-packaging/releases/download/v${VERSION}"
116+
117+
sed -i "s|version \".*\"|version \"${VERSION}\"|" Formula/stone-prover.rb
118+
sed -i "s|url \".*\"|url \"${ROOT_URL}/stone-prover-macos-arm64.tar.gz\"|" Formula/stone-prover.rb
119+
sed -i "s|sha256 \".*\"|sha256 \"${SHA256_arm64}\"|" Formula/stone-prover.rb
120+
121+
git add Formula/stone-prover.rb
122+
git commit -m "Update Stone Prover to version ${VERSION} for arm64 and x86_64" || echo "No changes to commit"
123+
git push origin main

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ The goal of this project is to reduce friction and speed up the process of gener
1313
- [x] Minimal Docker images for x86_64
1414
- [x] Native packages for Debian/Ubuntu
1515
- [x] Native packages for Fedora
16+
- [x] Homebrew packages
1617

1718
Follow-up work:
1819

1920
- Native packages for Alpine
20-
- Homebrew packages
2121
- Technical documentation for file formats (inputs, outputs, memory, trace, proof), and test data
2222
- Documentation hosted on GitHub Pages
2323
- Integrated proof decomposition (related to https://github.com/zksecurity/stark-evm-adapter)
@@ -127,6 +127,17 @@ install the .rpm package from the latest release:
127127
sudo dnf install https://github.com/dipdup-io/stone-packaging/releases/latest/download/stone-prover-fedora-x86_64.rpm
128128
```
129129

130+
## Download Homebrew Packages for macOS ARM64
131+
132+
Install the `stone-prover` package via Homebrew:
133+
134+
```bash
135+
brew tap dipdup-io/stone-packaging
136+
brew install stone-prover
137+
```
138+
139+
> **Note:** The Homebrew formula is maintained in the [homebrew-stone-prover](https://github.com/dipdup-io/homebrew-stone-prover) repository. If you encounter any issues or wish to contribute to the formula, please visit the repository.
140+
130141
### Creating and Verifying a Test Proof Using the Native Packages
131142

132143
Clone the repository:
@@ -158,9 +169,6 @@ Run the verifier to confirm the proof:
158169
cpu_air_verifier --in_file=fibonacci_proof.json && echo "Successfully verified example proof."
159170
```
160171

161-
This project is supported by Nethermind and Starknet Foundation via [OnlyDust platform](https://app.onlydust.com/p/stone-packaging-)
162-
163-
164172
### USNG VOCS TO GENERATE DOCUMENTATION LOCALHOST SITE
165173

166174
We use Vocs to generate our documentation site. Here's how to set it up and run it locally:
@@ -216,3 +224,5 @@ To add a new page to the documentation:
216224

217225
1. Create a new markdown file in the `docs/pages/` directory.
218226
2. Add the new page to the sidebar in `vocs.config.ts`.
227+
228+
This project is supported by Nethermind and Starknet Foundation via [OnlyDust platform](https://app.onlydust.com/p/stone-packaging-)

0 commit comments

Comments
 (0)