From b68f9d1fe51e6f944d314e4084a6405cd2553781 Mon Sep 17 00:00:00 2001 From: Tarrence van As Date: Wed, 8 May 2024 12:09:13 -0400 Subject: [PATCH] Add development guide --- CONTRIBUTING.md | 34 ------------------------ DEVELOPMENT.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 3 files changed, 70 insertions(+), 35 deletions(-) create mode 100644 DEVELOPMENT.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dae1b86424..a7fe0ad7e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -59,40 +59,6 @@ When you submit the pull request, please provide a clear, detailed description o Your pull request will be reviewed by the maintainers of the Dojo project. They may ask for changes or clarification on certain points. Please address their comments and commit any required changes to the same branch on your repo. -## Running Tests - -Before you submit your pull request, you should run the test suite locally to make sure your changes haven't broken anything. - -To run the test, you can execute the same command that will be exected on the CI by checking the [`.github/workflows/ci.yml`](.github/workflows/ci.yml) file. - -```bash -# Run all the tests excluding Katana (due to SiR dependency, they may be run independently) -cargo nextest run --all-features --workspace --exclude katana - -# To limit the resources, you can run the tests only on a package: -cargo nextest run --all-features -p sozo-ops -``` - -If you have to modify `dojo-core` or `dojo-lang` crates you must: - -```bash -# First spin up a **fresh** Katana instance on default port. -cargo run --bin katana - -# Then execute the script that will rebuild them. -bash scripts/rebuild_test_artifacts.sh -``` - -Additionally, when you push your changes, the built-in Continuous Integration (CI) will also run all the tests on the pushed code. You can see the result of these tests in the GitHub interface of your pull request. If the tests fail, you'll need to revise your code and push it again. - -The CI uses a `devcontainer` to have all the dependencies installed and to run the tests. You can find more information about the devcontainer in the [`.devcontainer.json`](.devcontainer/devcontainer.json) file and see the latest releases on [GitHub package](https://github.com/dojoengine/dojo/pkgs/container/dojo-dev). - -## Releasing - -Propose a new release by manually triggering the `release-dispatch` github action. The version value can be an semver or a level: `[patch, minor, major]`. - -Once run, the workflow will create a PR with the versioned repo which will trigger the release flow and the creation of a draft release on merge. - ## Documentation We strive to provide comprehensive, up-to-date documentation for Dojo. If your changes require updates to the documentation, please include those in your pull request. diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000000..93fd716170 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,69 @@ +# Development Setup + +This guide outlines the steps to set up a development environment for Dojo. If you just want to play with the toolchain, we recommend following the [Quick Start](/getting-started.md) guide instead. + +## Prerequisites + +- [Rust](https://github.com/rust-lang/rust) +- [Cairo](https://github.com/starkware-libs/cairo) +- [protoc](https://github.com/protocolbuffers/protobuf) + +## Setup + +### 1. Clone the repository + +```sh +git clone https://github.com/dojoengine/dojo.git +``` + +### 2. Install Rust and dependencies + +Install Rust and run the test suite to confirm your setup: + +```sh +rustup override set stable && rustup update && cargo test +``` + +Note: Depending on your Linux distribution, you may need to install additional dependencies. + +### 3. Install Scarb package manager + +Install the [Scarb](https://docs.swmansion.com/scarb). + +### 4. Add the Cairo 1.0 VSCode extension + +Install the [Cairo 1.0](https://marketplace.visualstudio.com/items?itemName=starkware.cairo1) extension for Visual Studio Code. + +## Testing + +Before you submit your pull request, you should run the test suite locally to make sure your changes haven't broken anything. + +To run the test, you can execute the same command that will be exected on the CI by checking the [`.github/workflows/ci.yml`](.github/workflows/ci.yml) file. + +```bash +# Run all the tests excluding Katana (due to SiR dependency, they may be run independently) +cargo nextest run --all-features --workspace --exclude katana + +# To limit the resources, you can run the tests only on a package: +cargo nextest run --all-features -p sozo-ops +``` + +If you have to modify `dojo-core` or `dojo-lang` crates you must: + +```bash +# First spin up a **fresh** Katana instance on default port. +cargo run --bin katana + +# Then execute the script that will rebuild them. +bash scripts/rebuild_test_artifacts.sh +``` + +Additionally, when you push your changes, the built-in Continuous Integration (CI) will also run all the tests on the pushed code. You can see the result of these tests in the GitHub interface of your pull request. If the tests fail, you'll need to revise your code and push it again. + +The CI uses a `devcontainer` to have all the dependencies installed and to run the tests. You can find more information about the devcontainer in the [`.devcontainer.json`](.devcontainer/devcontainer.json) file and see the latest releases on [GitHub package](https://github.com/dojoengine/dojo/pkgs/container/dojo-dev). + +## Releasing + +Propose a new release by manually triggering the `release-dispatch` github action. The version value can be an semver or a level: `[patch, minor, major]`. + +Once run, the workflow will create a PR with the versioned repo which will trigger the release flow and the creation of a draft release on merge. diff --git a/README.md b/README.md index 4f441dfc24..ccb9389ad3 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ You can find more detailed documentation in the Dojo Book [here](https://book.do ## Development -We welcome contributions of all kinds from anyone. See our [Contribution Guide](/CONTRIBUTING.md) for more information on setting up your developer environment and how to get involved. +We welcome contributions of all kinds from anyone. See our [Development](/DEVELOPMENT.md) and [Contributing](/CONTRIBUTING.md) guides for more information on setting up your developer environment and how to get involved. If you encounter issues or have questions, you can [submit an issue on GitHub](https://github.com/dojoengine/dojo/issues). You can also join our [Discord](https://discord.gg/dojoengine) for discussion and help.