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

chore: improve Makefile and release docs #37

Merged
merged 16 commits into from
Oct 25, 2024

Conversation

tbruyelle
Copy link
Collaborator

Closes #32

Improvement list:

  • remove build-linux that breaks reproducible builds
  • remove draw-deps which no longer works
  • use go run instead of go install && ./binary
    • fix dev tools dependencies in a new go module contrib/devdeps
    • use go run -modfile contrib/devdeps/go.mod <module> to run a declared dev tool
  • remove deprecated build-docs target
  • remove deprecated distclean target
  • remove useless format-batch target
  • update .PHONY properly
  • centralize TM_VERSION setting in Makefile
    • gh action invokes make print_tm_version to get TM_VERSION
  • define required go version in a unique location: the go.mod file
    • go.mod declares go 1.21.13` precisely
    • read required go version from go.mod
    • use go-version-file: go.mod instead of go-version: 1.21 in gh action
  • fix RELEASE_PROCESS.md
    • remove mention of gh discussion and project board
    • remove mention of RELEASE_NOTE.md
  • improve ledger build
    • default LEDGER_ENABLED=false which removes ledger build tag
    • binary can get ledger support with make build/installl LEDGER_ENABLED=true
    • keep build-ledger for user usage but calls make build LEDGER_ENABLED=true under the hood
  • make create-release-dry-run improvements
    • keep dist dir for other usage
    • print shasum file to compare with future release

- remove not working draw-deps target
- remove unused contrib/devtools/Makefile
- use `go run` instead of `go install && ./binary`
- remove build-linux which doesn't provide reproducible builds
- remove deprecated build-docs target
- remove deprecated distclean target
- remove useless format-batch target
- update .PHONY properly
Prevent having `ledger` build tag without CGO, which has no effect on
ledger support. Now it's possible to build a binary with ledger support
by providing `LEDGER_ENABLED=true` appended to the makefile command.

`make build-ledger` is kept for convenience but call `make build
LEDGER_ENABLED=true` under the hood.
the default value should be good enough.
downgraded gofumpt and gorealeaser for this reason
- Ensure goreleaser uses the newly created tag
- Ensure goreleaser uses the expected go version
- Keep dist folder and print sha256sum files
This works by replacing `go-version: XX` by `go-version-file: go.mod`

Remove `make print_required_go_version` because it's no longer required
GO_SYSTEM_VERSION from go env GOVERSION bc that requires less transformation
Copy link

@kristovatlas kristovatlas left a comment

Choose a reason for hiding this comment

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

Skimmed the code quickly, looks good.

Testing results:

I was able to make build on darwin64.

% make build
--> Ensure dependencies have not been modified
all modules verified
go build -mod=readonly -tags "netgo" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=atomone -X github.com/cosmos/cosmos-sdk/version.AppName=atomoned -X github.com/cosmos/cosmos-sdk/version.Version=v1.0.0-a8dea4ca -X github.com/cosmos/cosmos-sdk/version.Commit=a8dea4ca910c77d60eec78599abce6bfc7ff17de -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo -X github.com/cometbft/cometbft/version.TMCoreSemVer=v0.37.5 -w -s' -trimpath -o /Users/redacted/Documents/GitHub/atomone/build/ ./...
% ./build/atomoned
Stargate Cosmos Hub App

Usage:
  atomoned [command]
...
% openssl dgst -sha256 build/atomoned
SHA2-256(build/atomoned)= 0b1f75c703140541eb7775b35d59fbee3f54f54f3e05792ce4b2beaabdfaf646

I did not test goreleaser as there wasn't a tag to test it against.

@tbruyelle tbruyelle merged commit 2b60d1c into atomone-hub:main Oct 25, 2024
14 checks passed
@tbruyelle tbruyelle deleted the tbruyelle/chore/makefile-cleanup branch October 25, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Makefile and release docs
3 participants