Skip to content

Commit

Permalink
Merge pull request #65 from bruhhgnik/native_package_fedora
Browse files Browse the repository at this point in the history
Feat/Native package fedora
  • Loading branch information
Zaariel91 authored Oct 5, 2024
2 parents ed34e8b + 32ea656 commit 25baaa8
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 2 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release-fedora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release Stone Prover for Fedora

on:
push:
tags:
- 'v*.*.*'

jobs:
build:
runs-on: ubuntu-latest
container:
image: fedora:38
options: --workdir /github/workspace
env:
TARGET_ARCH: x86_64

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up environment and build
run: |
chmod +x ./fedora-build.sh
./fedora-build.sh
- name: Test
run: |
chmod +x ./test.sh
./test.sh
- name: Set version output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Package RPM
run: |
chmod +x ./package_rpm.sh
./package_rpm.sh ${{ steps.vars.outputs.tag }}
- name: Rename RPM package
run: |
mv /tmp/stone-prover/*.rpm /github/workspace/stone-prover-fedora-${TARGET_ARCH}.rpm
- name: Upload files to GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
/github/workspace/*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ The goal of this project is to reduce friction and speed up the process of gener
- [x] Static binary releases for ARM64
- [x] Minimal Docker images for x86_64
- [x] Native packages for Debian/Ubuntu
- [x] Native packages for Fedora

Follow-up work:
- Native packages for Fedora

- Native packages for Alpine
- Homebrew packages
- Technical documentation for file formats (inputs, outputs, memory, trace, proof), and test data
Expand Down Expand Up @@ -118,7 +119,15 @@ Download the .deb package from the latest release:
wget https://github.com/dipdup-io/stone-packaging/releases/latest/download/stone-prover-linux-x86_64.deb && sudo dpkg -i stone-prover-linux-x86_64.deb
```

### Creating and Verifying a Test Proof Using the .deb Package
## Download Native Packages for fedora

install the .rpm package from the latest release:

```bash
sudo dnf install https://github.com/dipdup-io/stone-packaging/releases/latest/download/stone-prover-fedora-x86_64.rpm
```

### Creating and Verifying a Test Proof Using the Native Packages

Clone the repository:

Expand Down
46 changes: 46 additions & 0 deletions fedora-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# Build script for Fedora
set -o xtrace
set -e
os=$(uname | tr '[:upper:]' '[:lower:]')
arch=$(uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/)


# Update and install system dependencies
dnf update -y && dnf install -y \
git \
gcc gcc-c++ make wget openssl-devel bzip2-devel libffi-devel \
elfutils-libelf-devel gmp-devel elfutils-devel clang \
libstdc++-devel libcxx libcxx-devel ncurses-compat-libs cairo-devel \
zlib-devel ncurses-devel sqlite-devel \
rpm-build \
readline-devel tk-devel gdbm-devel xz-devel \

# Install Python 3.9 from source
wget https://www.python.org/ftp/python/3.9.17/Python-3.9.17.tgz \
&& tar xzf Python-3.9.17.tgz \
&& cd Python-3.9.17 \
&& ./configure --enable-optimizations \
&& make altinstall \
&& cd .. && rm -rf Python-3.9.17*

# Install Python packages
pip3.9 install cpplint pytest numpy sympy==1.12.1 cairo-lang==0.12.0

# Install Bazelisk
wget "https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-$os-$arch"
chmod 755 "bazelisk-$os-$arch"
sudo mv "bazelisk-$os-$arch" /bin/bazelisk

git clone https://github.com/baking-bad/stone-prover.git /tmp/stone-prover

cd /tmp/stone-prover || exit

bazelisk build --cpu=$arch //...

bazelisk test --cpu=$arch //...

# Create symbolic links for cpu_air_prover and cpu_air_verifier
ln -s /tmp/stone-prover/build/bazelbin/src/starkware/main/cpu/cpu_air_prover /usr/local/bin/cpu_air_prover
ln -s /tmp/stone-prover/build/bazelbin/src/starkware/main/cpu/cpu_air_verifier /usr/local/bin/cpu_air_verifier

30 changes: 30 additions & 0 deletions package_rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -e

# Install dependencies
sudo dnf install -y ruby ruby-devel rubygems gcc make rpm-build

# Install fpm
sudo gem install --no-document fpm

# Create a temporary directory for the package

mkdir -p /tmp/stone-prover/usr/bin

TAG=$1

# Copy binaries into the package directory
cp /usr/local/bin/cpu_air_prover /tmp/stone-prover/usr/bin/
cp /usr/local/bin/cpu_air_verifier /tmp/stone-prover/usr/bin/

# Build the RPM package using fpm
fpm -s dir -t rpm \
-n stone-prover \
-v "$(echo $TAG | cut -c 2-)" \
-a "$(uname -m)" \
-C /tmp/stone-prover/ \
--prefix / \
--maintainer "Baking Bad <[email protected]>" \
--description "Stone prover RPM package" \
-p /tmp/stone-prover/stone-prover.rpm

0 comments on commit 25baaa8

Please sign in to comment.