diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 1a56944c93..5fa7a0f11b 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -19,16 +19,6 @@ jobs: - uses: actions/setup-go@v3 with: go-version: '>=1.19.3' - cache: true - - name: Set Env - run: echo "TM_VERSION=$(go list -m github.com/tendermint/tendermint | sed 's:.* ::')" >> $GITHUB_ENV - # More assembly might be required: Docker logins, GPG, etc. It all depends - # on your needs. - - uses: goreleaser/goreleaser-action@v2 - with: - distribution: goreleaser - version: latest - args: release --rm-dist + - run: make release env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TM_VERSION: ${{ env.TM_VERSION }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 37a7171fc2..6222307994 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,17 +1,46 @@ -before: - hooks: - - sudo wget https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.x86_64.a -O /lib/libwasmvm_muslc.a - - sudo apt install musl-dev +project_name: nibid + +env: + - CGO_ENABLED=1 + builds: - - id: linux-amd64 + - id: darwin + main: ./cmd/nibid + binary: nibid + goos: + - darwin + goarch: + - amd64 + - arm64 + env: + - CC=o64-clang + flags: + - -mod=readonly + ldflags: + - -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=nibiru -X github.com/cosmos/cosmos-sdk/version.AppName=nibid -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/tendermint/tendermint/version.TMCoreSemVer={{ .Env.TM_VERSION }} + - -linkmode=external + tags: + - netgo + - static_wasm + overrides: + - goos: darwin + goarch: arm64 + env: + - CC=oa64-clang + + - id: linux main: ./cmd/nibid binary: nibid + hooks: + pre: + - wget https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.x86_64.a -O /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a + - wget https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.aarch64.a -O /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a goos: - linux goarch: - amd64 + - arm64 env: - - CGO_ENABLED=1 - CC=x86_64-linux-gnu-gcc flags: - -mod=readonly @@ -22,4 +51,11 @@ builds: tags: - netgo - muslc + overrides: + - goos: linux + goarch: arm64 + env: + - CC=aarch64-linux-gnu-gcc +universal_binaries: + - id: darwin \ No newline at end of file diff --git a/Makefile b/Makefile index 45ace8dafe..efb2f72f41 100644 --- a/Makefile +++ b/Makefile @@ -8,5 +8,5 @@ include contrib/make/mock.mk include contrib/make/lint.mk include contrib/make/test.mk include contrib/make/simulation.mk - +include contrib/make/release.mk diff --git a/contrib/make/release.mk b/contrib/make/release.mk index 556728f348..2b2e5507f3 100644 --- a/contrib/make/release.mk +++ b/contrib/make/release.mk @@ -2,5 +2,19 @@ ### Release ### ############################################################################### +PACKAGE_NAME := github.com/NibiruChain/nibiru +GOLANG_CROSS_VERSION ?= v1.19 + release: - docker run --rm -v "$(CURDIR)":/code -w /code goreleaser/goreleaser-cross --skip-publish --rm-dist \ No newline at end of file + docker run \ + --rm \ + --platform=linux/amd64 \ + --privileged \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v "$(CURDIR)":/go/src/$(PACKAGE_NAME) \ + -w /go/src/$(PACKAGE_NAME) \ + -e CGO_ENABLED=1 \ + -e TM_VERSION=$(go list -m github.com/tendermint/tendermint | sed 's:.* ::') \ + -e GITHUB_TOKEN=${GITHUB_TOKEN} \ + goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ + release --snapshot --rm-dist diff --git a/go.mod b/go.mod index a39a268257..1fc83d9652 100644 --- a/go.mod +++ b/go.mod @@ -142,3 +142,5 @@ replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alp replace github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 + +replace github.com/CosmWasm/wasmvm v1.1.1 => github.com/voluzi/wasmvm v0.0.0-20230118023105-988553477840 diff --git a/go.sum b/go.sum index bcf800cc13..b6a641a92c 100644 --- a/go.sum +++ b/go.sum @@ -61,8 +61,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/CosmWasm/wasmd v0.29.1 h1:uagvdFfNYzkxUurKmVooHqkPqWo0dF+KvAzgUt4aOn0= github.com/CosmWasm/wasmd v0.29.1/go.mod h1:agYHzj3R0O+UExLHlXLuEfLqhIrCC+pF5ouAmbe9/68= -github.com/CosmWasm/wasmvm v1.1.1 h1:0xtdrmmsP9fibe+x42WcMkp5aQ738BICgcH3FNVLzm4= -github.com/CosmWasm/wasmvm v1.1.1/go.mod h1:ei0xpvomwSdONsxDuONzV7bL1jSET1M8brEx0FCXc+A= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= @@ -797,6 +795,8 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vmihailenco/msgpack/v5 v5.1.4/go.mod h1:C5gboKD0TJPqWDTVTtrQNfRbiBwHZGo8UTqP/9/XvLI= github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/voluzi/wasmvm v0.0.0-20230118023105-988553477840 h1:AUCTvCLVxIjggSPli8uu0cBmBzC5AyyZuQBg9m8PhH8= +github.com/voluzi/wasmvm v0.0.0-20230118023105-988553477840/go.mod h1:ei0xpvomwSdONsxDuONzV7bL1jSET1M8brEx0FCXc+A= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=