Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:babylonchain/babylon into rafilx/e2e…
Browse files Browse the repository at this point in the history
…-upgrade-software
  • Loading branch information
RafilxTenfen committed Jul 25, 2024
2 parents 3df14ce + 679b49a commit c5d6f45
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ ifneq (,$(UPCOMING_TAG))
upcoming_tag := --upcoming-tag $(UPCOMING_TAG)
endif

all: tools build lint test
help: ## Print this help message
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

all: tools build lint test ## Run build, lint, and test

# The below include contains the tools and runsim targets.
# TODO: Fix following make file so it will work on linux
Expand All @@ -140,8 +143,8 @@ BUILD_TARGETS := build install

PACKAGES_E2E=$(shell go list ./... | grep '/e2e')

build: BUILD_ARGS=-o $(BUILDDIR)/
build-linux:
build: BUILD_ARGS=-o $(BUILDDIR)/ ## Build babylond binary
build-linux: ## Build babylond linux version binary
GOOS=linux GOARCH=$(if $(findstring aarch64,$(shell uname -m)) || $(findstring arm64,$(shell uname -m)),arm64,amd64) LEDGER_ENABLED=false $(MAKE) build

$(BUILD_TARGETS): go.sum $(BUILDDIR)/
Expand All @@ -154,7 +157,7 @@ $(BUILDDIR)/:

mockgen_cmd=go run github.com/golang/mock/[email protected]

mocks: $(MOCKS_DIR)
mocks: $(MOCKS_DIR) ## Generate mock objects for testing
$(mockgen_cmd) -source=x/checkpointing/types/expected_keepers.go -package mocks -destination testutil/mocks/checkpointing_expected_keepers.go
$(mockgen_cmd) -source=x/checkpointing/keeper/bls_signer.go -package mocks -destination testutil/mocks/bls_signer.go
$(mockgen_cmd) -source=x/zoneconcierge/types/expected_keepers.go -package types -destination x/zoneconcierge/types/mocked_keepers.go
Expand All @@ -166,8 +169,8 @@ mocks: $(MOCKS_DIR)
$(MOCKS_DIR):
mkdir -p $(MOCKS_DIR)

distclean: clean tools-clean
clean:
distclean: clean tools-clean ## Remove all files generated by builds and remove all installed tools
clean: ## Remove all files generated by builds
rm -rf \
$(BUILDDIR)/ \
artifacts/ \
Expand All @@ -191,7 +194,7 @@ go.sum: go.mod
# This builds a docs site for each branch/tag in `./docs/versions`
# and copies each site to a version prefixed path. The last entry inside
# the `versions` file will be the default root index.html.
build-docs: diagrams
build-docs: diagrams ## Builds a docs site
@cd client/docs && \
while read -r branch path_prefix; do \
(git checkout $${branch} && npm install && VUEPRESS_BASE="/$${path_prefix}/" npm run build) ; \
Expand All @@ -216,8 +219,8 @@ e2e-build-script:
### Tests & Simulation ###
###############################################################################

test: test-unit
test-all: test-unit test-ledger-mock test-race test-cover
test: test-unit ## Run unit tests
test-all: test-unit test-ledger-mock test-race test-cover ## Run all tests

TEST_PACKAGES=./...
TEST_TARGETS := test-unit test-unit-amino test-unit-proto test-ledger-mock test-race test-ledger test-race test-cover
Expand Down Expand Up @@ -333,10 +336,10 @@ containerMarkdownLintFix=babylon-markdownlint-fix

golangci_lint_cmd=go run github.com/golangci/golangci-lint/cmd/golangci-lint

lint: lint-go
lint: lint-go ## Run go linter
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerMarkdownLint}$$"; then docker start -a $(containerMarkdownLint); else docker run --name $(containerMarkdownLint) -i -v "$(CURDIR):/work" $(markdownLintImage); fi

lint-fix:
lint-fix: ## Run go linter and fix reported issues
$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerMarkdownLintFix}$$"; then docker start -a $(containerMarkdownLintFix); else docker run --name $(containerMarkdownLintFix) -i -v "$(CURDIR):/work" $(markdownLintImage) . --fix; fi

Expand All @@ -346,7 +349,7 @@ lint-go:

.PHONY: lint lint-fix

format:
format: ## Run code formater
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name '*.pb.go' | xargs goimports -w -local github.com/babylonchain/babylon
Expand All @@ -356,10 +359,10 @@ format:
### Gosec ###
###############################################################################

gosec:
gosec: ## Run security checks
$(DOCKER) run --rm -it -w /$(PROJECT_NAME)/ -v $(CURDIR):/$(PROJECT_NAME) securego/gosec -exclude-generated -exclude-dir=/$(PROJECT_NAME)/testutil -exclude-dir=/$(PROJECT_NAME)/test -conf /$(PROJECT_NAME)/gosec.json /$(PROJECT_NAME)/...

gosec-local:
gosec-local: ## Run local security checkss
gosec -exclude-generated -exclude-dir=$(CURDIR)/testutil -exclude-dir=$(CURDIR)/test -conf $(CURDIR)/gosec.json $(CURDIR)/...

