From 33a87318c68f1dbb05d280f59e12315686238875 Mon Sep 17 00:00:00 2001 From: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Date: Tue, 10 Oct 2023 18:04:05 -0500 Subject: [PATCH] fix(.goreleaser.yml): Load version for wasmvm dynamically (#1631) * fix(.goreleaser.yml): Load version for wasmvm dynamically * feat(scripts): load wasmvm version dynamically in goreleaser --- .goreleaser.yml | 17 +++-------------- CHANGELOG.md | 1 + contrib/scripts/release_pre_darwin.sh | 18 ++++++++++++++++++ contrib/scripts/release_pre_linux.sh | 21 +++++++++++++++++++++ 4 files changed, 43 insertions(+), 14 deletions(-) create mode 100755 contrib/scripts/release_pre_darwin.sh create mode 100755 contrib/scripts/release_pre_linux.sh diff --git a/.goreleaser.yml b/.goreleaser.yml index e29237d8d..8b158ed4f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,11 +9,7 @@ builds: binary: nibid hooks: pre: - - wget https://github.com/CosmWasm/wasmvm/releases/download/v1.4.0/libwasmvmstatic_darwin.a -O /osxcross/target/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a - - wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/include.8.1.1.tar.gz -O /root/include.8.1.1.tar.gz - - tar -xf /root/include.8.1.1.tar.gz -C /osxcross/target/SDK/MacOSX12.0.sdk/usr/include/ - - wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/librocksdb_8.1.1_darwin_all.tar.gz -O /root/librocksdb_8.1.1_darwin_all.tar.gz - - tar -xf /root/librocksdb_8.1.1_darwin_all.tar.gz -C /osxcross/target/SDK/MacOSX12.0.sdk/usr/lib/ + - bash contrib/scripts/release_pre_darwin.sh goos: - darwin goarch: @@ -52,14 +48,7 @@ builds: binary: nibid hooks: pre: - - wget https://github.com/CosmWasm/wasmvm/releases/download/v1.4.0/libwasmvm_muslc.x86_64.a -O /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a - - wget https://github.com/CosmWasm/wasmvm/releases/download/v1.4.0/libwasmvm_muslc.aarch64.a -O /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a - - wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/include.8.1.1.tar.gz -O /root/include.8.1.1.tar.gz - - tar -xvf /root/include.8.1.1.tar.gz -C /usr/include/ - - wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/librocksdb_8.1.1_linux_amd64.tar.gz -O /root/librocksdb_8.1.1_linux_amd64.tar.gz - - tar -xvf /root/librocksdb_8.1.1_linux_amd64.tar.gz -C /usr/lib/x86_64-linux-gnu/ - - wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/librocksdb_8.1.1_linux_arm64.tar.gz -O /root/librocksdb_8.1.1_linux_arm64.tar.gz - - tar -xvf /root/librocksdb_8.1.1_linux_arm64.tar.gz -C /usr/lib/aarch64-linux-gnu/ + - bash contrib/scripts/release_pre_linux.sh goos: - linux goarch: @@ -94,4 +83,4 @@ builds: - CC=aarch64-linux-gnu-gcc universal_binaries: - - id: darwin \ No newline at end of file + - id: darwin diff --git a/CHANGELOG.md b/CHANGELOG.md index 678c4e689..533b73f5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#1610](https://github.com/NibiruChain/nibiru/pull/1610) - refactor(app): Simplify app.go with less redundant imports using struct embedding. * [#1614](https://github.com/NibiruChain/nibiru/pull/1614) - refactor(proto): Use explicit namespacing on proto imports for #1608 * [#1630](https://github.com/NibiruChain/nibiru/pull/1630) - refactor(wasm): clean up wasmbinding/ folder structure +* [#1631](https://github.com/NibiruChain/nibiru/pull/1631) - fix(.goreleaser.yml): Load version for wasmvm dynamically. ### Dependencies - Bump `github.com/prometheus/client_golang` from 1.16.0 to 1.17.0 ([#1605](https://github.com/NibiruChain/nibiru/pull/1605)) diff --git a/contrib/scripts/release_pre_darwin.sh b/contrib/scripts/release_pre_darwin.sh new file mode 100755 index 000000000..f25254c97 --- /dev/null +++ b/contrib/scripts/release_pre_darwin.sh @@ -0,0 +1,18 @@ +#!/usr/env/bin bash +# +# This runs in the "hooks.pre" block of .goreleaser.yml. +# We do this because it enables us to dynamically set the $WASMVM_VERSION based +# on go.mod. +# +# It's intended to be used with: +# ```bash +# make release-snapshot +# ``` +set -e + +WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{sub(/^v/, "", $2); print $2}') +wget https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvmstatic_darwin.a -O /osxcross/target/SDK/MacOSX12.0.sdk/usr/lib/libwasmvmstatic_darwin.a +wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/include.8.1.1.tar.gz -O /root/include.8.1.1.tar.gz +tar -xf /root/include.8.1.1.tar.gz -C /osxcross/target/SDK/MacOSX12.0.sdk/usr/include/ +wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/librocksdb_8.1.1_darwin_all.tar.gz -O /root/librocksdb_8.1.1_darwin_all.tar.gz +tar -xf /root/librocksdb_8.1.1_darwin_all.tar.gz -C /osxcross/target/SDK/MacOSX12.0.sdk/usr/lib/ diff --git a/contrib/scripts/release_pre_linux.sh b/contrib/scripts/release_pre_linux.sh new file mode 100755 index 000000000..d3c145881 --- /dev/null +++ b/contrib/scripts/release_pre_linux.sh @@ -0,0 +1,21 @@ +#!/usr/env/bin bash +# +# This runs in the "hooks.pre" block of .goreleaser.yml. +# We do this because it enables us to dynamically set the $WASMVM_VERSION based +# on go.mod. +# +# It's intended to be used with: +# ```bash +# make release-snapshot +# ``` +set -e + +WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | awk '{sub(/^v/, "", $2); print $2}') +wget https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a -O /usr/lib/x86_64-linux-gnu/libwasmvm_muslc.a +wget https://github.com/CosmWasm/wasmvm/releases/download/v${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a -O /usr/lib/aarch64-linux-gnu/libwasmvm_muslc.a +wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/include.8.1.1.tar.gz -O /root/include.8.1.1.tar.gz +tar -xvf /root/include.8.1.1.tar.gz -C /usr/include/ +wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/librocksdb_8.1.1_linux_amd64.tar.gz -O /root/librocksdb_8.1.1_linux_amd64.tar.gz +tar -xvf /root/librocksdb_8.1.1_linux_amd64.tar.gz -C /usr/lib/x86_64-linux-gnu/ +wget https://github.com/NibiruChain/gorocksdb/releases/download/v8.1.1/librocksdb_8.1.1_linux_arm64.tar.gz -O /root/librocksdb_8.1.1_linux_arm64.tar.gz +tar -xvf /root/librocksdb_8.1.1_linux_arm64.tar.gz -C /usr/lib/aarch64-linux-gnu/