Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dockerfile that and script that automates node operation #72

Closed
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
2 changes: 1 addition & 1 deletion .devcontainer/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.env
.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ name: Release
on:
push:
tags:
- "*"
- "v[0-9]+\\.[0-9]+\\.[0-9]+-alpha[0-9]+" # vX.X.X-alphaX
- "v[0-9]+\\.[0-9]+\\.[0-9]+-beta[0-9]+" # vX.X.X-betaX
- "v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+" # vX.X.X-rcX
- "v[0-9]+\\.[0-9]+\\.[0-9]+" # vX.X.X
# SemVer regex taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
- "^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
concurrency:
group: ci-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ build/
dist/

/.act-event-file

scripts/testnet/config.sh
scripts/testnet/nodes
9 changes: 8 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,11 @@ checksum:
algorithm: sha256

changelog:
skip: false
skip: false


dockers:
- image_templates:
- ghcr.io/sedaprotocol/seda-chain:{{.Version}}
- dockerfile: "gorelease.Dockerfile"
- skip_push: false
138 changes: 130 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,141 @@ endif
all: tools build lint test

###############################################################################
### Build ###
## Build ##
###############################################################################

build: go.sum
CGO_ENABLED=1 go build -mod=readonly $(BUILD_FLAGS) -o build/seda-chaind ./cmd/seda-chaind
build_tags = netgo

# experimental feature
ifeq ($(EXPERIMENTAL),true)
build_tags += experimental
endif

ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
build_tags += ledger
endif
endif
endif
endif

ifeq (secp,$(findstring secp,$(COSMOS_BUILD_OPTIONS)))
build_tags += libsecp256k1_sdk
endif

whitespace :=
whitespace += $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=seda-chain \
-X github.com/cosmos/cosmos-sdk/version.AppName=seda-chaind \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TMVERSION)
Comment on lines +71 to +115
Copy link
Member

Choose a reason for hiding this comment

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

I think we have this already, no?


ifeq ($(ENABLE_ROCKSDB),true)
BUILD_TAGS += rocksdb
test_tags += rocksdb
endif

# DB backend selection
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
build_tags += gcc
endif
ifeq (badgerdb,$(findstring badgerdb,$(COSMOS_BUILD_OPTIONS)))
BUILD_TAGS += badgerdb
endif
# handle rocksdb
ifeq (rocksdb,$(findstring rocksdb,$(COSMOS_BUILD_OPTIONS)))
ifneq ($(ENABLE_ROCKSDB),true)
$(error Cannot use RocksDB backend unless ENABLE_ROCKSDB=true)
endif
CGO_ENABLED=1
endif
Comment on lines +126 to +135
Copy link
Member

Choose a reason for hiding this comment

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

Do we need these DB checks?


ifeq ($(LINK_STATICALLY),true)
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
endif

ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
ldflags += -w -s
endif
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
# check for nostrip option
ifeq (,$(findstring nostrip,$(COSMOS_BUILD_OPTIONS)))
BUILD_FLAGS += -trimpath
endif

# Check for debug option
ifeq (debug,$(findstring debug,$(COSMOS_BUILD_OPTIONS)))
BUILD_FLAGS += -gcflags "all=-N -l"
endif

all: tools build lint test

echo-build-tags:
echo ${BUILD_TAGS}

BUILD_TARGETS := build install

build: BUILD_ARGS=-o $(BUILDDIR)/
build-linux:
@if [ "${ENABLE_ROCKSDB}" != "true" ]; then \
echo "RocksDB support is disabled; to build and test with RocksDB support, set ENABLE_ROCKSDB=true"; fi
GOOS=linux GOARCH=$(if $(findstring aarch64,$(shell uname -m)) || $(findstring arm64,$(shell uname -m)),arm64,amd64) LEDGER_ENABLED=false $(MAKE) build

$(BUILD_TARGETS): go.sum $(BUILDDIR)/
@if [ "${ENABLE_ROCKSDB}" != "true" ]; then \
echo "RocksDB support is disabled; to build and test with RocksDB support, set ENABLE_ROCKSDB=true"; fi
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...
Comment on lines +168 to +177
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be better if build-linux gives us seda-chaind-linux to be distinguished from the output of build?


$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/

build-experimental: go.sum
@echo "--> Building Experimental version..."
EXPERIMENTAL=true $(MAKE) build

build-no_cgo:
@echo "--> Building static binary with no CGO nor GLIBC dynamic linking..."
ifneq ($(ENABLE_ROCKSDB),true)
$(error RocksDB requires CGO)
endif
CGO_ENABLED=0 CGO_LDFLAGS="-static" $(MAKE) build


go-mod-tidy:
@contrib/scripts/go-mod-tidy-all.sh

build-linux: go.sum
LEDGER_ENABLED=false GOOS=linux CGO_ENABLED=1 go build -mod=readonly $(BUILD_FLAGS) -o build/seda-chaind-linux ./cmd/seda-chaind
clean:
@echo "--> Cleaning..."
@rm -rf $(BUILD_DIR)/** $(DIST_DIR)/**

install: go.sum
CGO_ENABLED=1 go install -mod=readonly $(BUILD_FLAGS) ./cmd/seda-chaind
.PHONY: build build-linux build-experimental build-no_cgo clean go-mod-tidy

.PHONY: build install

###############################################################################
### Tools & Dependencies ###
Expand Down
Loading
Loading