.PHONY: gosec gosec-local
Expand All @@ -370,22 +373,22 @@ gosec-local:

DEVDOC_SAVE = docker commit `docker ps -a -n 1 -q` devdoc:local

devdoc-init:
devdoc-init: ## Initialize documentation
$(DOCKER) run -it -v "$(CURDIR):/go/src/github.com/babylonchain/babylon" -w "/go/src/github.com/babylonchain/babylon" tendermint/devdoc echo
# TODO make this safer
$(call DEVDOC_SAVE)

devdoc:
devdoc: ## Generate documentation
$(DOCKER) run -it -v "$(CURDIR):/go/src/github.com/babylonchain/babylon" -w "/go/src/github.com/babylonchain/babylon" devdoc:local bash

devdoc-save:
devdoc-save: ## Save documentation changes
# TODO make this safer
$(call DEVDOC_SAVE)

devdoc-clean:
devdoc-clean: ## Clean up documentation artifacts
docker rmi -f $$(docker images -f "dangling=true" -q)

devdoc-update:
devdoc-update: ## Update documentation tools
docker pull tendermint/devdoc

.PHONY: devdoc devdoc-clean devdoc-init devdoc-save devdoc-update
Expand All @@ -398,20 +401,20 @@ protoVer=0.14.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

proto-all: proto-gen proto-swagger-gen
proto-all: proto-gen proto-swagger-gen ## Generate all protobuf related files

proto-gen:
proto-gen: ## Generate protobuf files
@echo "Generating Protobuf files"
@$(protoImage) sh ./proto/scripts/protocgen.sh

proto-swagger-gen:
proto-swagger-gen: ## Generate Swagger files from protobuf
@echo "Generating Protobuf Swagger"
@$(protoImage) sh ./proto/scripts/protoc-swagger-gen.sh

proto-format:
proto-format: ## Format protobuf files
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;

proto-lint:
proto-lint: ## Lint protobuf files
@$(protoImage) buf lint --error-format=json

.PHONY: proto-gen proto-swagger-gen proto-format prot-lint
Expand All @@ -421,14 +424,14 @@ proto-lint:
###############################################################################
dockerNetworkList=$($(DOCKER) network ls --filter name=bbn-testnet --format {{.ID}})

build-docker:
build-docker: ## Build babylond Docker image
$(MAKE) -C contrib/images babylond

build-docker-e2e: build-docker
$(MAKE) -C contrib/images babylond-before-upgrade
$(MAKE) -C contrib/images e2e-init-chain

build-cosmos-relayer-docker:
build-cosmos-relayer-docker: ## Build Docker image for the Cosmos relayer
$(MAKE) -C contrib/images cosmos-relayer

clean-docker-network:
Expand All @@ -440,8 +443,7 @@ clean-docker-network:
### Localnet ###
###############################################################################

# init-testnet-dirs will create a ./.testnets directory containing configuration for 4 Babylon nodes
init-testnet-dirs:
init-testnet-dirs: ## Initialize directories for testnet, creates a ./.testnets directory containing configuration for 4 Babylon nodes
# need to create the dir before hand so that the docker container has write access to the `.testnets` dir
# regardless of the user it uses
mkdir -p $(CURDIR)/.testnets && chmod o+w $(CURDIR)/.testnets
Expand All @@ -451,19 +453,17 @@ init-testnet-dirs:
--chain-id chain-test --btc-confirmation-depth 2 --additional-sender-account true \
--epoch-interval 5

# localnet-start-nodes will boot the nodes described in the docker-compose.yml file
localnet-start-nodes: init-testnet-dirs
localnet-start-nodes: init-testnet-dirs ## Boot the nodes described in the docker-compose.yml file
docker-compose up -d

# localnet-start will run a with 4 nodes with 4 nodes, a bitcoin instance, and a vigilante instance
localnet-start: localnet-stop build-docker localnet-start-nodes
localnet-start: localnet-stop build-docker localnet-start-nodes ## Run with 4 nodes, a bitcoin instance, and a vigilante instance

# localnet-stop will clean up and stop all localnets running
localnet-stop:
rm -rf $(CURDIR)/.testnets
docker-compose down

build-test-wasm:
build-test-wasm: ## Build WASM bindings for testing
docker run --rm -v "$(WASM_DIR)":/code \
--mount type=volume,source="$(WASM_DIR_BASE_NAME)_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
Expand All @@ -480,10 +480,10 @@ localnet-start \
localnet-stop

.PHONY: diagrams
diagrams:
diagrams: ## Generate diagrams for documentation
$(MAKE) -C client/docs/diagrams

.PHONY: update-changelog
update-changelog:
update-changelog: ## Update the project changelog
@echo ./scripts/update_changelog.sh $(since_tag) $(upcoming_tag)
./scripts/update_changelog.sh $(since_tag) $(upcoming_tag)

0 comments on commit c5d6f45

Please sign in to comment.