Skip to content
Open
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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ROOT_DIR=${AKASH_ROOT}
AKASH_DEVCACHE_BASE=${AKASH_ROOT}/.cache
AKASH_DEVCACHE=${AKASH_DEVCACHE_BASE}
AKASH_DEVCACHE_BIN=${AKASH_DEVCACHE}/bin
AKASH_DEVCACHE_LIB=${AKASH_DEVCACHE}/lib
AKASH_DEVCACHE_INCLUDE=${AKASH_DEVCACHE}/include
AKASH_DEVCACHE_VERSIONS=${AKASH_DEVCACHE}/versions
AKASH_DEVCACHE_NODE_MODULES=${AKASH_DEVCACHE}
Expand Down
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ export GOTOOLCHAIN
export GOTOOLCHAIN_SEMVER
export GOWORK

PATH_add "$AKASH_DEVCACHE_NODE_BIN"
PATH_add "$AKASH_DEVCACHE_BIN"
PATH_add "$AKASH_DEVCACHE_NODE_BIN"

AKASH_DIRENV_SET=1
AKASH=$AKASH_DEVCACHE_BIN/akash
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-ubuntu/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
- name: Install dependencies
# Shell must explicitly specify the shell for each step. https://github.com/orgs/community/discussions/18597
shell: bash
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils musl-tools
- name: Setup npm
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup-ubuntu
- run: make bins
- run: BUILD_OPTIONS=static-link make bins
- run: make docker-image

tests:
Expand Down
20 changes: 10 additions & 10 deletions .goreleaser-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ builds:
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- -extldflags "-lc -lrt -lpthread --static"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- -extldflags "-L./.cache/lib -lwasmvm_muslc.x86_64 -Wl,-z,muldefs -lm -lrt -lc -static"
- id: akash-linux-arm64
binary: akash
main: ./cmd/akash
Expand All @@ -39,12 +39,12 @@ builds:
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- -extldflags "-lc -lrt -lpthread --static"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- -extldflags "-L./.cache/lib -lwasmvm_muslc.aarch64 -Wl,-z,muldefs -lm -lrt -lc -static"
dockers:
- dockerfile: _build/Dockerfile.akash
- dockerfile: _build/akash.Dockerfile
use: buildx
goarch: amd64
goos: linux
Expand All @@ -59,7 +59,7 @@ dockers:
- --label=org.opencontainers.image.revision={{ .FullCommit }}
image_templates:
- '{{ .Env.DOCKER_IMAGE }}:latest-amd64'
- dockerfile: _build/Dockerfile.akash
- dockerfile: _build/akash.Dockerfile
use: buildx
goarch: arm64
goos: linux
Expand Down
36 changes: 20 additions & 16 deletions .goreleaser-test-bins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ builds:
env:
- CC=o64-clang
- CXX=o64-clang++
- CGO_CFLAGS=-mmacosx-version-min=10.12
- CGO_LDFLAGS=-L./.cache/lib -mmacosx-version-min=10.12
flags:
- "-mod={{ .Env.MOD }}"
- "-tags={{ .Env.BUILD_TAGS }}"
- "-tags={{ .Env.BUILD_TAGS }} static_wasm"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- id: akash-darwin-arm64
binary: akash
main: ./cmd/akash
Expand All @@ -34,14 +36,16 @@ builds:
env:
- CC=oa64-clang
- CXX=oa64-clang++
- CGO_CFLAGS=-mmacosx-version-min=10.12
- CGO_LDFLAGS=-L./.cache/lib -mmacosx-version-min=10.12
flags:
- "-mod={{ .Env.MOD }}"
- "-tags={{ .Env.BUILD_TAGS }}"
- "-tags={{ .Env.BUILD_TAGS }} static_wasm"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- id: akash-linux-amd64
binary: akash
main: ./cmd/akash
Expand All @@ -57,10 +61,10 @@ builds:
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- -extldflags "-lc -lrt -lpthread --static"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- -extldflags "-L./.cache/lib -lwasmvm_muslc.x86_64 -Wl,-z,muldefs -lm -lrt -lc -static"
- id: akash-linux-arm64
binary: akash
main: ./cmd/akash
Expand All @@ -76,10 +80,10 @@ builds:
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- -extldflags "-lc -lrt -lpthread --static"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- -extldflags "-L./.cache/lib -lwasmvm_muslc.aarch64 -Wl,-z,muldefs -lm -lrt -lc -static"
universal_binaries:
- id: akash-darwin-universal
ids:
Expand Down
40 changes: 22 additions & 18 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ builds:
env:
- CC=o64-clang
- CXX=o64-clang++
- CGO_CFLAGS=-mmacosx-version-min=10.12
flags:
- "-mod={{ .Env.MOD }}"
- "-tags={{ .Env.BUILD_TAGS }}"
- "-tags={{ .Env.BUILD_TAGS }} static_wasm"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- -extldflags "-L./.cache/lib -mmacosx-version-min=10.12"
- id: akash-darwin-arm64
binary: akash
main: ./cmd/akash
Expand All @@ -34,14 +36,16 @@ builds:
env:
- CC=oa64-clang
- CXX=oa64-clang++
- CGO_CFLAGS=-mmacosx-version-min=10.12
flags:
- "-mod={{ .Env.MOD }}"
- "-tags={{ .Env.BUILD_TAGS }}"
- "-tags={{ .Env.BUILD_TAGS }} static_wasm"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- -extldflags "-L./.cache/lib -mmacosx-version-min=10.12"
- id: akash-linux-amd64
binary: akash
main: ./cmd/akash
Expand All @@ -57,10 +61,10 @@ builds:
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- -extldflags "-lc -lrt -lpthread --static"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- -extldflags "-L./.cache/lib -lwasmvm_muslc.x86_64 -Wl,-z,muldefs -lm -lrt -lc -static"
- id: akash-linux-arm64
binary: akash
main: ./cmd/akash
Expand All @@ -76,10 +80,10 @@ builds:
- "-tags={{ .Env.BUILD_TAGS }}"
- -trimpath
ldflags:
- "{{ .Env.BUILD_VARS }}"
- "{{ .Env.STRIP_FLAGS }}"
- "-linkmode={{ .Env.LINKMODE }}"
- -extldflags "-lc -lrt -lpthread --static"
- "{{ .Env.BUILD_LDFLAGS }}"
- -s -w
- -linkmode=external
- -extldflags "-L./.cache/lib -lwasmvm_muslc.aarch64 -Wl,-z,muldefs -lm -lrt -lc -static"
universal_binaries:
- id: akash-darwin-universal
ids:
Expand Down Expand Up @@ -117,7 +121,7 @@ checksum:
name_template: "akash_{{ .Version }}_checksums.txt"

