Skip to content

Commit

Permalink
update decentr, add crescent
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnuj committed Oct 12, 2023
1 parent 33e52e4 commit f18893e
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 7 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/crescent-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: crescent-build

on:
pull_request:
branches:
- main
paths:
- 'bin/builder'
- 'arch.Dockerfile'
- 'alpine.Dockerfile'
- '.github/workflows/docker-build.yml'
- '.github/workflows/crescent-build.yml'

push:
branches:
- main
paths:
- 'bin/builder'
- 'arch.Dockerfile'
- 'alpine.Dockerfile'
- '.github/workflows/docker-build.yml'
- '.github/workflows/crescent-build.yml'

jobs:
crescent-build:
uses: ./.github/workflows/docker-build.yml
secrets: inherit
strategy:
fail-fast: false
matrix:
#platform: ["linux/amd64", "linux/arm64"] # need arm runners
platform: ["linux/amd64"]
distro: ["alpine"]
version:
- "1.5.7"
- "1.5.8"
- "1.6.0"
- "1.6.1"
- "1.6.2"

include:
# Include Defaults (keep at top)
- name: "crescent"
binary: "crescentd"
build_command: "make install"
build_tags: "netgo"
chain_registry_name: "crescent"
go_version: "1.19"
repo: "crescent-network/crescent"
os: "linux"
arch: "amd64"

with:
binary: ${{ matrix.binary }}
build_command: ${{ matrix.build_command }}
build_tags: ${{ matrix.build_tags }}
chain_registry_name: ${{ matrix.chain_registry_name }}
go_version: ${{ matrix.go_version }}
name: ${{ matrix.name }}
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
platform: ${{ matrix.platform }}
repo: ${{ matrix.repo }}
version: ${{ matrix.version }}
9 changes: 7 additions & 2 deletions .github/workflows/decentr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
version:
- "1.5.7"
- "1.5.8"
- "1.5.9"
- "1.6.0"
- "1.6.1"
- "1.6.2"
Expand All @@ -44,15 +43,21 @@ jobs:
- name: "decentr"
binary: "decentrd"
build_command: "make install"
build_tags: "netgo"
chain_registry_name: "decentr"
go_version: "1.19"
repo: "Decentr-net/decentr"
os: "linux"
arch: "amd64"


- version: 1.5.7
go_version: "1.16"


with:
binary: ${{ matrix.binary }}
build_command: ${{ matrix.build_command }}
build_tags: ${{ matrix.build_tags }}
chain_registry_name: ${{ matrix.chain_registry_name }}
go_version: ${{ matrix.go_version }}
name: ${{ matrix.name }}
Expand Down
14 changes: 9 additions & 5 deletions alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN set -eu &&\
bash \
bison \
curl \
gcompat \
git

COPY ./bin/install-mimalloc ./bin/install-wasmvm /usr/local/bin/
Expand All @@ -22,14 +23,10 @@ FROM base as builder

ARG APP_NAME="terra"
ARG BIN_NAME="${APP_NAME}d"
ARG BUILD_COMMAND="make install"
ARG BUILD_TAGS="netgo,ledger,muslc"
ARG COSMOS_BUILD_OPTIONS="nostrip"
ARG DENOM
ARG GIT_TAG="v2.4.1"
ARG GIT_REPO="terra-money/core"
#ARG LDFLAGS="-extldflags '-L/go/src/mimalloc/build -lmimalloc -Wl,-z,muldefs -static'"
ARG LDFLAGS='-w -s -linkmode external -extldflags "-Wl,-z,muldefs -static"'
ARG MIMALLOC_VERSION
ARG GO_VERSION

Expand Down Expand Up @@ -63,7 +60,13 @@ RUN set -ux && \
[ -n "${WASMVM_VERSION}" ] && install-wasmvm "${WASMVM_VERSION}" || true

# build the binary
ARG BUILD_COMMAND="make install"
ARG BUILD_TAGS="netgo,ledger,muslc"
ARG LDFLAGS='-w -s -linkmode external -extldflags "-Wl,-z,muldefs -static"'
#ARG LDFLAGS="-extldflags '-L/go/src/mimalloc/build -lmimalloc -Wl,-z,muldefs -static'"

