Skip to content

Commit

Permalink
refactor(make): improve / update make help (osmosis-labs#7352)
Browse files Browse the repository at this point in the history
* refactor: improve make help

* sort commands
  • Loading branch information
Halimao authored Jan 22, 2024
1 parent fc9e591 commit f036365
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 87 deletions.
60 changes: 11 additions & 49 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include scripts/makefiles/lint.mk
include scripts/makefiles/localnet.mk
include scripts/makefiles/proto.mk
include scripts/makefiles/release.mk
include scripts/makefiles/sqs.mk
include scripts/makefiles/tests.mk

.DEFAULT_GOAL := help
Expand All @@ -18,18 +19,21 @@ help:
@echo "Usage:"
@echo " make [command]"
@echo ""
@echo " make build Build osmosisd binary"
@echo " make install Install osmosisd binary"
@echo " make build Build osmosisd binary"
@echo " make build-help Show available build commands"
@echo " make deps Show available deps commands"
@echo " make proto Show available proto commands"
@echo " make release Show available release commands"
@echo " make e2e Show available e2e commands"
@echo " make docker Show available docker commands"
@echo " make e2e Show available e2e commands"
@echo " make go-mock-update Generate mock files"
@echo " make install Install osmosisd binary"
@echo " make lint Show available lint commands"
@echo " make test Show available test commands"
@echo " make test Show available test commands"
@echo " make localnet Show available localnet commands"
@echo " make proto Show available proto commands"
@echo " make release Show available release commands"
@echo " make release-help Show available release commands"
@echo " make run-querygen Generating GRPC queries, and queryproto logic"
@echo " make sqs Show available sqs commands"
@echo " make test Show available test commands"
@echo ""
@echo "Run 'make [subcommand]' to see the available commands for each subcommand."

Expand Down Expand Up @@ -166,48 +170,6 @@ go-mock-update:
mockgen -source=x/concentrated-liquidity/types/cl_pool_extensionI.go -destination=tests/mocks/cl_pool.go -package=mocks
mockgen -source=ingest/sqs/domain/pools.go -destination=tests/mocks/sqs_pool.go -package=mocks -mock_names=PoolI=MockSQSPoolI

###############################################################################
### SQS ###
###############################################################################

redis-start:
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 -v ./redis-cache/:/data redis/redis-stack:7.2.0-v3

redis-stop:
docker container rm -f redis-stack

sqs-start:
./scripts/debug_builder.sh
build/osmosisd start

sqs-load-test-ui:
docker compose -f ingest/sqs/locust/docker-compose.yml up --scale worker=4

sqs-profile:
go tool pprof -http=:8080 http://localhost:9092/debug/pprof/profile?seconds=15

# Validates that SQS concentrated liquidity pool state is
# consistent with the state of the chain.
sqs-validate-cl-state:
ingest/sqs/scripts/validate-cl-state.sh "http://localhost:9092"

# Compares the quotes between SQS and chain over pool 1136
# which is concentrated.
sqs-quote-compare:
ingest/sqs/scripts/quote.sh "http://localhost:9092"

sqs-quote-compare-stage:
ingest/sqs/scripts/quote.sh "http://165.227.168.61"

# Updates go tests with the latest mainnet state
# Make sure that the node is running locally
sqs-update-mainnet-state:
curl -X POST "http:/localhost:9092/router/store-state"
mv pools.json ingest/sqs/router/usecase/routertesting/parsing/pools.json
mv taker_fees.json ingest/sqs/router/usecase/routertesting/parsing/taker_fees.json



###############################################################################
### Release ###
###############################################################################
Expand Down
6 changes: 3 additions & 3 deletions scripts/makefiles/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ build-help:
@echo "Available Commands:"
@echo " all Build all targets"
@echo " check-version Check Go version"
@echo " dev-install Install development build"
@echo " contract-tests-hooks Build contract tests hooks"
@echo " dev-build Build development version"
@echo " dev-install Install development build"
@echo " install-with-autocomplete Install with autocomplete support"
@echo " linux Build for Linux"
@echo " reproducible Build reproducible binaries"
@echo " reproducible-amd64 Build reproducible amd64 binary"
@echo " reproducible-arm64 Build reproducible arm64 binary"
@echo " linux Build for Linux"
@echo " contract-tests-hooks Build contract tests hooks"

build-check-version:
@echo "Go version: $(GO_MAJOR_VERSION).$(GO_MINOR_VERSION)"
Expand Down
8 changes: 4 additions & 4 deletions scripts/makefiles/deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ deps-help:
@echo " make deps-[command]"
@echo ""
@echo "Available Commands:"
@echo " go-mod-cache Download go modules to local cache"
@echo " go.sum Ensure dependencies have not been modified"
@echo " draw Create a dependency graph"
@echo " clean Remove artifacts"
@echo " distclean Remove vendor directory"
@echo " update-sdk-version Update SDK version"
@echo " draw Create a dependency graph"
@echo " go-mod-cache Download go modules to local cache"
@echo " go.sum Ensure dependencies have not been modified"
@echo " tidy-workspace Tidy workspace"
@echo " update-sdk-version Update SDK version"
deps: deps-help

deps-go-mod-cache: go.sum
Expand Down
2 changes: 1 addition & 1 deletion scripts/makefiles/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ docker-help:
@echo ""
@echo "Available Commands:"
@echo " build Build Docker image"
@echo " build-distroless Build distroless Docker image"
@echo " build-alpine Build alpine Docker image"
@echo " build-distroless Build distroless Docker image"
@echo " build-nonroot Build nonroot Docker image"
docker: docker-help

Expand Down
4 changes: 2 additions & 2 deletions scripts/makefiles/e2e.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ e2e-help:
@echo ""
@echo "Available Commands:"
@echo " build-script Build e2e script"
@echo " check-image-sha Check e2e image SHA"
@echo " docker-build-debug Build e2e debug Docker image"
@echo " docker-build-e2e-init-chain Build e2e init chain Docker image"
@echo " docker-build-e2e-init-node Build e2e init node Docker image"
@echo " setup Set up e2e environment"
@echo " check-image-sha Check e2e image SHA"
@echo " remove-resources Remove e2e resources"
@echo " setup Set up e2e environment"
e2e: e2e-help

e2e-build-script:
Expand Down
4 changes: 2 additions & 2 deletions scripts/makefiles/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ lint-help:
@echo ""
@echo "Available Commands:"
@echo " all Run all linters"
@echo " fix-typo Run codespell to fix typos"
@echo " format Run linters with auto-fix"
@echo " mdlint Run markdown linter"
@echo " markdown Run markdown linter with auto-fix"
@echo " mdlint Run markdown linter"
@echo " typo Run codespell to check typos"
@echo " fix-typo Run codespell to fix typos"
lint: lint-help

lint-all:
Expand Down
36 changes: 18 additions & 18 deletions scripts/makefiles/localnet.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ localnet-help:
@echo " make localnet-[command]"
@echo ""
@echo "Available Commands:"
@echo " keys Add keys for localnet"
@echo " init Initialize localnet"
@echo " build Build localnet"
@echo " clean Clean localnet"
@echo " cl-add-to-positions Add to positions"
@echo " cl-claim-spread-rewards Claim spread rewards"
@echo " cl-claim-incentives Claim incentives"
@echo " cl-create-bigbang-config Create Big Bang configuration"
@echo " cl-create-pool Create concentrated liquidity pool"
@echo " cl-create-positions Create concentrated liquidity positions"
@echo " cl-small-swap Perform small randomized swaps"
@echo " cl-external-incentive Create external incentive"
@echo " cl-large-swap Perform large swaps"
@echo " cl-positions-large-swaps Create positions and perform large swaps"
@echo " cl-positions-small-swaps Create positions and perform small swaps"
@echo " cl-refresh-subgraph-genesis Refresh subgraph genesis"
@echo " cl-refresh-subgraph-positions Refresh subgraph positions"
@echo " cl-withdraw-positions Withdraw positions"
@echo " init Initialize localnet"
@echo " keys Add keys for localnet"
@echo " start Start localnet"
@echo " start-with-state Start localnet with state"
@echo " startd Start localnet in detached mode"
@echo " startd-with-state Start localnet in detached mode with state"
@echo " stop Stop localnet"
@echo " clean Clean localnet"
@echo " state-export-init Initialize localnet state export"
@echo " state-export-build Build localnet state export"
@echo " state-export-start Start localnet state export"
@echo " state-export-startd Start localnet state export in detached mode"
@echo " state-export-stop Stop localnet state export"
@echo " state-export-clean Clean localnet state export"
@echo " cl-create-positions Create concentrated liquidity positions"
@echo " cl-small-swap Perform small randomized swaps"
@echo " cl-large-swap Perform large swaps"
@echo " cl-external-incentive Create external incentive"
@echo " cl-create-pool Create concentrated liquidity pool"
@echo " cl-claim-spread-rewards Claim spread rewards"
@echo " cl-claim-incentives Claim incentives"
@echo " cl-add-to-positions Add to positions"
@echo " cl-withdraw-positions Withdraw positions"
@echo " cl-positions-small-swaps Create positions and perform small swaps"
@echo " cl-positions-large-swaps Create positions and perform large swaps"
@echo " cl-refresh-subgraph-positions Refresh subgraph positions"
@echo " cl-refresh-subgraph-genesis Refresh subgraph genesis"
@echo " cl-create-bigbang-config Create Big Bang configuration"
@echo " stop Stop localnet"
localnet: localnet-help

localnet-keys:
Expand Down
2 changes: 1 addition & 1 deletion scripts/makefiles/proto.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ proto-help:
@echo ""
@echo "Available Commands:"
@echo " all Run proto-format and proto-gen"
@echo " gen Generate Protobuf files"
@echo " format Format Protobuf files"
@echo " gen Generate Protobuf files"
@echo " image-build Build the protobuf Docker image"
@echo " image-push Push the protobuf Docker image"

Expand Down
56 changes: 56 additions & 0 deletions scripts/makefiles/sqs.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
###############################################################################
### SQS ###
###############################################################################

sqs-help:
@echo "sqs subcommands"
@echo ""
@echo "Usage:"
@echo " make sqs-[command] or make redis-start, make redis-stop"
@echo ""
@echo "Available Commands:"
@echo " load-test-ui Start SQS load ui service"
@echo " profile Profiling SQS service"
@echo " quote-compare Compares the quotes between SQS and chain over pool 1136 which is concentrated"
@echo " quote-compare-stage Compares the quotes between SQS and chain over pool 1136 which is concentrated"
@echo " start Start SQS service"
@echo " update-mainnet-state Updates go tests with the latest mainnet state and make sure that the node is running locally"
@echo " validate-cl-state Validates that SQS concentrated liquidity pool state is consistent with the state of the chain"

sqs: sqs-help

redis-start:
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 -v ./redis-cache/:/data redis/redis-stack:7.2.0-v3

redis-stop:
docker container rm -f redis-stack

sqs-start:
./scripts/debug_builder.sh
build/osmosisd start

sqs-load-test-ui:
docker compose -f ingest/sqs/locust/docker-compose.yml up --scale worker=4

sqs-profile:
go tool pprof -http=:8080 http://localhost:9092/debug/pprof/profile?seconds=15

# Validates that SQS concentrated liquidity pool state is
# consistent with the state of the chain.
sqs-validate-cl-state:
ingest/sqs/scripts/validate-cl-state.sh "http://localhost:9092"

# Compares the quotes between SQS and chain over pool 1136
# which is concentrated.
sqs-quote-compare:
ingest/sqs/scripts/quote.sh "http://localhost:9092"

sqs-quote-compare-stage:
ingest/sqs/scripts/quote.sh "http://165.227.168.61"

# Updates go tests with the latest mainnet state
# Make sure that the node is running locally
sqs-update-mainnet-state:
curl -X POST "http:/localhost:9092/router/store-state"
mv pools.json ingest/sqs/router/usecase/routertesting/parsing/pools.json
mv taker_fees.json ingest/sqs/router/usecase/routertesting/parsing/taker_fees.json
14 changes: 7 additions & 7 deletions scripts/makefiles/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ test-help:
@echo ""
@echo "Available Commands:"
@echo " all Run all tests"
@echo " unit Run unit tests"
@echo " race Run race tests"
@echo " benchmark Run benchmark tests"
@echo " cover Run coverage tests"
@echo " sim-suite Run sim suite tests"
@echo " sim-app Run sim app tests"
@echo " sim-determinism Run sim determinism tests"
@echo " sim-bench Run sim benchmark tests"
@echo " e2e Run e2e tests"
@echo " e2e-ci Run e2e CI tests"
@echo " e2e-ci-scheduled Run e2e CI scheduled tests"
@echo " e2e-debug Run e2e debug tests"
@echo " e2e-short Run e2e short tests"
@echo " mutation Run mutation tests"
@echo " benchmark Run benchmark tests"
@echo " race Run race tests"
@echo " sim-app Run sim app tests"
@echo " sim-bench Run sim benchmark tests"
@echo " sim-determinism Run sim determinism tests"
@echo " sim-suite Run sim suite tests"
@echo " unit Run unit tests"

test: test-help

Expand Down

0 comments on commit f036365

Please sign in to comment.