dockers:
- dockerfile: _build/Dockerfile.akash
- dockerfile: _build/akash.Dockerfile
use: buildx
goarch: amd64
goos: linux
Expand All @@ -134,7 +138,7 @@ dockers:
- '{{ .Env.DOCKER_IMAGE }}:{{ .ShortCommit }}-amd64'
- '{{ .Env.DOCKER_IMAGE }}:{{ replace .Version "+" "-" }}-amd64'
- '{{ .Env.DOCKER_IMAGE }}:{{if eq .Env.STABLE "true"}}stable{{else}}latest{{end}}-amd64'
- dockerfile: _build/Dockerfile.akash
- dockerfile: _build/akash.Dockerfile
use: buildx
goarch: arm64
goos: linux
Expand Down
65 changes: 43 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ APP_DIR := ./app

GOBIN ?= $(shell go env GOPATH)/bin

KIND_APP_IP ?= $(shell make -sC _run/kube kind-k8s-ip)
KIND_APP_PORT ?= $(shell make -sC _run/kube app-http-port)
KIND_VARS ?= KUBE_INGRESS_IP="$(KIND_APP_IP)" KUBE_INGRESS_PORT="$(KIND_APP_PORT)"

include make/init.mk

.DEFAULT_GOAL := bins
Expand All @@ -24,44 +20,69 @@ IS_PREREL := $(shell $(ROOT_DIR)/script/is_prerelease.sh "$(RELEASE_
IS_MAINNET := $(shell $(ROOT_DIR)/script/mainnet-from-tag.sh "$(RELEASE_TAG)" && echo "true" || echo "false")
IS_STABLE ?= false

GO_LINKMODE ?= external
GOMOD ?= readonly
BUILD_TAGS ?= osusergo,netgo,ledger
GORELEASER_STRIP_FLAGS ?=

ifeq ($(IS_MAINNET), true)
ifeq ($(IS_PREREL), false)
IS_STABLE := true
endif
endif

GOMOD ?= readonly

ifneq ($(UNAME_OS),Darwin)
BUILD_OPTIONS ?= static-link
endif

BUILD_TAGS := osusergo netgo ledger muslc gcc
DB_BACKEND := goleveldb
BUILD_FLAGS :=

GORELEASER_STRIP_FLAGS ?=

ifeq (cleveldb,$(findstring cleveldb,$(BUILD_OPTIONS)))
DB_BACKEND=cleveldb
else ifeq (rocksdb,$(findstring rocksdb,$(BUILD_OPTIONS)))
DB_BACKEND=rocksdb
else ifeq (goleveldb,$(findstring goleveldb,$(BUILD_OPTIONS)))
DB_BACKEND=goleveldb
endif

ifneq (,$(findstring cgotrace,$(BUILD_OPTIONS)))
BUILD_TAGS := $(BUILD_TAGS),cgotrace
BUILD_TAGS += cgotrace
endif

GORELEASER_BUILD_VARS := \
-X github.com/cosmos/cosmos-sdk/version.Name=akash \
-X github.com/cosmos/cosmos-sdk/version.AppName=akash \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=\"$(BUILD_TAGS)\" \
-X github.com/cosmos/cosmos-sdk/version.Version=$(RELEASE_TAG) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_HEAD_COMMIT_LONG)
build_tags := $(strip $(BUILD_TAGS))
build_tags_cs := $(subst $(WHITESPACE),$(COMMA),$(build_tags))

ldflags = -linkmode=$(GO_LINKMODE) -X github.com/cosmos/cosmos-sdk/version.Name=akash \
ldflags := -X github.com/cosmos/cosmos-sdk/version.Name=akash \
-X github.com/cosmos/cosmos-sdk/version.AppName=akash \
-X github.com/cosmos/cosmos-sdk/version.BuildTags="$(BUILD_TAGS)" \
-X github.com/cosmos/cosmos-sdk/version.BuildTags="$(build_tags_cs)" \
-X github.com/cosmos/cosmos-sdk/version.Version=$(shell git describe --tags | sed 's/^v//') \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_HEAD_COMMIT_LONG)
-X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_HEAD_COMMIT_LONG) \
-X github.com/cosmos/cosmos-sdk/types.DBBackend=$(DB_BACKEND)

