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: make build-ledger, fix reproducible builds, reinforce go version #24

Merged
merged 13 commits into from
Sep 25, 2024
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ jobs:
fetch-depth: 0
- run: git fetch --force --tags

- name: Set go version
run: echo "GO_VERSION=$(make print_required_go_version)" >> $GITHUB_ENV

- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "${{ env.GO_VERSION }}"

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

- name: Release
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean --release-notes ./RELEASE_NOTES.md
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ snapshot:
name_template: "{{ .Version }}-{{ .ShortCommit }}"

changelog:
skip: false
disable: true

git:
# What should be used to sort tags when gathering the current and previous
Expand Down
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ DOCKER := $(shell which docker)
BUILDDIR ?= $(CURDIR)/build
TEST_DOCKER_REPO=cosmos/contrib-atomonetest

GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1-2)
REQUIRE_GO_VERSION = 1.21
GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1)
REQUIRE_GO_VERSION = 1.21.13

export GO111MODULE = on
export CGO_ENABLED = 0
Expand Down Expand Up @@ -97,9 +97,17 @@ include contrib/devtools/Makefile
### Build ###
###############################################################################

print_required_go_version:
@echo $(REQUIRE_GO_VERSION)

check_version:
ifneq ($(GO_SYSTEM_VERSION), $(REQUIRE_GO_VERSION))
@echo "ERROR: Go version $(REQUIRE_GO_VERSION) is required for $(VERSION) of AtomOne."
@echo 'ERROR: Go version $(REQUIRE_GO_VERSION) is required for building AtomOne'
@echo '--> You can install it using:'
@echo 'go install golang.org/dl/go$(REQUIRE_GO_VERSION)@latest && go$(REQUIRE_GO_VERSION) download'
@echo '--> Then prefix your make command with:'
@echo 'GOROOT=$$(go$(REQUIRE_GO_VERSION) env GOROOT) PATH=$$GOROOT/bin:$$PATH'
exit 1
endif

all: install lint run-tests test-e2e vulncheck
Expand All @@ -111,6 +119,10 @@ build: BUILD_ARGS=-o $(BUILDDIR)/
$(BUILD_TARGETS): check_version go.sum $(BUILDDIR)/
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...

build-ledger: go.sum $(BUILDDIR)/
@echo "WARNING: Ledger build involves enabling cgo, which disables the ability to have reproducible builds."
CGO_ENABLED=1 go build -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) -o $(BUILDDIR)/ ./...

$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/

Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ The following modifications have been made to the Cosmos Hub software to create
5. Changed Bech32 prefixes to `atone` (see `cmd/atomoned/cmd/config.go`)
6. Removed ability for validators to vote on proposals with delegations, they can only use their own stake

## Reproducible builds (TODO)
## Reproducible builds

An effort has been made to make it possible to build the exact same binary
locally as the Github Release section. To do this, checkout to the expected
version and then simply run `make build` (which will output the binary to the
`build` directory) or `make install`. The resulted binary should have the same
sha256 hash than the one from the Github Release section.
locally as the Github Release section. To do this:
- Checkout to the expected released version
- Run `make build` (which will output the binary to the `build` directory) or
`make install`. Note that a fixed version of the `go` binary is required,
follow the command instructions to install this specific version if needed.
- The resulted binary should have the same sha256 hash than the one from the
Github Release section.

## Ledger support

Run `make build-ledger` to have ledger support in `./build/atomoned` binary.
Note that this will disable reproducible builds, as it introduces OS
dependencies.
Loading