CONTRIBUTING: Add code submit workflow

Explain how to submit a CL for non-Chromium OS developers.

BUG=none
TEST=none

Change-Id: I3ee0e47eac1f0320f4c086a895f91ebf5fbf2d74
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3241903
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
Keiichi Watanabe 2021-10-25 23:19:47 +09:00 committed by Commit Bot
parent 6d1b2df054
commit feb0e8d728
2 changed files with 69 additions and 25 deletions

View file

@ -1,3 +1,5 @@
# Contributing
## Intro
This article goes into detail about multiple areas of interest to contributors,
@ -44,14 +46,75 @@ The `./test_all` script will use docker containers to run all tests for crosvm.
For more details on using the docker containers for running tests locally,
including faster, iterative test runs, see `ci/README.md`.
### Submitting Code
### Style guidelines
See also,
[Chrome OS Contributing Guide](https://chromium.googlesource.com/chromiumos/docs/+/HEAD/contributing.md)
To format all code, crosvm defers to rustfmt. In addition, the code adheres to
the following rules:
Once your change is reviewed by a crosvm
[owner](https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/crosvm/OWNERS)
it will need to go through two layers of presubmit checks.
The `use` statements for each module should be grouped in this order
1. `std`
2. third-party crates
3. chrome os crates
4. crosvm crates
5. `crate`
crosvm uses the [remain](https://github.com/dtolnay/remain) crate to keep error
enums sorted, along with the `#[sorted]` attribute to keep their corresponding
match statements in the same order.
## Submitting Code
Since crosvm is one of Chromium OS projects, please read through
[Chrome OS Contributing Guide] first. This section describes the crosvm-specific
workflow.
[Chrome OS Contributing Guide]: https://chromium.googlesource.com/chromiumos/docs/+/HEAD/contributing.md
### Creating a CL
We use [Chromium Gerrit](https://chromium-review.googlesource.com/) for code
reviewing. All crosvm CLs are listed at the [crosvm component].
> Note: We don't accept any pull requests on the [GitHub mirror].
[Chromium Gerrit]: https://chromium-review.googlesource.com
[crosvm component]: https://chromium-review.googlesource.com/q/project:chromiumos%252Fplatform%252Fcrosvm
[GitHub mirror]: https://github.com/google/crosvm
#### For Chromium OS Developers
If you have already set up the `chromiumos` repository and the `repo` command,
you can simply create and upload your CL in the same way as other Chromium OS
projects.
#### For non-Chromium OS Developers
If you are not interested in other Chromium OS components, you can simply clone
and contribute crosvm only. Before you make a commit locally, please set up
[Gerrit's Change-Id hook] on your system.
[Gerrit's Change-Id hook]: https://gerrit-review.googlesource.com/Documentation/user-changeid.html
```bash
$ git clone https://chromium.googlesource.com/chromiumos/platform/crosvm
# Modify code and make a git commit with a commit message following this rule:
# https://chromium.googlesource.com/chromiumos/docs/+/HEAD/contributing.md#Commit-messages
$ git commit
# Push your commit to Chromium Gerrit (https://chromium-review.googlesource.com/).
$ git push origin HEAD:refs/for/main
```
### Code review
Your change must be reviewed and approved by one of [crosvm owners].
[crosvm owners]: https://chromium.googlesource.com/chromiumos/platform/crosvm/+/HEAD/OWNERS
### Presubmit checking
Once your change is reviewed, it will need to go through two layers of presubmit
checks.
The review will trigger Kokoro to run crosvm specific tests. If you want to
check kokoro results before a review, you can set 'Commit Queue +1' in gerrit to
@ -77,20 +140,3 @@ Failures here will cause the commit queue to reject the change until it is
re-added (CQ+2). Unfortunately, it is extremely common for false negatives to
cause a change to get rejected, so be ready to re-apply the CQ+2 label if you're
the owner of a ready to submit change.
### Style guidelines
To format all code, crosvm defers to rustfmt. In addition, the code adheres to
the following rules:
The `use` statements for each module should be grouped in this order
1. `std`
2. third-party crates
3. chrome os crates
4. crosvm crates
5. `crate`
crosvm uses the [remain](https://github.com/dtolnay/remain) crate to keep error
enums sorted, along with the `#[sorted]` attribute to keep their corresponding
match statements in the same order.

View file

@ -1,3 +1 @@
# Contributing
{{#include ../../../CONTRIBUTING.md}}