Skip to content

Commit

Permalink
chore: use ignite v28.7.x (#11)
Browse files Browse the repository at this point in the history
* chore: use ignite v28.7.x

* ignite chain serve

* fix
  • Loading branch information
julienrbrt authored Feb 18, 2025
1 parent 6a01070 commit 22c4828
Show file tree
Hide file tree
Showing 9 changed files with 826 additions and 117 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow is useful if you want to automate the process of:
#
# a) Creating a new prelease when you push a new tag with a "v" prefix (version).
#
# This type of prerelease is meant to be used for production: alpha, beta, rc, etc. types of releases.
# After the prerelease is created, you need to make your changes on the release page at the relevant
# Github page and publish your release.
#
# b) Creating/updating the "latest" prerelease when you push to your default branch.
#
# This type of prelease is useful to make your bleeding-edge binaries available to advanced users.
#
# The workflow will not run if there is no tag pushed with a "v" prefix and no change pushed to your
# default branch.
on: push

jobs:
might_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Prepare Release Variables
id: vars
uses: ignite/cli/actions/release/vars@main

- name: Issue Release Assets
uses: ignite/cli/actions/cli@main
if: ${{ steps.vars.outputs.should_release == 'true' }}
with:
args: chain build --release --release.prefix ${{ steps.vars.outputs.tarball_prefix }} -t linux:amd64 -t darwin:amd64 -t darwin:arm64 -y
env:
DO_NOT_TRACK: 1

- name: Delete the "latest" Release
uses: dev-drprasad/[email protected]
if: ${{ steps.vars.outputs.is_release_type_latest == 'true' }}
with:
tag_name: ${{ steps.vars.outputs.tag_name }}
delete_release: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish the Release
uses: softprops/action-gh-release@v1
if: ${{ steps.vars.outputs.should_release == 'true' }}
with:
tag_name: ${{ steps.vars.outputs.tag_name }}
files: release/*
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109 changes: 109 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
APPNAME := example

# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell git describe --exact-match 2>/dev/null)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif

# Update the ldflags with the app, client & server names
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=$(APPNAME) \
-X github.com/cosmos/cosmos-sdk/version.AppName=$(APPNAME)d \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)

BUILD_FLAGS := -ldflags '$(ldflags)'

##############
### Test ###
##############

test-unit:
@echo Running unit tests...
@go test -mod=readonly -v -timeout 30m ./...

test-race:
@echo Running unit tests with race condition reporting...
@go test -mod=readonly -v -race -timeout 30m ./...

test-cover:
@echo Running unit tests and creating coverage report...
@go test -mod=readonly -v -timeout 30m -coverprofile=$(COVER_FILE) -covermode=atomic ./...
@go tool cover -html=$(COVER_FILE) -o $(COVER_HTML_FILE)
@rm $(COVER_FILE)

bench:
@echo Running unit tests with benchmarking...
@go test -mod=readonly -v -timeout 30m -bench=. ./...

test: govet govulncheck test-unit

.PHONY: test test-unit test-race test-cover bench

#################
### Install ###
#################

all: install

install:
@echo "--> ensure dependencies have not been modified"
@go mod verify
@echo "--> installing $(APPNAME)d"
@go install $(BUILD_FLAGS) -mod=readonly ./cmd/$(APPNAME)d

.PHONY: all install

##################
### Protobuf ###
##################

# Use this proto-image if you do not want to use Ignite for generating proto files
protoVer=0.15.1
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

proto-gen:
@echo "Generating protobuf files..."
@ignite generate proto-go --yes

.PHONY: proto-gen

#################
### Linting ###
#################

golangci_lint_cmd=golangci-lint
golangci_version=v1.61.0

lint:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run ./... --timeout 15m

lint-fix:
@echo "--> Running linter and fixing issues"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run ./... --fix --timeout 15m

.PHONY: lint lint-fix

###################
### Development ###
###################

govet:
@echo Running go vet...
@go vet ./...

govulncheck:
@echo Running govulncheck...
@go install golang.org/x/vuln/cmd/govulncheck@latest
@govulncheck ./...

.PHONY: govet govulncheck
2 changes: 2 additions & 0 deletions cmd/exampled/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/types/module"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/spf13/cobra"
Expand All @@ -34,6 +35,7 @@ func initRootCmd(
rootCmd.AddCommand(
genutilcli.InitCmd(basicManager, app.DefaultNodeHome),
NewInPlaceTestnetCmd(addModuleInitFlags),
NewTestnetMultiNodeCmd(basicManager, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
confixcmd.ConfigCommand(),
pruning.Cmd(newApp, app.DefaultNodeHome),
Expand Down
Loading

0 comments on commit 22c4828

Please sign in to comment.