ENV APP_NAME=${APP_NAME} \
BUILD_COMMAND=${BUILD_COMMAND} \
BUILD_TAGS=${BUILD_TAGS} \
DENOM=${DENOM} \
LDFLAGS=${LDFLAGS} \
Expand All @@ -73,11 +76,12 @@ ENV APP_NAME=${APP_NAME} \
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
set -eux && \
export CGO_ENABLED=0 && \
export COMMIT=GIT_COMMIT="$(git log -1 --format='%h')" && \
export VERSION=GIT_VERSION="$(git describe --tags --dirty --always)" && \
export DENOM=${DENOM:-"u$(echo ${APP_NAME} | head -c 4)"} && \
export GOWORK=off && \
${BUILD_COMMAND}
eval ${BUILD_COMMAND}

# verify static binary
RUN set -x && \
Expand Down
29 changes: 29 additions & 0 deletions builds/crescent.4.0.0.alpine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh -x

BASEDIR=$(dirname "$0")
DOCKER_DIR="${BASEDIR}/.."
IMAGE="alpine"
NAME="crescent"
REPO="crescent-network/crescent"
TAG="4.0.0"
GO_VERSION="1.18"

cd "${DOCKER_DIR}"
docker buildx build "." -f "${IMAGE}.Dockerfile" \
--load \
--progress plain \
--tag "terraformlabs/${NAME}:${TAG}" \
--platform "linux/amd64" \
--build-arg "OS=linux" \
--build-arg "ARCH=amd64" \
--build-arg "APP_NAME=${NAME}" \
--build-arg "BIN_NAME=${NAME}d" \
--build-arg "BUILD_COMMAND=make install" \
--build-arg "BUILD_TAGS=netgo ledger muslc" \
--build-arg "COSMOS_BUILD_OPTIONS=" \
--build-arg "GIT_TAG=v${TAG}" \
--build-arg "GIT_REPO=${REPO}" \
--build-arg "GO_VERSION=${GO_VERSION}" \
--build-arg "MIMALLOC_VERSION=" \
--build-arg "LDFLAGS=-w -s -linkmode=external -extldflags \"-Wl,-z,muldefs -static\"" \
$@
44 changes: 44 additions & 0 deletions builds/decentr.1.5.7.alpine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh -x

BASEDIR=$(dirname "$0")
DOCKER_DIR="${BASEDIR}/.."
IMAGE="alpine"
NAME="decentr"
REPO="Decentr-net/decentr"
TAG="1.5.7"
GO_VERSION="1.16"

# BUILD_COMMAND=$(cat <<-'EOT'
# go install \
# -mod=readonly \
# -tags "netgo ledger muslc" \
# -ldflags '\
# -X github.com/cosmos/cosmos-sdk/version.Name=decentr \
# -X github.com/cosmos/cosmos-sdk/version.AppName=decentrd \
# -X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \
# -X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \
# -w -s -linkmode=external -extldflags \"-Wl,-z,muldefs -static -lgcompat\" \
# ' \
# -trimpath \
# ./cmd/decentrd
# EOT
# )

cd "${DOCKER_DIR}"
docker buildx build "." -f "${IMAGE}.Dockerfile" \
--load \
--progress plain \
--tag "terraformlabs/${NAME}:${TAG}" \
--platform "linux/amd64" \
--build-arg "OS=linux" \
--build-arg "ARCH=amd64" \
--build-arg "APP_NAME=${NAME}" \
--build-arg "BIN_NAME=${NAME}d" \
--build-arg "BUILD_TAGS=netgo ledger muslc" \
--build-arg "COSMOS_BUILD_OPTIONS=" \
--build-arg "GIT_TAG=v${TAG}" \
--build-arg "GIT_REPO=${REPO}" \
--build-arg "GO_VERSION=${GO_VERSION}" \
--build-arg "MIMALLOC_VERSION=" \
--build-arg "LDFLAGS=-w -s -linkmode=external -extldflags \"-Wl,-z,muldefs -static\"" \
$@

0 comments on commit f18893e

Please sign in to comment.