-
Notifications
You must be signed in to change notification settings - Fork 27
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: introduce sub Makefiles
#83
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
##@ Clients | ||
PORT?=8545 | ||
|
||
.PHONY: geth | ||
geth: ## Start a local geth node. | ||
geth --dev --dev.period 2 --http --http.addr localhost --http.port $(PORT) --http.api admin,debug,web3,eth,txpool,personal,miner,net --verbosity 5 --rpc.gascap 50000000 --rpc.txfeecap 0 --miner.gaslimit 10 --miner.gasprice 1 --gpo.blocks 1 --gpo.percentile 1 --gpo.maxprice 10 --gpo.ignoreprice 2 --dev.gaslimit 50000000 | ||
|
||
.PHONY: avail | ||
avail: ## Start a local avail node. | ||
avail --dev --rpc-port $(PORT) | ||
|
||
LOADTEST_ACCOUNT=0x85da99c8a7c2c95964c8efd687e95e632fc533d6 | ||
LOADTEST_FUNDING_AMOUNT_ETH=5000 | ||
eth_coinbase := $(shell curl -s -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "id": 2, "method": "eth_coinbase", "params": []}' http://127.0.0.1:${PORT} | jq -r ".result") | ||
hex_funding_amount := $(shell echo "obase=16; ${LOADTEST_FUNDING_AMOUNT_ETH}*10^18" | bc) | ||
.PHONY: geth-loadtest | ||
geth-loadtest: build ## Fund test account with 5k ETH and run loadtest against an EVM/Geth chain. | ||
curl -H "Content-Type: application/json" -d '{"jsonrpc":"2.0", "method":"eth_sendTransaction", "params":[{"from": "${eth_coinbase}","to": "${LOADTEST_ACCOUNT}","value": "0x${hex_funding_amount}"}], "id":1}' http://127.0.0.1:${PORT} | ||
sleep 5 | ||
$(BUILD_DIR)/$(BIN_NAME) loadtest --verbosity 700 --chain-id 1337 --concurrency 1 --requests 1000 --rate-limit 5 --mode c http://127.0.0.1:$(PORT) | ||
|
||
.PHONY: avail-loadtest | ||
avail-loadtest: build ## Run loadtest against an Avail chain. | ||
$(BUILD_DIR)/$(BIN_NAME) loadtest --verbosity 700 --chain-id 1256 --concurrency 1 --requests 1000 --rate-limit 5 --mode t --data-avail http://127.0.0.1:$(PORT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
##@ Lint | ||
|
||
# Add missing and remove unused modules. | ||
.PHONY: tidy | ||
tidy: | ||
go mod tidy | ||
|
||
# Run `go fmt` against code. | ||
.PHONY: fmt | ||
fmt: | ||
go fmt ./... | ||
|
||
# Run `go vet` and `shadow` (which reports shadowed variables) against code. | ||
# https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/shadow | ||
# `go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest` | ||
.PHONY: vet | ||
vet: | ||
go vet ./... | ||
shadow ./... | ||
|
||
# Run `golangci-lint` against code. | ||
# `golangci-lint` runs `gofmt`, `govet`, `staticcheck` and other linters. | ||
# https://golangci-lint.run/usage/install/#local-installation | ||
.PHONY: golangci-lint | ||
golangci-lint: | ||
golangci-lint run --fix --timeout 5m | ||
|
||
.PHONY: lint | ||
lint: tidy vet golangci-lint ## Run linters. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main
Makefile
should only contain targets related tobuild
,install
andtest
to keep it simple and easier to maintain.Then where do we store other targets that may be useful? I suggest that we make use of sub
Makefile
s such asscripts/clients.mk
andscripts/lint.mk
.We can import the targets from these files into the main
Makefile
usinginclude scripts/clients.mk
. This is useful if you still want to show these targets in the main help.It's also possible to call a target from a sub
Makefile
without going through the mainMakefile
, for example$ make -f scripts/clients.mk geth
.@praetoriansentry wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. I would just confirm that your changes don't impact any of the github work flows / ci.