Skip to content
Merged
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
7 changes: 6 additions & 1 deletion .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ runs:
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libwebp-dev
sudo apt-get install -y libwebp-dev make

- name: Set Go Private Modules
shell: bash
run: |
go env -w GOPRIVATE=github.com/LumeraProtocol/lumera

- name: Download Go dependencies
shell: bash
run: |
go mod download
67 changes: 61 additions & 6 deletions .github/workflows/build&release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ jobs:
echo "build_time=$BUILD_TIME" >> $GITHUB_OUTPUT
echo "binary_name=supernode-linux-amd64" >> $GITHUB_OUTPUT

- name: Build binary
- name: Build binaries
run: |
mkdir -p release

# Build supernode
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
Expand All @@ -59,10 +60,32 @@ jobs:
-X github.com/LumeraProtocol/supernode/supernode/cmd.Version=${{ steps.vars.outputs.version }} \
-X github.com/LumeraProtocol/supernode/supernode/cmd.GitCommit=${{ steps.vars.outputs.git_commit }} \
-X github.com/LumeraProtocol/supernode/supernode/cmd.BuildTime=${{ steps.vars.outputs.build_time }}" \
-o release/${{ steps.vars.outputs.binary_name }} \
-o release/supernode \
./supernode

chmod +x release/${{ steps.vars.outputs.binary_name }}
# Build sn-manager
cd sn-manager
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
go build \
-trimpath \
-ldflags="-s -w \
-X main.Version=${{ steps.vars.outputs.version }} \
-X main.GitCommit=${{ steps.vars.outputs.git_commit }} \
-X main.BuildTime=${{ steps.vars.outputs.build_time }}" \
-o ../release/sn-manager \
.
cd ..

chmod +x release/supernode release/sn-manager

# Create tarball
cd release
tar -czf ${{ steps.vars.outputs.binary_name }}.tar.gz supernode sn-manager
cd ..

cp release/supernode release/${{ steps.vars.outputs.binary_name }}

- name: Fix Release Directory Permissions
run: |
Expand Down Expand Up @@ -118,6 +141,7 @@ jobs:
run: |
mkdir -p release

# Build supernode
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
Expand All @@ -127,10 +151,32 @@ jobs:
-X github.com/LumeraProtocol/supernode/supernode/cmd.Version=${{ steps.vars.outputs.version }} \
-X github.com/LumeraProtocol/supernode/supernode/cmd.GitCommit=${{ steps.vars.outputs.git_commit }} \
-X github.com/LumeraProtocol/supernode/supernode/cmd.BuildTime=${{ steps.vars.outputs.build_time }}" \
-o release/${{ steps.vars.outputs.binary_name }} \
-o release/supernode \
./supernode

chmod +x release/${{ steps.vars.outputs.binary_name }}
# Build sn-manager
cd sn-manager
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
go build \
-trimpath \
-ldflags="-s -w \
-X main.Version=${{ steps.vars.outputs.version }} \
-X main.GitCommit=${{ steps.vars.outputs.git_commit }} \
-X main.BuildTime=${{ steps.vars.outputs.build_time }}" \
-o ../release/sn-manager \
.
cd ..

chmod +x release/supernode release/sn-manager

# Create tarball
cd release
tar -czf ${{ steps.vars.outputs.binary_name }}.tar.gz supernode sn-manager
cd ..

cp release/supernode release/${{ steps.vars.outputs.binary_name }}

- name: Fix Release Directory Permissions
run: |
Expand All @@ -151,7 +197,16 @@ jobs:
Git Commit: ${{ steps.vars.outputs.git_commit }}
Build Time: ${{ steps.vars.outputs.build_time }}

Installation:
## Installation

### Option 1: Download the tarball (includes both binaries)
1. Download: `supernode-linux-amd64.tar.gz`
2. Extract: `tar -xzf supernode-linux-amd64.tar.gz`
3. Make executable: `chmod +x supernode sn-manager`
4. Run supernode: `./supernode`
5. Run sn-manager: `./sn-manager`

### Option 2: Download supernode binary only
1. Download: `supernode-linux-amd64`
2. Make executable: `chmod +x supernode-linux-amd64`
3. Run: `./supernode-linux-amd64`
Expand Down
66 changes: 28 additions & 38 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ jobs:
- name: Setup Go and system deps
uses: ./.github/actions/setup-env

- name: Install dependencies
run: |
go env -w GOPRIVATE=github.com/LumeraProtocol/lumera
go mod download

- name: Run unit tests
run: go test $(go list ./... | grep -v '/tests') -v

Expand All @@ -37,16 +32,11 @@ jobs:
- name: Setup Go and system deps
uses: ./.github/actions/setup-env

- name: Install dependencies
run: |
go env -w GOPRIVATE=github.com/LumeraProtocol/lumera
go mod download

- name: Run integration tests
run: go test -v ./tests/integration/...

system-tests:
name: system-tests
cascade-e2e-tests:
name: cascade-e2e-tests
runs-on: ubuntu-latest

