Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -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

run: |
go env -w GOPRIVATE=github.com/LumeraProtocol/lumera
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -128,32 +111,15 @@ 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
run: |
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
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
58 changes: 45 additions & 13 deletions tests/scripts/install-lumera.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,56 @@
#!/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"

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
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"
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

# 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/')
echo "❌ Error: Invalid mode '$MODE'"
Copy link

Copilot AI May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding an inline comment above this branch to list the valid mode options ('latest-release', 'latest-tag', and specific version) for clarity and easier future maintenance.

Copilot uses AI. Check for mistakes.
echo "Usage: $0 [latest-release|latest-tag|vX.Y.Z]"
exit 1
fi

echo "Latest release: $TAG_NAME"
if [ -z "$DOWNLOAD_URL" ]; then
echo "Error: Could not find Lumera download URL"
echo "Selected 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

Expand Down
Loading