mirror of
https://github.com/luxfi/sdk.git
synced 2026-10-30 15:19:23 +00:00
Lux Partners Limited is not the entity behind this work. Every place the old name stood — copyright lines, site footers, brand config, legal and compliance text — now names the company that actually holds it. lux.fund is the exception and is not renamed to match: that site belongs to Lux Assets Management LLC, a different company, and it says so. Two kinds of line were left for a person rather than rewritten. A dated news item recording that Lux Partners Limited was established in the Isle of Man is a historical fact, and renaming it would falsify the record. And a sentence asserting that the company is domiciled in the Isle of Man is a claim about a jurisdiction, not a name — an Inc or an LLC is not an Isle of Man company, so swapping the name there would assert something untrue. Co-authored-by: Hanzo Dev <[email protected]>
139 lines
3.8 KiB
Makefile
139 lines
3.8 KiB
Makefile
# Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
|
# See the file LICENSE for licensing terms.
|
|
|
|
.PHONY: all build test lint clean install
|
|
|
|
# Go parameters
|
|
GOCMD=go
|
|
GOBUILD=$(GOCMD) build
|
|
GOTEST=$(GOCMD) test
|
|
GOGET=$(GOCMD) get
|
|
GOMOD=$(GOCMD) mod
|
|
GOFMT=gofmt
|
|
GOLINT=golangci-lint
|
|
GOVET=$(GOCMD) vet
|
|
|
|
# Build parameters
|
|
BINARY_NAME=lux-sdk
|
|
VERSION?=$(shell git describe --tags --always --dirty)
|
|
BUILD_TIME=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
|
|
LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.BuildTime=$(BUILD_TIME)"
|
|
|
|
# Directories
|
|
SRC_DIR=.
|
|
TEST_DIR=./tests
|
|
EXAMPLES_DIR=./examples
|
|
|
|
all: clean lint test build
|
|
|
|
build:
|
|
@echo "Building SDK..."
|
|
$(GOBUILD) -v $(LDFLAGS) -o $(BINARY_NAME) $(SRC_DIR)
|
|
@echo "Building examples..."
|
|
cd $(EXAMPLES_DIR)/boot-mainnet && $(GOBUILD) -v ./...
|
|
|
|
test:
|
|
@echo "Running unit tests..."
|
|
$(GOTEST) -v -race -coverprofile=coverage.out -covermode=atomic ./blockchain ./network ./heap ./crypto ./internal/...
|
|
|
|
test-integration:
|
|
@echo "Running full integration tests..."
|
|
$(GOTEST) -v -tags=integration -timeout=30m $(TEST_DIR)
|
|
|
|
test-coverage:
|
|
@echo "Running tests with coverage..."
|
|
$(GOTEST) -v -race -coverprofile=coverage.out -covermode=atomic ./...
|
|
$(GOCMD) tool cover -html=coverage.out -o coverage.html
|
|
@echo "Coverage report generated: coverage.html"
|
|
|
|
benchmark:
|
|
@echo "Running benchmarks..."
|
|
$(GOTEST) -bench=. -benchmem -run=^$$ ./... | tee benchmark.txt
|
|
|
|
lint:
|
|
@echo "Running linters..."
|
|
$(GOFMT) -s -w .
|
|
$(GOVET) ./...
|
|
$(GOLINT) run --timeout=10m
|
|
|
|
lint-fix:
|
|
@echo "Fixing lint issues..."
|
|
$(GOFMT) -s -w .
|
|
$(GOLINT) run --fix
|
|
|
|
deps:
|
|
@echo "Installing dependencies..."
|
|
$(GOMOD) download
|
|
$(GOMOD) tidy
|
|
|
|
deps-update:
|
|
@echo "Updating dependencies..."
|
|
$(GOMOD) get -u ./...
|
|
$(GOMOD) tidy
|
|
|
|
install-tools:
|
|
@echo "Installing development tools..."
|
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
|
go install github.com/golang/mock/mockgen@latest
|
|
go install gotest.tools/gotestsum@latest
|
|
|
|
generate:
|
|
@echo "Generating code..."
|
|
go generate ./...
|
|
|
|
clean:
|
|
@echo "Cleaning..."
|
|
$(GOCMD) clean
|
|
rm -f $(BINARY_NAME)
|
|
rm -f coverage.out coverage.html
|
|
rm -f benchmark.txt
|
|
|
|
install: build
|
|
@echo "Installing SDK..."
|
|
$(GOCMD) install $(LDFLAGS) $(SRC_DIR)
|
|
|
|
docker-build:
|
|
@echo "Building Docker image..."
|
|
docker build -t luxfi/sdk:$(VERSION) -t luxfi/sdk:latest .
|
|
|
|
docker-test:
|
|
@echo "Running tests in Docker..."
|
|
docker-compose -f tests/docker-compose.yml up --build --abort-on-container-exit
|
|
docker-compose -f tests/docker-compose.yml down
|
|
|
|
ci-local:
|
|
@echo "Running CI checks locally..."
|
|
make lint
|
|
make test
|
|
make test-coverage
|
|
make build
|
|
|
|
release-dry-run:
|
|
@echo "Running release dry run..."
|
|
goreleaser release --snapshot --skip-publish --rm-dist
|
|
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " all - Clean, lint, test, and build"
|
|
@echo " build - Build the SDK and examples"
|
|
@echo " test - Run unit tests"
|
|
@echo " test-integration - Run integration tests"
|
|
@echo " test-coverage - Run tests with coverage report"
|
|
@echo " benchmark - Run benchmarks"
|
|
@echo " lint - Run linters"
|
|
@echo " lint-fix - Fix lint issues"
|
|
@echo " deps - Download dependencies"
|
|
@echo " deps-update - Update dependencies"
|
|
@echo " install-tools - Install development tools"
|
|
@echo " generate - Generate code"
|
|
@echo " clean - Clean build artifacts"
|
|
@echo " install - Install the SDK"
|
|
@echo " docker-build - Build Docker image"
|
|
@echo " docker-test - Run tests in Docker"
|
|
@echo " ci-local - Run CI checks locally"
|
|
@echo " help - Show this help message"
|
|
|
|
.PHONY: docs
|
|
docs: ## Generate the Go SDK reference (godoc) into docs.lux.network
|
|
GOWORK=off go run ./tools/docgen $(HOME)/work/lux/docs/apps/docs/content/docs/sdk/go/packages .
|