GORELEASER_LDFLAGS := $(ldflags)

ldflags += -linkmode=external

ifeq (static-link,$(findstring static-link,$(BUILD_OPTIONS)))
ldflags += -extldflags "-L$(AKASH_DEVCACHE_LIB) -lm -Wl,-z,muldefs -static"
else
ldflags += -extldflags "-L$(AKASH_DEVCACHE_LIB)"
endif

# check for nostrip option
ifeq (,$(findstring nostrip,$(BUILD_OPTIONS)))
ldflags += -s -w
GORELEASER_STRIP_FLAGS += -s -w
ldflags += -s -w
BUILD_FLAGS += -trimpath
endif

ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

BUILD_FLAGS := -mod=$(GOMOD) -tags='$(BUILD_TAGS)' -ldflags '$(ldflags)'
GORELEASER_TAGS := $(BUILD_TAGS)
GORELEASER_FLAGS := $(BUILD_FLAGS) -mod=$(GOMOD) -tags='$(build_tags)'

BUILD_FLAGS += -mod=$(GOMOD) -tags='$(build_tags_cs)' -ldflags '$(ldflags)'

.PHONY: all
all: build bins
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions _run/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AKASH_KEYRING_BACKEND=test
AKASH_GAS_ADJUSTMENT=2
AKASH_CHAIN_ID=local
AKASH_YES=true
AKASH_GAS_PRICES=0.025uakt
AKASH_GAS=auto
AKASH_NODE=http://localhost:26657
11 changes: 11 additions & 0 deletions _run/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source_up .envrc

if ! has grpcurl ; then
echo -e "\033[31mgrpcurl is not installed"; exit 1
fi

if ! has tqdm ; then
echo -e "\033[31mtqdm is not installed. https://github.com/tqdm/tqdm"; exit 1
fi

dotenv .env
8 changes: 8 additions & 0 deletions _run/.envrc_run
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source_up .envrc

AKASH_RUN_NAME=$(basename "$(pwd)")
AKASH_RUN_DIR="${AKASH_RUN}/${AKASH_RUN_NAME}"

export AKASH_HOME="${AKASH_RUN_DIR}/.akash"
export AKASH_RUN_NAME
export AKASH_RUN_DIR
29 changes: 29 additions & 0 deletions _run/common-base.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
include $(abspath $(CURDIR)/../../make/init.mk)

ifeq ($(AKASH_RUN_NAME),)
$(error "AKASH_RUN_NAME is not set")
endif

ifeq ($(AKASH_RUN_DIR),)
$(error "AKASH_RUN_DIR is not set")
endif

ifneq ($(AKASH_HOME),)
ifneq ($(DIRENV_FILE),$(CURDIR)/.envrc)
$(error "AKASH_HOME is set by the upper dir (probably in ~/.bashrc|~/.zshrc), \
but direnv does not seem to be configured. \
Ensure direnv is installed and hooked to your shell profile. Refer to the documentation for details. \
")
endif
else
$(error "AKASH_HOME is not set")
endif

.PHONY: akash
akash:
ifneq ($(SKIP_BUILD), true)
make -C $(AKASH_ROOT) akash
endif

.PHONY: bins
bins: akash
Loading
Loading