From 3225e754ca2f789283086d2fe20219921c611c06 Mon Sep 17 00:00:00 2001 From: Andrey Kobrin Date: Thu, 22 May 2025 17:40:06 -0400 Subject: [PATCH 1/3] Use lumera release build with latest tag for system tests --- .github/actions/setup-env/action.yml | 26 ++++++++-- .../{build&relase.yml => build&release.yml} | 42 ++-------------- .github/workflows/tests.yml | 9 ++-- tests/scripts/install-lumera.sh | 48 ++++++++++++++----- 4 files changed, 65 insertions(+), 60 deletions(-) rename .github/workflows/{build&relase.yml => build&release.yml} (77%) diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml index e8acc25c..06e15537 100644 --- a/.github/actions/setup-env/action.yml +++ b/.github/actions/setup-env/action.yml @@ -1,17 +1,35 @@ name: Setup Environment -description: Sets up Go and installs system dependencies +description: Sets up Go (dynamically from go.mod) and installs system dependencies +inputs: {} +outputs: + go-version: + description: "Go version parsed from go.mod" + value: ${{ steps.get-go-version.outputs.version }} runs: using: "composite" steps: - - name: Set up Go + - name: Get Go version from go.mod + id: get-go-version + shell: bash + run: | + GO_VERSION=$(grep -E '^go [0-9]+\.[0-9]+(\.[0-9]+)?$' go.mod | cut -d ' ' -f 2) + echo "Found Go version: $GO_VERSION" + echo "version=$GO_VERSION" >> $GITHUB_OUTPUT + + - name: Setup Go uses: actions/setup-go@v4 with: - go-version: '1.24' + go-version: ${{ steps.get-go-version.outputs.version }} + cache: true - name: Install libwebp-dev + shell: bash run: | sudo apt-get update sudo apt-get install -y libwebp-dev + + - name: Set Go Private Modules shell: bash - \ No newline at end of file + run: | + go env -w GOPRIVATE=github.com/LumeraProtocol/lumera diff --git a/.github/workflows/build&relase.yml b/.github/workflows/build&release.yml similarity index 77% rename from .github/workflows/build&relase.yml rename to .github/workflows/build&release.yml index 5f154439..049ffe5d 100644 --- a/.github/workflows/build&relase.yml +++ b/.github/workflows/build&release.yml @@ -30,18 +30,8 @@ jobs: - name: Configure Git Safe Directory run: git config --global --add safe.directory $GITHUB_WORKSPACE - - name: Get Go version from go.mod - id: go-version - run: | - GO_VERSION=$(grep -E '^go [0-9]+\.[0-9]+(\.[0-9]+)?$' go.mod | cut -d ' ' -f 2) - echo "Found go directive version: $GO_VERSION" - echo "version=$GO_VERSION" >> $GITHUB_OUTPUT - - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: ${{ steps.go-version.outputs.version }} - cache: true + - name: Setup Go and dependencies + uses: ./.github/actions/setup-env - name: Prepare Build Variables id: vars @@ -58,13 +48,6 @@ jobs: echo "- build_id: $build_id" echo "- binary_name: supernode-linux-amd64" - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y libwebp-dev - # Fix for Lumera module checksum issue - go env -w GOPRIVATE=github.com/LumeraProtocol/lumera - - name: Build binary run: | mkdir -p release @@ -128,18 +111,8 @@ jobs: - name: Configure Git Safe Directory run: git config --global --add safe.directory $GITHUB_WORKSPACE - - name: Get Go version from go.mod - id: go-version - run: | - GO_VERSION=$(grep -E '^go [0-9]+\.[0-9]+(\.[0-9]+)?$' go.mod | cut -d ' ' -f 2) - echo "Found go directive version: $GO_VERSION" - echo "version=$GO_VERSION" >> $GITHUB_OUTPUT - - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: ${{ steps.go-version.outputs.version }} - cache: true + - name: Setup Go and dependencies + uses: ./.github/actions/setup-env - name: Prepare Release Variables id: vars @@ -147,13 +120,6 @@ jobs: repo_name=${GITHUB_REPOSITORY##*/} echo "binary_name=supernode-linux-amd64" >> $GITHUB_OUTPUT - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y libwebp-dev - # Fix for Lumera module checksum issue - go env -w GOPRIVATE=github.com/LumeraProtocol/lumera - - name: Build Release Version run: | mkdir -p release diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ec5fc461..522ce2b9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,8 +14,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 - + uses: actions/checkout@v4 - name: Setup Go and system deps uses: ./.github/actions/setup-env @@ -33,7 +32,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Go and system deps uses: ./.github/actions/setup-env @@ -52,7 +51,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Go and system deps uses: ./.github/actions/setup-env @@ -67,7 +66,7 @@ jobs: run: | cd tests/scripts chmod +x ./install-lumera.sh - sudo ./install-lumera.sh + sudo ./install-lumera.sh latest-tag - name: Setup Supernode environments run: | diff --git a/tests/scripts/install-lumera.sh b/tests/scripts/install-lumera.sh index 2699c5b8..395370d4 100755 --- a/tests/scripts/install-lumera.sh +++ b/tests/scripts/install-lumera.sh @@ -1,24 +1,46 @@ #!/bin/bash set -e # Exit immediately if a command exits with a non-zero status -# GitHub API URL for the latest release -GITHUB_API_URL="https://api.github.com/repos/LumeraProtocol/lumera/releases/latest" +# Sample usage: +# ./install-lumera.sh # uses latest release +# ./install-lumera.sh latest-tag # uses latest tag from /tags +# ./install-lumera.sh v1.1.0 # installs this specific version -echo "Fetching latest release information..." -RELEASE_INFO=$(curl -s -S -L "$GITHUB_API_URL") +# Support mode argument: 'latest-release' (default) or 'latest-tag' +MODE="${1:-latest-release}" +REPO="LumeraProtocol/lumera" +GITHUB_API="https://api.github.com/repos/$REPO" -# Extract tag name and download URL -if command -v jq >/dev/null 2>&1; then - TAG_NAME=$(echo "$RELEASE_INFO" | jq -r '.tag_name') - DOWNLOAD_URL=$(echo "$RELEASE_INFO" | jq -r '.assets[] | select(.name | test("linux_amd64.tar.gz$")) | .browser_download_url') +echo "Installation mode: $MODE" + +if [ "$MODE" == "latest-tag" ]; then + echo "Fetching latest tag from GitHub..." + if command -v jq >/dev/null 2>&1; then + TAG_NAME=$(curl -s "$GITHUB_API/tags" | jq -r '.[0].name') + else + TAG_NAME=$(curl -s "$GITHUB_API/tags" | grep '"name"' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/') + fi +elif [[ "$MODE" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + TAG_NAME="$MODE" else - TAG_NAME=$(echo "$RELEASE_INFO" | grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/') - DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep -o '"browser_download_url"[[:space:]]*:[[:space:]]*"[^"]*linux_amd64\.tar\.gz[^"]*"' | sed 's/.*"browser_download_url"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/') + echo "Fetching latest release information..." + RELEASE_INFO=$(curl -s -S -L "$GITHUB_API/releases/latest") + if command -v jq >/dev/null 2>&1; then + TAG_NAME=$(echo "$RELEASE_INFO" | jq -r '.tag_name') + else + TAG_NAME=$(echo "$RELEASE_INFO" | grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/') + fi fi -echo "Latest release: $TAG_NAME" -if [ -z "$DOWNLOAD_URL" ]; then - echo "Error: Could not find Lumera download URL" +# Construct the download URL +FILENAME="lumera_${TAG_NAME}_linux_amd64.tar.gz" +DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${TAG_NAME}/${FILENAME}" + +echo "Downloading Lumera tag: $TAG_NAME" +echo "Download URL: $DOWNLOAD_URL" + +if [ -z "$TAG_NAME" ] || [ -z "$DOWNLOAD_URL" ]; then + echo "Error: Could not determine tag or download URL" exit 1 fi From cbae8e654c591e189722d1f75a43dd61632cdb2a Mon Sep 17 00:00:00 2001 From: Andrey Kobrin Date: Thu, 22 May 2025 17:57:31 -0400 Subject: [PATCH 2/3] changes --- tests/scripts/install-lumera.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/scripts/install-lumera.sh b/tests/scripts/install-lumera.sh index 395370d4..4c657e82 100755 --- a/tests/scripts/install-lumera.sh +++ b/tests/scripts/install-lumera.sh @@ -8,6 +8,7 @@ set -e # Exit immediately if a command exits with a non-zero status # Support mode argument: 'latest-release' (default) or 'latest-tag' MODE="${1:-latest-release}" + REPO="LumeraProtocol/lumera" GITHUB_API="https://api.github.com/repos/$REPO" @@ -20,23 +21,32 @@ if [ "$MODE" == "latest-tag" ]; then else TAG_NAME=$(curl -s "$GITHUB_API/tags" | grep '"name"' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/') fi + DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${TAG_NAME}/lumera_${TAG_NAME}_linux_amd64.tar.gz" + elif [[ "$MODE" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then TAG_NAME="$MODE" -else + DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${TAG_NAME}/lumera_${TAG_NAME}_linux_amd64.tar.gz" + +elif [ "$MODE" == "latest-release" ]; then echo "Fetching latest release information..." RELEASE_INFO=$(curl -s -S -L "$GITHUB_API/releases/latest") + + # Extract tag name and download URL if command -v jq >/dev/null 2>&1; then TAG_NAME=$(echo "$RELEASE_INFO" | jq -r '.tag_name') + DOWNLOAD_URL=$(echo "$RELEASE_INFO" | jq -r '.assets[] | select(.name | test("linux_amd64.tar.gz$")) | .browser_download_url') else TAG_NAME=$(echo "$RELEASE_INFO" | grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/') + DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep -o '"browser_download_url"[[:space:]]*:[[:space:]]*"[^"]*linux_amd64\.tar\.gz[^"]*"' | sed 's/.*"browser_download_url"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/') fi -fi -# Construct the download URL -FILENAME="lumera_${TAG_NAME}_linux_amd64.tar.gz" -DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${TAG_NAME}/${FILENAME}" +else + echo "❌ Error: Invalid mode '$MODE'" + echo "Usage: $0 [latest-release|latest-tag|vX.Y.Z]" + exit 1 +fi -echo "Downloading Lumera tag: $TAG_NAME" +echo "Selected tag: $TAG_NAME" echo "Download URL: $DOWNLOAD_URL" if [ -z "$TAG_NAME" ] || [ -z "$DOWNLOAD_URL" ]; then From 681bc78e75de0c793a56d05a7ccf69ef4f17b1e1 Mon Sep 17 00:00:00 2001 From: Andrey Kobrin Date: Fri, 23 May 2025 11:30:02 -0400 Subject: [PATCH 3/3] changed lumera version --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2f680eef..a34b74ee 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ replace github.com/LumeraProtocol/supernode/supernode => ./supernode require ( cosmossdk.io/math v1.5.3 - github.com/LumeraProtocol/lumera v1.0.1 + github.com/LumeraProtocol/lumera v1.1.0 github.com/LumeraProtocol/rq-go v0.2.1 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cenkalti/backoff/v4 v4.3.0 diff --git a/go.sum b/go.sum index f5046837..2ec021fc 100644 --- a/go.sum +++ b/go.sum @@ -61,8 +61,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/LumeraProtocol/lumera v1.0.1 h1:gnSbyQfVeYS2pCvR2AxrD8UWR++IEVYz4ywk3GiI25k= -github.com/LumeraProtocol/lumera v1.0.1/go.mod h1:c1M+sjewuCvxw+pznwlspUzenDJI8Y+suKB3RFKS2Wo= +github.com/LumeraProtocol/lumera v1.1.0 h1:pxosS4m9W/nWIjvCHU2itX2SvG7Q05K2/EdJ666yqyY= +github.com/LumeraProtocol/lumera v1.1.0/go.mod h1:c1M+sjewuCvxw+pznwlspUzenDJI8Y+suKB3RFKS2Wo= github.com/LumeraProtocol/rq-go v0.2.1 h1:8B3UzRChLsGMmvZ+UVbJsJj6JZzL9P9iYxbdUwGsQI4= github.com/LumeraProtocol/rq-go v0.2.1/go.mod h1:APnKCZRh1Es2Vtrd2w4kCLgAyaL5Bqrkz/BURoRJ+O8= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=