From 13e124c0513d75ba219aa4995497c6dabddad477 Mon Sep 17 00:00:00 2001 From: refcell Date: Wed, 22 May 2024 06:09:22 -0400 Subject: [PATCH] feat: Justfile Migration (#224) * feat: migrate to justfile over makefile * fix: doc cleaning * fix: doc cleaning * fix: consistently use spaces --- Justfile | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 25 ---------------- docker/README.md | 4 ++- docs/devnet.md | 7 +++-- 4 files changed, 84 insertions(+), 28 deletions(-) create mode 100644 Justfile delete mode 100644 Makefile diff --git a/Justfile b/Justfile new file mode 100644 index 00000000..976e1742 --- /dev/null +++ b/Justfile @@ -0,0 +1,76 @@ +set positional-arguments +set dotenv-load := true + +alias t := test +alias b := build-all +alias l := lint +alias f := fmt + +# default recipe to display help information +default: + @just --list + +# Builds all docker images +build-all: + docker buildx build --platform linux/arm64,linux/amd64 -t a16zcrypto/magi --push . + +# Builds local magi docker images +build-local: + docker buildx build -t noah7545/magi --load . + +# Pulls all docker images +pull: + cd docker && docker compose pull + +# Cleans all docker images +clean: + cd docker && docker compose down -v --remove-orphans + +# Composes docker +run: + cd docker && docker compose up + +# Composes docker with local images +run-local: + just build-local && cd docker && docker compose up + +# Runs op-geth with docker +run-geth: + cd docker && COMPOSE_PROFILES=op-geth docker compose up + +# Runs op-erigon with docker +run-erigon: + cd docker && COMPOSE_PROFILES=op-erigon docker compose up + +# Run all tests +tests: test test-docs + +# Test for the native target with all features +test *args='': + cargo nextest run --all --all-features $@ + +# Lint for all available targets +lint: lint-native lint-docs + +# Fixes and checks the formatting +fmt: fmt-native-fix fmt-native-check + +# Fixes the formatting +fmt-native-fix: + cargo +nightly fmt --all + +# Check the formatting +fmt-native-check: + cargo +nightly fmt --all -- --check + +# Lints +lint-native: fmt-native-check + cargo +nightly clippy --all --all-features --all-targets -- -D warnings + +# Lint the Rust documentation +lint-docs: + RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --document-private-items + +# Test the Rust documentation +test-docs: + cargo test --doc --all --locked diff --git a/Makefile b/Makefile deleted file mode 100644 index a76adac2..00000000 --- a/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -.PHONY: build-all build-local pull clean run run-local run-geth run-erigon - -build-all: - docker buildx build --platform linux/arm64,linux/amd64 -t a16zcrypto/magi --push . - -build-local: - docker buildx build -t noah7545/magi --load . - -pull: - cd docker && docker compose pull - -clean: - cd docker && docker compose down -v --remove-orphans - -run: - cd docker && docker compose up - -run-local: - make build-local && cd docker && docker compose up - -run-geth: - cd docker && COMPOSE_PROFILES=op-geth docker compose up - -run-erigon: - cd docker && COMPOSE_PROFILES=op-erigon docker compose up diff --git a/docker/README.md b/docker/README.md index 0bc1879d..529ca161 100644 --- a/docker/README.md +++ b/docker/README.md @@ -4,7 +4,9 @@ This contains a simple docker setup for running magi and op-geth. ## Running -Begin by copying `.env.default` to `.env`. You can set the network to sync to by changing the `NETWORK` value (supported options are optimism-goerli and base-goerli). Make sure to set the `L1_RPC_URL` value to a valid RPC URL for the L1 being used by the given network. If you are running in production, you may also want to set a secure `JWT_SECRET` value. You can create a new secret by running `openssl rand -hex 32`. +Begin by copying `.env.default` to `.env`. You can set the network to sync to by changing the `NETWORK` value (supported options are optimism-goerli and base-goerli). +Make sure to set the `L1_RPC_URL` value to a valid RPC URL for the L1 being used by the given network. If you are running in production, you may also want to set a secure `JWT_SECRET` value. +You can create a new secret by running `openssl rand -hex 32`. To run both magi and op-geth together, run `docker compose up`. To run just op-geth without magi for local development, run `COMPOSE_PROFILES=no-magi docker compose up` diff --git a/docs/devnet.md b/docs/devnet.md index cf5415d5..596f3133 100644 --- a/docs/devnet.md +++ b/docs/devnet.md @@ -18,7 +18,7 @@ To launch the OP devnet, ensure you have [Docker](https://www.docker.com/): cd optimism git submodule update --init --recursive - make devnet-up + just devnet-up For troubleshooting, please refer to the official [documentation](https://community.optimism.io/docs/developers/build/dev-node/#). @@ -130,6 +130,9 @@ To test withdrawal from your account refer to this [tutorial](https://stack.opti ## Trouble shooting -If the Magi node stops syncing, you can reset the devnet. To do this, navigate to the Optimism root directory and run the following command: make devnet-clean. Afterward, start again both the devnet and Magi. +If the Magi node stops syncing, you can reset the devnet. +To do this, navigate to the root of the Optimism monorepo directory +and run the following command: `make devnet-clean`. +Afterward, start again both the devnet and Magi. If the issue continues, please create a new issue on GitHub providing detailed information about the problem.