steps:
Expand All @@ -56,33 +46,33 @@ jobs:
- name: Setup Go and system deps
uses: ./.github/actions/setup-env

- name: Install dependencies
run: |
go env -w GOPRIVATE=github.com/LumeraProtocol/lumera
go mod download
cd tests/system && go env -w GOPRIVATE=github.com/LumeraProtocol/lumera && go mod download


- name: Install Lumera
run: |
cd tests/scripts
chmod +x ./install-lumera.sh
sudo ./install-lumera.sh latest-tag

run: make install-lumera

- name: Setup Supernode environments
run: |
cd tests/scripts
chmod +x ./setup-supernodes.sh
./setup-supernodes.sh all \
../../supernode/main.go \
../system/supernode-data1 \
../system/config.test-1.yml \
../system/supernode-data2 \
../system/config.test-2.yml \
../system/supernode-data3 \
../system/config.test-3.yml
run: make setup-supernodes

- name: Copy CSV file to home directory
run: cp claims.csv ~/
- name: Run cascade e2e tests
run: make test-cascade

sn-manager-e2e-tests:
name: sn-manager-e2e-tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go and system deps
uses: ./.github/actions/setup-env


- name: Run system tests
run: cd tests/system && go test -v .
- name: Install Lumera
run: make install-lumera

- name: Setup Supernode environments
run: make setup-supernodes

# - name: Run sn-manager e2e tests
# run: make test-sn-manager
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# Dependency directories (remove the comment below to include it)
# vendor/

# sn-manager binary
# Go workspace file
go.work
go.work.sum
Expand Down
32 changes: 7 additions & 25 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,17 @@
"version": "0.2.0",
"configurations": [
{
"name": "Launch Supernode",
"name": "Supernode Start",
"type": "go",
"request": "launch",
"mode": "auto",
"mode": "debug",
"program": "${workspaceFolder}/supernode/main.go",
"cwd": "${workspaceFolder}",
"args": ["start", "-c=${workspaceFolder}/supernode/config.yaml"]
},
{
"name": "Run System Test",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/tests/system",
"buildFlags": "-tags=system_test",
"args": ["-test.run=TestCascadeE2E", "-test.v"],
"cwd": "${workspaceFolder}/supernode",
"args": ["start"],
"env": {},
"showLog": true,
"env": {
"LOG_LEVEL": "debug" // This may vary depending on your logger
}
"trace": "verbose"
},
{
"name": "Run P2P Test",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/tests/integration/p2p",
"args": ["-test.run=TestP2PBasicIntegration", "-test.v"],
"showLog": true
}

]
}
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,14 @@ system-test-setup: install-lumera setup-supernodes
# Run system tests with complete setup
test-e2e:
@echo "Running system tests..."
@cd tests/system && go test -tags=system_test -v .
@cd tests/system && go test -tags=system_test -v .

# Run cascade e2e tests only
test-cascade:
@echo "Running cascade e2e tests..."
@cd tests/system && go test -tags=system_test -v -run TestCascadeE2E .

# Run sn-manager e2e tests only
test-sn-manager:
@echo "Running sn-manager e2e tests..."
@cd tests/system && go test -tags=system_test -v -run '^TestSNManager' .
65 changes: 65 additions & 0 deletions sn-manager/cmd/check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package cmd

import (
"fmt"

"github.com/LumeraProtocol/supernode/sn-manager/internal/config"
"github.com/LumeraProtocol/supernode/sn-manager/internal/github"
"github.com/LumeraProtocol/supernode/sn-manager/internal/utils"
"github.com/spf13/cobra"
)

var checkCmd = &cobra.Command{
Use: "check",
Short: "Check for SuperNode updates",
Long: `Check GitHub for new SuperNode releases.`,
RunE: runCheck,
}

func runCheck(cmd *cobra.Command, args []string) error {
// Check if initialized
if err := checkInitialized(); err != nil {
return err
}

// Load config
cfg, err := loadConfig()
if err != nil {
return err
}

fmt.Println("Checking for updates...")

// Create GitHub client
client := github.NewClient(config.GitHubRepo)

// Get latest release
release, err := client.GetLatestRelease()
if err != nil {
return fmt.Errorf("failed to check for updates: %w", err)
}

fmt.Printf("\nLatest release: %s\n", release.TagName)
fmt.Printf("Current version: %s\n", cfg.Updates.CurrentVersion)

// Compare versions
cmp := utils.CompareVersions(cfg.Updates.CurrentVersion, release.TagName)

if cmp < 0 {
fmt.Printf("\n✓ Update available: %s → %s\n", cfg.Updates.CurrentVersion, release.TagName)
fmt.Printf("Published: %s\n", release.PublishedAt.Format("2006-01-02 15:04:05"))

if release.Body != "" {
fmt.Println("\nRelease notes:")
fmt.Println(release.Body)
}

fmt.Println("\nTo download this version, run: sn-manager get")
} else if cmp == 0 {
fmt.Println("\n✓ You are running the latest version")
} else {
fmt.Printf("\n⚠ You are running a newer version than the latest release\n")
}

return nil
}
Loading