Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update release pipeline to match non-wasm env #901

Merged
merged 6 commits into from
Feb 14, 2023
Merged
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
3 changes: 1 addition & 2 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
59 changes: 59 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 1 addition & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)" \
Expand All @@ -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
.PHONY: release-snapshot release
24 changes: 1 addition & 23 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"errors"

"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand Down
6 changes: 0 additions & 6 deletions simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down