Skip to content

Commit

Permalink
feat: add cosmo wasm vm to release
Browse files Browse the repository at this point in the history
  • Loading branch information
JeancarloBarrios authored and hacheigriega committed Oct 20, 2023
1 parent eae4e2b commit 5cfad44
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 40 deletions.
26 changes: 8 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,21 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.release_tag }}

- uses: actions/setup-go@v4
with:
go-version: "1.21"
cache: true

- name: Set ENV
run: echo "COMET_VERSION=$(go list -m github.com/cometbft/cometbft | sed 's:.* ::')" >> $GITHUB_ENV

- name: goreleaser test-build
uses: goreleaser/goreleaser-action@v5
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Enable:ReleaseBuild')
with:
version: latest
args: build --clean --skip=validate
env:
COMET_VERSION: ${{ env.COMET_VERSION }}
- name: Release
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --clean
- name: Make release and publish
run: |
make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMET_VERSION: ${{ env.COMET_VERSION }}
- name: Cleanup
run: |
sudo rm -rf dist
build_push_node_image:
name: Build and Push Docker Image to GHCR
Expand Down
171 changes: 149 additions & 22 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,171 @@
project_name: seda
project_name: seda-chain

env:
- CGO_ENABLED=1
# - GOOS=linux # for local m1 mac run

before:
hooks:
- go mod download

builds:
- main: ./cmd/seda-chaind
id: "seda-chaind"
- id: seda-chaind-linux-amd64
main: ./cmd/seda-chaind/main.go
binary: seda-chaind
mod_timestamp: "{{ .CommitTimestamp }}"
hooks:
pre:
- wget https://github.com/CosmWasm/wasmvm/releases/download/{{ .Env.COSMWASM_VERSION }}/libwasmvm_muslc.x86_64.a -O /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a
goos:
- linux
goarch:
- amd64
env:
- CC=x86_64-linux-gnu-gcc
flags:
- -tags=badgerdb ledger netgo
- -mod=readonly
- -trimpath
ldflags:
- -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=seda-chain -X github.com/cosmos/cosmos-sdk/version.AppName=sedad-chain -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger -X github.com/cometbft/cometbft/version.TMCoreSemVer={{ .Env.COMET_VERSION }}
- -X github.com/cosmos/cosmos-sdk/version.Name=seda-chain
- -X github.com/cosmos/cosmos-sdk/version.AppName=seda-chaind
- -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }}
- -X main.date={{ .CommitDate }}
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc,osusergo
- -w -s
- -linkmode=external
- -extldflags '-Wl,-z,muldefs -static -lm'
tags:
- netgo
- ledger
- muslc
- osusergo
#
- id: seda-chaind-linux-arm64
main: ./cmd/seda-chaind/main.go
binary: seda-chaind
hooks:
pre:
- wget https://github.com/CosmWasm/wasmvm/releases/download/{{ .Env.COSMWASM_VERSION }}/libwasmvm_muslc.aarch64.a -O /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a
goos:
- linux
goarch:
- arm64
env:
- CC=aarch64-linux-gnu-gcc
flags:
- -mod=readonly
- -trimpath
ldflags:
- -X github.com/cosmos/cosmos-sdk/version.Name=seda-chain
- -X github.com/cosmos/cosmos-sdk/version.AppName=seda-chaind
- -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }}
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc,osusergo
- -w -s
- -linkmode=external
- -extldflags '-Wl,-z,muldefs -static -lm'
tags:
- netgo
- ledger
- muslc
- osusergo

- id: seda-chaind-darwin-amd64
main: ./cmd/seda-chaind/main.go
binary: seda-chaind
hooks:
pre:
- wget https://github.com/CosmWasm/wasmvm/releases/download/{{ .Env.COSMWASM_VERSION }}/libwasmvmstatic_darwin.a -O /lib/libwasmvmstatic_darwin.a
env:
- CC=o64-clang
- CGO_LDFLAGS=-L/lib
goos:
- darwin
goarch:
- amd64
# - arm64 # github only supports linux @ amd64 :'(
flags:
- -mod=readonly
- -trimpath
ldflags:
- -X github.com/cosmos/cosmos-sdk/version.Name=seda-chain
- -X github.com/cosmos/cosmos-sdk/version.AppName=seda-chaind
- -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }}
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,static_wasm
- -w -s
- -linkmode=external
tags:
- netgo
- ledger
- static_wasm

