Skip to content

more binary release fixes #24

more binary release fixes

more binary release fixes #24

name: release-binaries
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
env:
CRATE_PATH: ./cli
BIN_NAME: genesis
jobs:
linux:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
out_name: amd64_linux
# - target: aarch64-unknown-linux-gnu
# out_name: arm64_linux
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# Make sure we have modern C++17 cross compilers on Linux
- name: Install modern GCC for C++17 and protoc (jammy)
run: |
sudo apt-get update
sudo apt-get install -y \
gcc-12 g++-12 \
gcc-12-aarch64-linux-gnu g++-12-aarch64-linux-gnu \
protobuf-compiler golang-go
- name: Prepare ELF
run: |
mkdir -p target/elf-compilation/docker/riscv64im-succinct-zkvm-elf/release
cp elf/sp1-helios-elf target/elf-compilation/docker/riscv64im-succinct-zkvm-elf/release/sp1-helios-program
- name: Build (release)
working-directory: ${{ env.CRATE_PATH }}
env:
CC_x86_64_unknown_linux_gnu: gcc-12
CXX_x86_64_unknown_linux_gnu: g++-12
CXXFLAGS_x86_64_unknown_linux_gnu: -std=gnu++17
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc-12
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++-12
CXXFLAGS_aarch64_unknown_linux_gnu: -std=gnu++17
SP1_SKIP_PROGRAM_BUILD: true
run: |
cargo build --bin ${BIN_NAME} --release --target ${{ matrix.target }}
- name: Rename binary
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
SRC="target/${{ matrix.target }}/release/${{ env.BIN_NAME }}"
DEST="dist/${{ env.BIN_NAME }}_${VERSION}_${{ matrix.out_name }}"
mkdir -p dist
chmod +x "$SRC"
cp -f "$SRC" "$DEST"
- name: Upload to Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: dist/${{ env.BIN_NAME }}_${{ env.VERSION }}_${{ matrix.out_name }}
- name: Compute and upload checksum
run: |
FILE="dist/${{ env.BIN_NAME }}_${{ env.VERSION }}_${{ matrix.out_name }}"
HASH=$(sha256sum "$FILE" | awk '{print $1}')
echo "${{ env.BIN_NAME }}_${{ env.VERSION }}_${{ matrix.out_name }} $HASH" > checksum-${{ matrix.out_name }}.txt
- name: Upload checksum artifact
uses: actions/upload-artifact@v4
with:
name: checksum-${{ matrix.out_name }}
path: checksum-${{ matrix.out_name }}.txt
# macos-x86_64:
# runs-on: macos-13 # Intel runner
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# with:
# targets: x86_64-apple-darwin
# - name: Build (release)
# working-directory: ${{ env.CRATE_PATH }}
# env:
# CC_x86_64_apple_darwin: clang
# CXX_x86_64_apple_darwin: clang++
# CXXFLAGS_x86_64_apple_darwin: -std=c++17
# CARGO_TARGET_DIR: ${{ github.workspace }}/target/${{ runner.os }}-x86_64-apple-darwin-${{ github.run_id }}
# CARGO_BUILD_JOBS: "1"
# SP1_SKIP_PROGRAM_BUILD: true
# run: |
# cargo build --bin ${BIN_NAME} --release --target x86_64-apple-darwin
# - name: Rename binary
# run: |
# VERSION="${GITHUB_REF_NAME#v}"
# echo "VERSION=$VERSION" >> $GITHUB_ENV
# SRC=${{ github.workspace }}/target/${{ runner.os }}-x86_64-apple-darwin-${{ github.run_id }}/x86_64-apple-darwin/release/${{ env.BIN_NAME }}
# DEST="dist/${{ env.BIN_NAME }}_${VERSION}_amd64_darwin"
# mkdir -p dist
# chmod +x "$SRC"
# cp -f "$SRC" "$DEST"
# - name: Upload to Release
# uses: softprops/action-gh-release@v2
# with:
# tag_name: ${{ github.ref_name }}
# files: dist/${{ env.BIN_NAME }}_${{ env.VERSION }}_amd64_darwin
macos-arm64:
runs-on: macos-14 # Apple Silicon runner
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: Install protoc and Go
run: brew install protobuf go
- name: Prepare ELF
run: |
mkdir -p target/elf-compilation/docker/riscv64im-succinct-zkvm-elf/release
cp elf/sp1-helios-elf target/elf-compilation/docker/riscv64im-succinct-zkvm-elf/release/sp1-helios-program
- name: Build (release)
working-directory: ${{ env.CRATE_PATH }}
env:
CC_aarch64_apple_darwin: clang
CXX_aarch64_apple_darwin: clang++
CXXFLAGS_aarch64_apple_darwin: -std=c++17
CARGO_TARGET_DIR: ${{ github.workspace }}/target/${{ runner.os }}-aarch64-apple-darwin-${{ github.run_id }}
CARGO_BUILD_JOBS: "1"
SP1_SKIP_PROGRAM_BUILD: true
run: |
cargo build --bin ${BIN_NAME} --release --target aarch64-apple-darwin
- name: Rename binary
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
SRC=${{ github.workspace }}/target/${{ runner.os }}-aarch64-apple-darwin-${{ github.run_id }}/aarch64-apple-darwin/release/${{ env.BIN_NAME }}
DEST="dist/${{ env.BIN_NAME }}_${VERSION}_arm64_darwin"
mkdir -p dist
chmod +x "$SRC"
cp -f "$SRC" "$DEST"
- name: Upload to Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: dist/${{ env.BIN_NAME }}_${{ env.VERSION }}_arm64_darwin
- name: Compute and upload checksum
run: |
FILE="dist/${{ env.BIN_NAME }}_${{ env.VERSION }}_arm64_darwin"
HASH=$(shasum -a 256 "$FILE" | awk '{print $1}')
echo "${{ env.BIN_NAME }}_${{ env.VERSION }}_arm64_darwin $HASH" > checksum-arm64_darwin.txt
- name: Upload checksum artifact
uses: actions/upload-artifact@v4
with:
name: checksum-arm64_darwin
path: checksum-arm64_darwin.txt
checksums:
needs: [linux, macos-arm64]
runs-on: ubuntu-22.04
steps:
- name: Download checksum artifacts
uses: actions/download-artifact@v4
with:
path: checksums
pattern: checksum-*
merge-multiple: true
- name: Generate SHA256 checksums (JSON)
run: |
echo "{" > checksums.json
first=true
for file in checksums/checksum-*.txt; do
read -r filename hash < "$file"
if [ "$first" = true ]; then
first=false
else
echo "," >> checksums.json
fi
printf ' "%s": "%s"' "$filename" "$hash" >> checksums.json
done
echo "" >> checksums.json
echo "}" >> checksums.json
echo "Generated checksums:"
cat checksums.json
- name: Upload checksums to Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: checksums.json