diff --git a/README.md b/README.md index 1e25b00..67a8cb7 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,11 @@ Skills compose by adoption-list order (`10123`) and trigger tags carry runtime e Didactyl will support local inference, which is very privacy preserving. Remote inference does however have it's advantages, and in those cases Didactyl supports using Bitcoin Lightning and eCash inference providers. -## Current Status — v0.0.89 +## Current Status — v0.1.0 **Active build — this project is barely working. Experiment at your own risk.** -> Last release update: v0.0.89 — Fix and validate fully static ARM64 Docker builds for didactyl and c-relay with reliable cross-arch context and toolchain handling +> Last release update: v0.1.0 — Release dual-architecture static binaries (x86_64 + arm64) - Connects to configured relays with auto-reconnect and relay state transition logging - Publishes configured startup events per relay as each relay becomes connected diff --git a/build_static.sh b/build_static.sh index f41a996..ba49823 100755 --- a/build_static.sh +++ b/build_static.sh @@ -12,6 +12,7 @@ DOCKERFILE="$SCRIPT_DIR/Dockerfile.alpine-musl" # Parse command line arguments DEBUG_BUILD=false TARGET_PLATFORM="" +ALL_PLATFORMS=false for arg in "$@"; do case "$arg" in --debug) @@ -20,9 +21,33 @@ for arg in "$@"; do --platform=*) TARGET_PLATFORM="${arg#*=}" ;; + --all-platforms|--all_platforms|-a) + ALL_PLATFORMS=true + ;; esac done +if [ "$ALL_PLATFORMS" = true ] && [ -n "$TARGET_PLATFORM" ]; then + echo "ERROR: --all-platforms cannot be used together with --platform" + exit 1 +fi + +if [ "$ALL_PLATFORMS" = true ]; then + echo "Building all supported platforms (linux/amd64 + linux/arm64)..." + echo "" + DEBUG_FLAG="" + if [ "$DEBUG_BUILD" = true ]; then + DEBUG_FLAG="--debug" + fi + + "$SCRIPT_DIR/build_static.sh" $DEBUG_FLAG --platform=linux/amd64 + "$SCRIPT_DIR/build_static.sh" $DEBUG_FLAG --platform=linux/arm64 + + echo "" + echo "✓ Multi-platform build complete" + exit 0 +fi + if [ "$DEBUG_BUILD" = true ]; then echo "==========================================" echo "Didactyl MUSL Static Binary Builder (DEBUG MODE)" diff --git a/didactyl_static_arm64 b/didactyl_static_arm64 index 0afc013..f12c957 100755 Binary files a/didactyl_static_arm64 and b/didactyl_static_arm64 differ diff --git a/increment_and_push.sh b/increment_and_push.sh index 5424703..c3a82f9 100755 --- a/increment_and_push.sh +++ b/increment_and_push.sh @@ -53,7 +53,7 @@ show_usage() { echo " -M, --major: Increment major version, zero minor+patch (v0.1.0 → v1.0.0)" echo "" echo "RELEASE MODE (-r flag):" - echo " - Build static binary using build_static.sh" + echo " - Build static x86_64 and arm64 binaries using build_static.sh" echo " - Create source tarball" echo " - Git add, commit, push, and create Gitea release with assets" echo " - Can be combined with version increment flags" @@ -321,9 +321,9 @@ git_commit_and_push_no_tag() { fi } -# Function to build release binary +# Function to build release binaries build_release_binary() { - print_status "Building release binary..." + print_status "Building release binaries (x86_64 + arm64)..." # Check if build_static.sh exists if [[ ! -f "build_static.sh" ]]; then @@ -331,12 +331,12 @@ build_release_binary() { return 1 fi - # Run the static build script - if ./build_static.sh > /dev/null 2>&1; then - print_success "Built static binary successfully" + # Run the static build script for both platforms + if ./build_static.sh --all-platforms > /dev/null 2>&1; then + print_success "Built static binaries successfully" return 0 else - print_error "Failed to build static binary" + print_error "Failed to build one or more static binaries" return 1 fi } @@ -367,8 +367,9 @@ create_source_tarball() { # Function to upload release assets to Gitea upload_release_assets() { local release_id="$1" - local binary_path="$2" - local tarball_path="$3" + local binary_x86_path="$2" + local binary_arm64_path="$3" + local tarball_path="$4" print_status "Uploading release assets..." @@ -383,9 +384,9 @@ upload_release_assets() { local assets_url="$api_url/releases/$release_id/assets" print_status "Assets URL: $assets_url" - # Upload binary - if [[ -f "$binary_path" ]]; then - print_status "Uploading binary: $(basename "$binary_path")" + # Upload x86_64 binary + if [[ -f "$binary_x86_path" ]]; then + print_status "Uploading binary: $(basename "$binary_x86_path")" # Retry loop for eventual consistency local max_attempts=3 @@ -394,11 +395,11 @@ upload_release_assets() { print_status "Upload attempt $attempt/$max_attempts" local binary_response=$(curl -fS -X POST "$assets_url" \ -H "Authorization: token $token" \ - -F "attachment=@$binary_path;filename=$(basename "$binary_path")" \ - -F "name=$(basename "$binary_path")") + -F "attachment=@$binary_x86_path;filename=$(basename "$binary_x86_path")" \ + -F "name=$(basename "$binary_x86_path")") if echo "$binary_response" | grep -q '"id"'; then - print_success "Uploaded binary successfully" + print_success "Uploaded x86_64 binary successfully" break else print_warning "Upload attempt $attempt failed" @@ -406,7 +407,37 @@ upload_release_assets() { print_status "Retrying in 2 seconds..." sleep 2 else - print_error "Failed to upload binary after $max_attempts attempts" + print_error "Failed to upload x86_64 binary after $max_attempts attempts" + print_error "Response: $binary_response" + fi + fi + ((attempt++)) + done + fi + + # Upload arm64 binary + if [[ -f "$binary_arm64_path" ]]; then + print_status "Uploading binary: $(basename "$binary_arm64_path")" + + local max_attempts=3 + local attempt=1 + while [[ $attempt -le $max_attempts ]]; do + print_status "Upload attempt $attempt/$max_attempts" + local binary_response=$(curl -fS -X POST "$assets_url" \ + -H "Authorization: token $token" \ + -F "attachment=@$binary_arm64_path;filename=$(basename "$binary_arm64_path")" \ + -F "name=$(basename "$binary_arm64_path")") + + if echo "$binary_response" | grep -q '"id"'; then + print_success "Uploaded arm64 binary successfully" + break + else + print_warning "Upload attempt $attempt failed" + if [[ $attempt -lt $max_attempts ]]; then + print_status "Retrying in 2 seconds..." + sleep 2 + else + print_error "Failed to upload arm64 binary after $max_attempts attempts" print_error "Response: $binary_response" fi fi @@ -515,16 +546,21 @@ main() { # Commit and push git_commit_and_push_no_tag - # Build release binary + # Build release binaries + local binary_x86_path="" + local binary_arm64_path="" if build_release_binary; then - local binary_path="build/didactyl_static_x86_64" + [[ -f "build/didactyl_static_x86_64" ]] && binary_x86_path="build/didactyl_static_x86_64" + [[ -f "build/didactyl_static_arm64" ]] && binary_arm64_path="build/didactyl_static_arm64" else print_warning "Binary build failed, continuing with release creation" if [[ -f "build/didactyl_static_x86_64" ]]; then - print_status "Using existing binary from previous build" - binary_path="build/didactyl_static_x86_64" - else - binary_path="" + print_status "Using existing x86_64 binary from previous build" + binary_x86_path="build/didactyl_static_x86_64" + fi + if [[ -f "build/didactyl_static_arm64" ]]; then + print_status "Using existing arm64 binary from previous build" + binary_arm64_path="build/didactyl_static_arm64" fi fi @@ -540,8 +576,8 @@ main() { local release_id="" if release_id=$(create_gitea_release); then if [[ "$release_id" =~ ^[0-9]+$ ]]; then - if [[ -n "$release_id" && (-n "$binary_path" || -n "$tarball_path") ]]; then - upload_release_assets "$release_id" "$binary_path" "$tarball_path" + if [[ -n "$release_id" && (-n "$binary_x86_path" || -n "$binary_arm64_path" || -n "$tarball_path") ]]; then + upload_release_assets "$release_id" "$binary_x86_path" "$binary_arm64_path" "$tarball_path" fi print_success "Release $NEW_VERSION completed successfully!" else diff --git a/src/main.h b/src/main.h index 2a8c730..73ba78a 100644 --- a/src/main.h +++ b/src/main.h @@ -11,9 +11,9 @@ // Version information (auto-updated by build system) // Using DIDACTYL_ prefix to avoid conflicts with nostr_core_lib VERSION macros #define DIDACTYL_VERSION_MAJOR 0 -#define DIDACTYL_VERSION_MINOR 0 -#define DIDACTYL_VERSION_PATCH 89 -#define DIDACTYL_VERSION "v0.0.89" +#define DIDACTYL_VERSION_MINOR 1 +#define DIDACTYL_VERSION_PATCH 0 +#define DIDACTYL_VERSION "v0.1.0" // Agent metadata #define DIDACTYL_NAME "Didactyl"