From a642968ccb686c920577115fd5caddd21eedd4a1 Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Wed, 15 Feb 2023 01:39:21 +0900 Subject: [PATCH] build: update release pipeline to match non-wasm env (#901) * remove useless cmd & config related to wasm * add multi-arch config to generate bins * add CHANGELOG * change default releaser image * remove wasm-binding in Dockerfile * remove wasm config in simapp --- .github/workflows/tag.yml | 3 +- .goreleaser.yml | 59 +++++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 1 + Dockerfile | 11 +------- Makefile | 10 ++----- simapp/simd/cmd/root.go | 24 +--------------- simapp/test_helpers.go | 6 ---- 7 files changed, 66 insertions(+), 48 deletions(-) diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 15f15f0068..e089b61180 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -18,7 +18,6 @@ jobs: make release env: GORELEASER_MOUNT_CONFIG: true - GORELEASER_IMAGE: line/goreleaserx-wasm:1.0.0-0.10.0 + GORELEASER_IMAGE: line/goreleaserx:1.13.1-1.19.3 GORELEASER_RELEASE: true - BUILD_TAGS: static GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 38bcd93b0d..c4452eb73a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -11,6 +11,62 @@ builds: - amd64 env: - CGO_ENABLED=1 + - CC=x86_64-linux-gnu-gcc + - CXX=x86_64-linux-gnu-g++ + flags: + - -mod=readonly + - -trimpath + - "-tags={{ .Env.BUILD_TAGS }}" + ldflags: + - "{{ .Env.BUILD_VARS }}" + + - id: simd-linux-arm64 + main: ./simapp/simd + binary: simd + goos: + - linux + goarch: + - arm64 + env: + - CGO_ENABLED=1 + - CC=aarch64-linux-gnu-gcc + - CXX=aarch64-linux-gnu-g++ + flags: + - -mod=readonly + - -trimpath + - "-tags={{ .Env.BUILD_TAGS }}" + ldflags: + - "{{ .Env.BUILD_VARS }}" + + - id: simd-darwin-amd64 + main: ./simapp/simd + binary: simd + goos: + - darwin + goarch: + - amd64 + env: + - CGO_ENABLED=1 + - CC=o64-clang + - CXX=o64-clang++ + flags: + - -mod=readonly + - -trimpath + - "-tags={{ .Env.BUILD_TAGS }}" + ldflags: + - "{{ .Env.BUILD_VARS }}" + + - id: simd-darwin-arm64 + main: ./simapp/simd + binary: simd + goos: + - darwin + goarch: + - arm64 + env: + - CGO_ENABLED=1 + - CC=oa64-clang + - CXX=oa64-clang++ flags: - -mod=readonly - -trimpath @@ -23,6 +79,9 @@ archives: id: bin-archive builds: - simd-linux-amd64 + - simd-linux-arm64 + - simd-darwin-amd64 + - simd-darwin-arm64 format: tar.gz name_template: "simd_{{ .Version }}_{{ .Os }}_{{ .Arch }}" wrap_in_directory: true diff --git a/CHANGELOG.md b/CHANGELOG.md index bf97fcc584..57c8468ee1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,5 +76,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Build, CI * (ci) [\#829](https://github.com/line/lbm-sdk/pull/829) automate release process * (build) [\#872](https://github.com/line/lbm-sdk/pull/872) Retract v1.0.0 +* (ci, build) [\#901](https://github.com/line/lbm-sdk/pull/901) Update release pipeline to match non-wasm env ### Document Updates diff --git a/Dockerfile b/Dockerfile index c7d4932f75..91a360be13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,20 +30,11 @@ COPY ./go.mod /go/src/github.com/line/lbm-sdk/go.mod COPY ./go.sum /go/src/github.com/line/lbm-sdk/go.sum RUN go mod download -# See https://github.com/line/wasmvm/releases -# See https://github.com/line/wasmvm/releases -ADD https://github.com/line/wasmvm/releases/download/v1.0.0-0.10.0/libwasmvm_static.x86_64.a /lib/libwasmvm_static.x86_64.a -ADD https://github.com/line/wasmvm/releases/download/v1.0.0-0.10.0/libwasmvm_static.aarch64.a /lib/libwasmvm_static.aarch64.a -RUN sha256sum /lib/libwasmvm_static.aarch64.a | grep bc3db72ba32f34ad88ceb1d20479411bd7f50ccd6a5ca50cc8ca462a561e6189 -RUN sha256sum /lib/libwasmvm_static.x86_64.a | grep 352fa5de5f9dba66f0a38082541d3e63e21394fee3e577ea35e0906294c61276 - -RUN ln -s /lib/libwasmvm_static.${ARCH}.a /usr/lib/libwasmvm_static.a - # Add source files COPY . . # install simapp, remove packages -RUN BUILD_TAGS=static make build CGO_ENABLED=1 +RUN make build CGO_ENABLED=1 # Final image FROM alpine:edge diff --git a/Makefile b/Makefile index fc3d2b6b3c..6078ab800c 100644 --- a/Makefile +++ b/Makefile @@ -576,14 +576,12 @@ libsodium: GORELEASER_CONFIG ?= .goreleaser.yml GORELEASER_BUILD_LDF = $(ldflags) -GORELEASER_BUILD_LDF += -linkmode=external -extldflags "-Wl,-z,muldefs -static" GORELEASER_BUILD_LDF := $(strip $(GORELEASER_BUILD_LDF)) GORELEASER_SKIP_VALIDATE ?= false GORELEASER_DEBUG ?= false -GORELEASER_IMAGE ?= line/goreleaserx-wasm:1.0.0-0.10.0 +GORELEASER_IMAGE ?= line/goreleaserx:1.13.1-1.19.3 GORELEASER_RELEASE ?= false -#GO_MOD_NAME := $(shell go list -m 2>/dev/null) GO_MOD_NAME := github.com/line/lbm-sdk ifeq ($(GORELEASER_RELEASE),true) @@ -613,6 +611,7 @@ release-snapshot: --skip-validate=$(GORELEASER_SKIP_VALIDATE) \ --debug=$(GORELEASER_DEBUG) \ --rm-dist + release: docker run --rm \ -e BUILD_TAGS="$(build_tags)" \ @@ -629,7 +628,4 @@ release: --debug=$(GORELEASER_DEBUG) \ --rm-dist -build-static: go.sum - CGO_ENABLED=1 go build -mod=readonly -tags "$(build_tags)" -ldflags '$(GORELEASER_BUILD_LDF)' -trimpath -o ./build/ ./... - -.PHONY: release-snapshot release build-static \ No newline at end of file +.PHONY: release-snapshot release \ No newline at end of file diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index 7fb2b15345..25702c6dda 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -2,7 +2,6 @@ package cmd import ( "errors" - "io" "os" "path/filepath" @@ -90,19 +89,8 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { func initAppConfig() (string, interface{}) { // The following code snippet is just for reference. - // WASMConfig defines configuration for the wasm module. - type WASMConfig struct { - // This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries - QueryGasLimit uint64 `mapstructure:"query_gas_limit"` - - // Address defines the gRPC-web server to listen on - LruSize uint64 `mapstructure:"lru_size"` - } - type CustomAppConfig struct { serverconfig.Config - - WASM WASMConfig `mapstructure:"wasm"` } // Optionally allow the chain developer to overwrite the SDK's default @@ -125,19 +113,9 @@ func initAppConfig() (string, interface{}) { customAppConfig := CustomAppConfig{ Config: *srvCfg, - WASM: WASMConfig{ - LruSize: 1, - QueryGasLimit: 300000, - }, } - customAppTemplate := serverconfig.DefaultConfigTemplate + ` -[wasm] -# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries -query_gas_limit = 300000 -# This is the number of wasm vm instances we keep cached in memory for speed-up -# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally -lru_size = 0` + customAppTemplate := serverconfig.DefaultConfigTemplate return customAppTemplate, customAppConfig } diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index 832e258c1c..784fc7eb81 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -209,12 +209,6 @@ func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...ba return app } -// SetupWithEmptyStore setup a wasmd app instance with empty DB -func SetupWithEmptyStore() *SimApp { - app, _ := setup(false, 0) - return app -} - type GenerateAccountStrategy func(int) []sdk.AccAddress // createRandomAccounts is a strategy used by addTestAddrs() in order to generated addresses in random order.