- id: seda-chaind-chaind-darwin-arm64
main: ./cmd/seda-chaind/main.go
binary: seda-chaind
hooks:
pre:
- wget https://github.com/CosmWasm/wasmvm/releases/download/{{ .Env.COSMWASM_VERSION }}/libwasmvmstatic_darwin.a -O /lib/libwasmvmstatic_darwin.a
env:
- CC=oa64-clang
- CGO_LDFLAGS=-L/lib
goos:
- darwin
goarch:
- arm64
flags:
- -mod=readonly
- -trimpath
ldflags:
- -X github.com/cosmos/cosmos-sdk/version.Name=seda-chain
- -X github.com/cosmos/cosmos-sdk/version.AppName=seda-chaind
- -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }}
- -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,static_wasm
- -w -s
- -linkmode=external
tags:
- netgo
- ledger
- static_wasm


universal_binaries:
- id: seda-chaind-darwin-universal
ids:
- seda-chaind-darwin-amd64
- seda-chaind-darwin-arm64
replace: false

archives:
- id: tarball
- id: zipped
builds:
- seda-chaind-linux-amd64
- seda-chaind-linux-arm64
# - seda-chaind-darwin-universal
# - seda-chaind-darwin-amd64
# - seda-chaind-darwin-arm64
name_template: "{{.ProjectName}}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
format: tar.gz
wrap_in_directory: false # must not wrap into directory to support cosmwasm
name_template: "{{ .Binary }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
files:
- LICENSE
- README.md

snapshot:
name_template: SNAPSHOT-{{ .Commit }}
- none*
- id: binaries
builds:
- seda-chaind-linux-amd64
- seda-chaind-linux-arm64
# - seda-chaind-darwin-universal
# - seda-chaind-darwin-amd64
# - seda-chaind-darwin-arm64
name_template: "{{.ProjectName}}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
format: binary
files:
- none*

checksum:
name_template: SHA256SUMS-v{{.Version}}.txt
name_template: "sha256sum.txt"
algorithm: sha256

# Docs: https://goreleaser.com/customization/changelog/
changelog:
skip: false
skip: true

# Docs: https://goreleaser.com/customization/release/
release:
github:
owner: seda-chain
name: seda-chain
replace_existing_draft: true
52 changes: 52 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,55 @@ cover-html: test-unit-cover
.PHONY: cover-html run-tests $(TEST_TARGETS)


###############################################################################
### Release ###
###############################################################################

GO_VERSION=1.21
GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:v$(GO_VERSION)
COSMWASM_VERSION := $(shell go list -m github.com/CosmWasm/wasmvm | sed 's/.* //')
ifdef GITHUB_TOKEN
release:
docker run \
--rm \
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
-e COSMWASM_VERSION=$(COSMWASM_VERSION) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/seda-chaind \
-w /go/src/seda-chaind \
$(GORELEASER_IMAGE) \
release \
--clean
else
release:
@echo "Error: GITHUB_TOKEN variable required to 'make release'."

endif

release-dry-run:
docker run \
--rm \
-e COSMWASM_VERSION=$(COSMWASM_VERSION) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/seda-chaind \
-w /go/src/seda-chaind \
$(GORELEASER_IMAGE) \
release \
--clean \
--skip=publish

release-snapshot:
docker run \
--rm \
-e COSMWASM_VERSION=$(COSMWASM_VERSION) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/seda-chaind \
-w /go/src/seda-chaind \
$(GORELEASER_IMAGE) \
release \
--clean \
--snapshot \
--skip-validate\
--skip-publish

.PHONY: release release-dry-run release-snapshot

0 comments on commit 5cfad44

Please sign in to comment.