Skip to content

Commit

Permalink
fix(build): revert to working build + cherry-picks (#1715)
Browse files Browse the repository at this point in the history
* fix(build): revert to working build + cherry-picks

* chore: changelog

* changelog + set -e
  • Loading branch information
Unique-Divine authored Dec 17, 2023
1 parent d3297de commit 2afd0da
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:

jobs:
goreleaser:
runs-on: ubuntu-latest-m
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
30 changes: 15 additions & 15 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ builds:
binary: nibid
hooks:
pre:
- cmd: bash contrib/scripts/release_pre_darwin.sh
output: false # enable for debug
env:
- TARGET={{ .Target }}
- bash contrib/scripts/release_pre_darwin.sh
goos:
- darwin
goarch:
- amd64
- arm64
env:
- CC_darwin_amd64=o64-clang
- CC_darwin_arm64=oa64-clang
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- CC=o64-clang
flags:
- -mod=readonly
- -trimpath
Expand All @@ -42,25 +37,25 @@ builds:
- static_wasm
- rocksdb
- grocksdb_no_link
overrides:
- goos: darwin
goarch: arm64
env:
- CC=oa64-clang

- id: linux
main: ./cmd/nibid
binary: nibid
hooks:
pre:
- cmd: bash contrib/scripts/release_pre_linux.sh
output: false # enable for debug
env:
- TARGET={{ .Target }}
- bash contrib/scripts/release_pre_linux.sh
goos:
- linux
goarch:
- amd64
- arm64
env:
- CC_linux_amd64=x86_64-linux-gnu-gcc
- CC_linux_arm64=aarch64-linux-gnu-gcc
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- CC=x86_64-linux-gnu-gcc
flags:
- -mod=readonly
- -trimpath
Expand All @@ -79,8 +74,13 @@ builds:
- ledger
- muslc
- rocksdb
- static
- grocksdb_no_link
- static
overrides:
- goos: linux
goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc

universal_binaries:
- id: darwin
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#1682](https://github.com/NibiruChain/nibiru/pull/1682) - feat!: add upgrade handler for v1.1.0
* [#1706](https://github.com/NibiruChain/nibiru/pull/1706) - fix: `v1.1.0` upgrade handler
* [#1712](https://github.com/NibiruChain/nibiru/pull/1712) - refactor(inflation): turn inflation off by default
* [#1715](https://github.com/NibiruChain/nibiru/pull/1715) - fix(build): revert! to working build + cherry-picks

#### Dapp modules: perp, spot, etc

Expand All @@ -73,15 +74,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#1710](https://github.com/NibiruChain/nibiru/pull/1710) - refactor(perp): Clean and organize module errors for x/perp

### Dependencies
- Bump `github.com/cometbft/cometbft-db` from 0.8.0 to 0.9.1 ([#1693](https://github.com/NibiruChain/nibiru/pull/1693))

* Bump `github.com/spf13/cast` from 1.5.1 to 1.6.0 ([#1689](https://github.com/NibiruChain/nibiru/pull/1689))
* Bump `cosmossdk.io/math` from 1.1.2 to 1.2.0 ([#1676](https://github.com/NibiruChain/nibiru/pull/1676))
* Bump `github.com/grpc-ecosystem/grpc-gateway/v2` from 2.18.0 to 2.18.1 ([#1675](https://github.com/NibiruChain/nibiru/pull/1675))
* Bump `actions/setup-go` from 4 to 5 ([#1696](https://github.com/NibiruChain/nibiru/pull/1696))
* Bump `golang` from 1.19 to 1.21 ([#1698](https://github.com/NibiruChain/nibiru/pull/1698))
* [#1678](https://github.com/NibiruChain/nibiru/pull/1678) - chore(deps): collections to v0.4.0 for math.Int value encoder
* Bump `rocksdb` from 8.1.1 to 8.8.1

## [v1.1.0] - 2023-11-20

Expand Down
78 changes: 78 additions & 0 deletions contrib/bashlib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash

set -e

# —————————————————————————————————————————————————
# COLORS: Terminal colors are set with ANSI escape codes.

export COLOR_GREEN="\033[32m"
export COLOR_CYAN="\033[36m"
export COLOR_RESET="\033[0m"

export COLOR_BLACK="\033[30m"
export COLOR_RED="\033[31m"
export COLOR_YELLOW="\033[33m"
export COLOR_BLUE="\033[34m"
export COLOR_MAGENTA="\033[35m"
export COLOR_WHITE="\033[37m"

# Bright color definitions
export COLOR_BRIGHT_BLACK="\033[90m"
export COLOR_BRIGHT_RED="\033[91m"
export COLOR_BRIGHT_GREEN="\033[92m"
export COLOR_BRIGHT_YELLOW="\033[93m"
export COLOR_BRIGHT_BLUE="\033[94m"
export COLOR_BRIGHT_MAGENTA="\033[95m"
export COLOR_BRIGHT_CYAN="\033[96m"
export COLOR_BRIGHT_WHITE="\033[97m"

# —————————————————————————————————————————————————
# LOGGING

# log_debug: Simple wrapper for `echo` with a DEBUG prefix.
log_debug() {
echo "${COLOR_CYAN}DEBUG${COLOR_RESET}" "$@"
}

# log_error: ERROR messages in red, output to stderr.
log_error() {
echo "${COLOR_RED}ERROR:${COLOR_RESET}" "$@" >&2
}

log_success() {
echo "${COLOR_GREEN}✅ Success:${COLOR_RESET}" "$@"
}

# —————————————————————————————————————————————————
# OK Suffix: Functions used for error handling or validating inputs.

# which_ok: Check if the given binary is in the $PATH.
# Returns code 0 on success and code 1 if the command fails.
which_ok() {
if which "$1" >/dev/null 2>&1; then
return 0
else
log_error "$1 is not present in \$PATH"
return 1
fi
}

# source_ok (Function): Sources a bash script if it exists.
# Usage: source_ok [bash_script]
source_ok() {
local bash_script="$1"
if test -r "$bash_script"; then
# shellcheck disable=SC1090
source "$bash_script"
fi
}

env_var_ok() {
local env_var="$1"
if [[ -z "$env_var" ]]; then
log_error "expected env var to be set"
return 1 # Return 1 to indicate error (variable is not set)
else
return 0 # Return 0 to indicate success (variable is set)
fi
}
10 changes: 7 additions & 3 deletions contrib/make/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### Build Flags ###
###############################################################################

# BRANCH: Current git branch
# COMMIT: Current commit hash
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')

Expand All @@ -15,17 +17,19 @@ ifeq (,$(VERSION))
endif
endif


OS_NAME := $(shell uname -s | tr A-Z a-z)
ifeq ($(shell uname -m),x86_64)
ARCH_NAME := amd64
else
ARCH_NAME := arm64
endif

# SDK_PACK: Cosmos-SDK version
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
TM_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::') # grab everything after the space in "github.com/tendermint/tendermint v0.34.7"
ROCKSDB_VERSION := 8.8.1
# TM_VERSION: Tendermint Core version (CometBFT)
# grab everything after the space in "github.com/tendermint/tendermint v0.34.7"
TM_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')
ROCKSDB_VERSION := 8.1.1
WASMVM_VERSION := $(shell go list -m github.com/CosmWasm/wasmvm | awk '{sub(/^v/, "", $$2); print $$2}')
DOCKER := $(shell which docker)
BUILDDIR ?= $(CURDIR)/build
Expand Down
1 change: 0 additions & 1 deletion contrib/make/release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ release-snapshot:
docker run \
--rm \
--platform linux/amd64 \
-v /tmp:/tmp \
-v "$(CURDIR)":/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
-e CGO_ENABLED=1 \
Expand Down
10 changes: 5 additions & 5 deletions contrib/scripts/release_pre_darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
set -e

WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{sub(/^v/, "", $2); print $2}')
ROCKSDB_VERSION=8.8.1

flock -x /tmp/wasmvm-lock -c "wget -c https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvmstatic_darwin.a -O /tmp/libwasmvmstatic_darwin.a && [ ! -f /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a ] && cp /tmp/libwasmvmstatic_darwin.a /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a; echo 'libwasmvm installed'"
flock -x /tmp/rocksdb-darwin-headers-lock -c "wget -c https://github.com/NibiruChain/gorocksdb/releases/download/v${ROCKSDB_VERSION}/include.${ROCKSDB_VERSION}.tar.gz -O /tmp/include.${ROCKSDB_VERSION}.tar.gz && [ ! -d /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/include/rocksdb ] && tar -xvf /tmp/include.${ROCKSDB_VERSION}.tar.gz -C /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/include/; echo 'rocksdb headers installed'"
flock -x /tmp/rocksdb-lib-lock -c "wget -c https://github.com/NibiruChain/gorocksdb/releases/download/v${ROCKSDB_VERSION}/librocksdb_${ROCKSDB_VERSION}_darwin_all.tar.gz -O /tmp/librocksdb_${ROCKSDB_VERSION}_darwin_all.tar.gz && [ ! -f /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/librocksdb.a ] && tar -xvf /tmp/librocksdb_${ROCKSDB_VERSION}_darwin_all.tar.gz -C /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/; echo 'librocksdb installed'"
wget https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvmstatic_darwin.a -O /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a
wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/include.8.1.1.tar.gz -O /root/include.8.1.1.tar.gz
tar -xf /root/include.8.1.1.tar.gz -C /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/include/
wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/librocksdb_8.1.1_darwin_all.tar.gz -O /root/librocksdb_8.1.1_darwin_all.tar.gz
tar -xf /root/librocksdb_8.1.1_darwin_all.tar.gz -C /usr/local/osxcross/SDK/MacOSX12.0.sdk/usr/lib/
25 changes: 8 additions & 17 deletions contrib/scripts/release_pre_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,11 @@
set -e

WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{sub(/^v/, "", $2); print $2}')
ROCKSDB_VERSION=8.8.1

flock -x /tmp/rocksdb-linux-headers-lock -c "wget -c https://github.com/NibiruChain/gorocksdb/releases/download/v${ROCKSDB_VERSION}/include.${ROCKSDB_VERSION}.tar.gz -O /tmp/include.${ROCKSDB_VERSION}.tar.gz && [ ! -d /usr/include/rocksdb ] && tar -xvf /tmp/include.${ROCKSDB_VERSION}.tar.gz -C /usr/include/; echo 'rocksdb headers installed'"

if [ "$TARGET" == "linux_amd64_v1" ]; then
wget -c https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a -O /tmp/libwasmvm_muslc.x86_64.a
cp /tmp/libwasmvm_muslc.x86_64.a /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a

wget -c https://github.com/NibiruChain/gorocksdb/releases/download/v${ROCKSDB_VERSION}/librocksdb_${ROCKSDB_VERSION}_linux_amd64.tar.gz -O /tmp/librocksdb_${ROCKSDB_VERSION}_linux_amd64.tar.gz
tar -xvf /tmp/librocksdb_${ROCKSDB_VERSION}_linux_amd64.tar.gz -C /usr/lib/x86_64-linux-gnu/
else
wget -c https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a -O /tmp/libwasmvm_muslc.aarch64.a
cp /tmp/libwasmvm_muslc.aarch64.a /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a

wget -c https://github.com/NibiruChain/gorocksdb/releases/download/v${ROCKSDB_VERSION}/librocksdb_${ROCKSDB_VERSION}_linux_arm64.tar.gz -O /tmp/librocksdb_${ROCKSDB_VERSION}_linux_arm64.tar.gz
tar -xvf /tmp/librocksdb_${ROCKSDB_VERSION}_linux_arm64.tar.gz -C /usr/lib/aarch64-linux-gnu/
fi
wget https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a -O /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a
wget https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a -O /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a
wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/include.8.1.1.tar.gz -O /root/include.8.1.1.tar.gz
tar -xvf /root/include.8.1.1.tar.gz -C /usr/include/
wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/librocksdb_8.1.1_linux_amd64.tar.gz -O /root/librocksdb_8.1.1_linux_amd64.tar.gz
tar -xvf /root/librocksdb_8.1.1_linux_amd64.tar.gz -C /usr/lib/x86_64-linux-gnu/
wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/librocksdb_8.1.1_linux_arm64.tar.gz -O /root/librocksdb_8.1.1_linux_arm64.tar.gz
tar -xvf /root/librocksdb_8.1.1_linux_arm64.tar.gz -C /usr/lib/aarch64-linux-gnu/
16 changes: 7 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/NibiruChain/collections v0.4.0
github.com/armon/go-metrics v0.4.1
github.com/cometbft/cometbft v0.37.2
github.com/cometbft/cometbft-db v0.9.1
github.com/cometbft/cometbft-db v0.8.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.47.5
github.com/cosmos/go-bip39 v1.0.0
Expand Down Expand Up @@ -130,7 +130,7 @@ require (
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.8.6 // indirect
github.com/linxGnu/grocksdb v1.8.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down Expand Up @@ -164,15 +164,15 @@ require (
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.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.128.0 // indirect
Expand All @@ -194,5 +194,3 @@ replace github.com/cosmos/iavl => github.com/cosmos/iavl v0.20.0

// pin version! 126854af5e6d has issues with the store so that queries fail
replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7

replace github.com/linxGnu/grocksdb => github.com/linxGnu/grocksdb v1.8.9
Loading

0 comments on commit 2afd0da

Please sign in to comment.