Skip to content

Commit

Permalink
Add development guide
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev committed May 8, 2024
1 parent f96982d commit b68f9d1
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 35 deletions.
34 changes: 0 additions & 34 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
69 changes: 69 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit b68f9d1

Please sign in to comment.