-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Alpine packaging workflow and script * Disable trigger until it's ready WIP, should be finished Co-authored-by: Dmitry Mirgaleev <[email protected]>
- Loading branch information
1 parent
e235147
commit c7948d6
Showing
2 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,63 @@ | ||
name: Build Alpine Package | ||
|
||
on: | ||
# push: | ||
# tags: | ||
# - 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: alpine:latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install dependencies | ||
run: | | ||
apk add --no-cache \ | ||
alpine-sdk \ | ||
cmake \ | ||
git \ | ||
curl \ | ||
bash \ | ||
build-base \ | ||
boost-dev \ | ||
gmp-dev \ | ||
abuild | ||
- name: Create Alpine package | ||
run: | | ||
chmod +x ./package_alpine.sh | ||
./package_alpine.sh ${{ github.ref_name }} | ||
- name: Upload Alpine package | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: stone-prover-alpine-package | ||
path: /tmp/packages/main/x86_64/*.apk | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: /tmp/packages/main/x86_64/stone-prover-*.apk | ||
asset_name: stone-prover-alpine-${{ github.ref }}.apk | ||
asset_content_type: application/vnd.alpine.linux.apk |
This file contains 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,71 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "Starting package creation process..." | ||
echo "Checking necessary dependencies..." | ||
|
||
# Ensure necessary dependencies are installed | ||
apk add --no-cache alpine-sdk build-base | ||
|
||
# Define the binary paths | ||
PROVER_PATH="/usr/local/bin/cpu_air_prover" | ||
VERIFIER_PATH="/usr/local/bin/cpu_air_verifier" | ||
|
||
# Check if the binaries exist | ||
if [ ! -f "$PROVER_PATH" ]; then | ||
echo "Error: cpu_air_prover not found in /usr/local/bin. Please ensure the binary is built." | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f "$VERIFIER_PATH" ]; then | ||
echo "Error: cpu_air_verifier not found in /usr/local/bin. Please ensure the binary is built." | ||
exit 1 | ||
fi | ||
|
||
# Log found binaries | ||
echo "Found cpu_air_prover at $PROVER_PATH" | ||
echo "Found cpu_air_verifier at $VERIFIER_PATH" | ||
|
||
# Create a temporary directory for the package | ||
echo "Creating temporary directories..." | ||
mkdir -p /tmp/stone-prover/ALPINE || { echo "Failed to create directory /tmp/stone-prover/ALPINE"; exit 1; } | ||
mkdir -p /tmp/stone-prover/usr/bin || { echo "Failed to create directory /tmp/stone-prover/usr/bin"; exit 1; } | ||
|
||
TAG=$1 | ||
echo "Using tag $TAG" | ||
|
||
# Copy binaries to the appropriate directory | ||
echo "Copying binaries to package directories..." | ||
cp "$PROVER_PATH" /tmp/stone-prover/usr/bin/ | ||
cp "$VERIFIER_PATH" /tmp/stone-prover/usr/bin/ | ||
|
||
# Create the APKBUILD file for Alpine package creation | ||
echo "Creating APKBUILD file..." | ||
cat <<EOF > /tmp/stone-prover/APKBUILD | ||
# Contributor: Baking Bad <[email protected]> | ||
# Maintainer: Baking Bad <[email protected]> | ||
pkgname=stone-prover | ||
pkgver=$(echo $TAG | cut -c 2-) | ||
pkgrel=0 | ||
pkgdesc="Stone prover alpine package" | ||
arch="x86_64" | ||
license="GPL-3.0" | ||
source="" | ||
builddir="/tmp/stone-prover" | ||
package() { | ||
mkdir -p "\$pkgdir/usr/bin" | ||
install -Dm755 "\$builddir"/usr/bin/cpu_air_prover "\$pkgdir"/usr/bin/cpu_air_prover | ||
install -Dm755 "\$builddir"/usr/bin/cpu_air_verifier "\$pkgdir"/usr/bin/cpu_air_verifier | ||
} | ||
EOF | ||
|
||
# Build the Alpine package using abuild | ||
echo "Building the package using abuild..." | ||
cd /tmp/stone-prover || { echo "Failed to change directory to /tmp/stone-prover"; exit 1; } | ||
abuild checksum || { echo "abuild checksum failed"; exit 1; } | ||
abuild -r || { echo "abuild build failed"; exit 1; } | ||
|
||
# Output the built package location | ||
echo "Alpine package built successfully." | ||
echo "Package location: /tmp/packages/main/x86_64/stone-prover-*.apk" |