Skip to content

Commit

Permalink
ci: goreleaser build binary with pebbledb (#431)
Browse files Browse the repository at this point in the history
* ci: goreleaser build binary with pebbledb

* build: go version
  • Loading branch information
cosmic-vagabond authored Mar 26, 2024
1 parent a4b190f commit 192ed14
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.20"
go-version: "1.21"

- name: Install dependencies
run: |
Expand Down
32 changes: 8 additions & 24 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ builds:
- -X github.com/cosmos/cosmos-sdk/version.AppName=elysd
- -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }}
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,static_wasm
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,static_wasm,pebbledb
- -w -s
- -linkmode=external
tags:
- netgo
- ledger
- static_wasm
- pebbledb
- id: elysd-darwin-arm64
main: ./cmd/elysd/main.go
binary: elysd
Expand All @@ -51,28 +52,20 @@ builds:
- -X github.com/cosmos/cosmos-sdk/version.AppName=elysd
- -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }}
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,static_wasm
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,static_wasm,pebbledb
- -w -s
- -linkmode=external
tags:
- netgo
- ledger
- static_wasm
- pebbledb
- id: elysd-linux-amd64
main: ./cmd/elysd
binary: elysd
hooks:
pre:
# install wasmvm libs
- wget https://github.com/CosmWasm/wasmvm/releases/download/{{ .Env.COSMWASM_VERSION }}/libwasmvm_muslc.x86_64.a -O /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a
# install rocksdb lib
- apt update -y && apt install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
- cd /tmp && wget https://github.com/facebook/rocksdb/archive/refs/tags/v{{ .Env.ROCKSDB_VERSION }}.tar.gz && tar -xvf v{{ .Env.ROCKSDB_VERSION }}.tar.gz && cd rocksdb-{{ .Env.ROCKSDB_VERSION }} || return
- export CXXFLAGS='-Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=class-memaccess'
- make shared_lib
- make install-shared INSTALL_PATH=/usr
- rm -rf /tmp/rocksdb-{{ .Env.ROCKSDB_VERSION }} /tmp/v{{ .Env.ROCKSDB_VERSION }}.tar.gz
- export LD_LIBRARY_PATH=/usr/local/lib
goos:
- linux
goarch:
Expand All @@ -87,7 +80,7 @@ builds:
- -X github.com/cosmos/cosmos-sdk/version.AppName=elysd
- -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }}
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc,osusergo,rocksdb
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc,osusergo,pebbledb
- -w -s
- -linkmode=external
- -extldflags '-Wl,-z,muldefs -static -lm'
Expand All @@ -96,22 +89,13 @@ builds:
- ledger
- muslc
- osusergo
- rocksdb
- pebbledb
- id: elysd-linux-arm64
main: ./cmd/elysd
binary: elysd
hooks:
pre:
# install wasmvm libs
- wget https://github.com/CosmWasm/wasmvm/releases/download/{{ .Env.COSMWASM_VERSION }}/libwasmvm_muslc.aarch64.a -O /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a
# install rocksdb lib
- apt update -y && apt install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
- cd /tmp && wget https://github.com/facebook/rocksdb/archive/refs/tags/v{{ .Env.ROCKSDB_VERSION }}.tar.gz && tar -xvf v{{ .Env.ROCKSDB_VERSION }}.tar.gz && cd rocksdb-{{ .Env.ROCKSDB_VERSION }} || return
- export CXXFLAGS='-Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=class-memaccess'
- make shared_lib
- make install-shared INSTALL_PATH=/usr
- rm -rf /tmp/rocksdb-{{ .Env.ROCKSDB_VERSION }} /tmp/v{{ .Env.ROCKSDB_VERSION }}.tar.gz
- export LD_LIBRARY_PATH=/usr/local/lib
goos:
- linux
goarch:
Expand All @@ -126,7 +110,7 @@ builds:
- -X github.com/cosmos/cosmos-sdk/version.AppName=elysd
- -X github.com/cosmos/cosmos-sdk/version.Version=v{{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }}
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc,osusergo,rocksdb
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc,osusergo,pebbledb
- -w -s
- -linkmode=external
- -extldflags '-Wl,-z,muldefs -static -lm'
Expand All @@ -135,7 +119,7 @@ builds:
- ledger
- muslc
- osusergo
- rocksdb
- pebbledb
universal_binaries:
- id: elysd-darwin-universal
ids:
Expand Down
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ BINARY?=$(NAME)d
COMMIT:=$(shell git log -1 --format='%H')
VERSION:=$(shell git describe --tags --match 'v*' --abbrev=8 | sed 's/-g/-/' | sed 's/-[0-9]*-/-/')
GOFLAGS:=""
GOTAGS:=ledger

# add rocksdb if using linux
ifeq ($(shell uname), Linux)
GOTAGS+=rocksdb
# if rocksdb env variable is set, add the tag
ifdef ROCKSDB
DBENGINE=rocksdb
else
DBENGINE=pebbledb
endif

GOTAGS:=ledger,$(DBENGINE)

SHELL := /bin/bash # Use bash syntax

# currently installed Go version
Expand Down Expand Up @@ -43,7 +46,9 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=$(NAME) \
-X github.com/cosmos/cosmos-sdk/version.ServerName=$(BINARY) \
-X github.com/cosmos/cosmos-sdk/version.ClientName=$(BINARY) \
-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.Commit=$(COMMIT) \
-X github.com/cosmos/cosmos-sdk/types.DBBackend=$(DBENGINE) \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc,osusergo,$(DBENGINE)
BUILD_FLAGS := -ldflags '$(ldflags)' -tags '$(GOTAGS)'
BUILD_FOLDER = ./build

Expand Down
32 changes: 22 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/elys-network/elys

go 1.20
go 1.21

toolchain go1.21.3

require (
cosmossdk.io/api v0.3.1
Expand All @@ -11,7 +13,7 @@ require (
github.com/CosmWasm/wasmvm v1.3.1
github.com/bandprotocol/bandchain-packet v0.0.2
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.8.0
github.com/cometbft/cometbft-db v0.11.0
github.com/cosmos/cosmos-sdk v0.47.4
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/ibc-apps/modules/ibc-hooks/v7 v7.0.0-20230919175442-5bb677905cb3
Expand All @@ -35,19 +37,29 @@ require (
cosmossdk.io/depinject v1.0.0-alpha.3 // indirect
cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca // indirect
cosmossdk.io/tools/rosetta v0.2.1 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.0 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/linxGnu/grocksdb v1.8.12 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tidwall/btree v1.6.0 // indirect
google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect
Expand Down Expand Up @@ -104,7 +116,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
Expand Down Expand Up @@ -165,15 +177,15 @@ require (
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
Loading

0 comments on commit 192ed14

Please sign in to comment.