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

Update goreleaser to release statically linked binary #2560

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
14 changes: 10 additions & 4 deletions .github/workflows/release-umee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,32 @@ jobs:
- name: Set Env
run: echo "TM_VERSION=$(go list -m github.com/cometbft/cometbft | sed 's:.* ::')" >> $GITHUB_ENV

- name: Set Wasmvm Env
run: echo "COSMWASM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | sed 's/.* //')" >> $GITHUB_ENV



# useful to test builds. However will require to add "push" rule to the "on" section
- name: generate and update swagger docs
run: |
make proto-swagger-gen
make proto-update-swagger-docs

- name: goreleaser test-build
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v5
Comment on lines -38 to +43
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to downgrade the goreleaser version because of this bug. Logs of the failed run using the latest version with the same bug can be found on my fork here

if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Enable:ReleaseBuild')
with:
version: latest
args: build --rm-dist --skip-validate # skip validate skips initial sanity checks in order to be able to fully run
args: build --clean --skip-validate # skip validate skips initial sanity checks in order to be able to fully run
env:
TM_VERSION: ${{ env.TM_VERSION }}
- name: Release
uses: goreleaser/goreleaser-action@v6
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist --release-notes ./RELEASE_NOTES.md
args: release --clean --release-notes ./RELEASE_NOTES.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TM_VERSION: ${{ env.TM_VERSION }}
COSMWASM_VERSION: ${{ env.COSMWASM_VERSION}}
7 changes: 5 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:

before:
hooks:
- sudo 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
- go mod download

builds:
Expand All @@ -14,10 +15,12 @@ builds:
binary: umeed
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -tags=badgerdb ledger netgo
- -tags=badgerdb ledger netgo muslc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why adding muslc? We release glibc compatible binaires.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to this comment it's not possible to build a statically linked binary for glibc systems. Using muslc seems to be the only way to create statically linked deterministic binaries.

- -trimpath
ldflags:
- -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=umee -X github.com/cosmos/cosmos-sdk/version.AppName=umeed -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.TM_VERSION }}
- -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=umee -X github.com/cosmos/cosmos-sdk/version.AppName=umeed -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.TM_VERSION }} -linkmode=external -extldflags '-Wl,-z,muldefs -static -lm'
env:
- CC=x86_64-linux-gnu-gcc
goos:
- linux
goarch:
Expand Down
Loading