2017-10-06 01:11:51 +00:00
|
|
|
# Contributing to Dendrite
|
|
|
|
|
|
|
|
Everyone is welcome to contribute to Dendrite! We aim to make it as easy as
|
|
|
|
possible to get started.
|
|
|
|
|
2017-10-06 10:23:49 +00:00
|
|
|
Please ensure that you sign off your contributions! See [Sign Off](#sign-off)
|
|
|
|
section below.
|
|
|
|
|
|
|
|
## Getting up and running
|
|
|
|
|
|
|
|
See [INSTALL.md](INSTALL.md) for instructions on setting up a running dev
|
|
|
|
instance of dendrite, and [CODE_STYLE.md](CODE_STYLE.md) for the code style
|
|
|
|
guide.
|
|
|
|
|
2020-08-25 07:11:41 +00:00
|
|
|
We use [golangci-lint](https://github.com/golangci/golangci-lint) to lint
|
|
|
|
Dendrite which can be executed via:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ golangci-lint run
|
|
|
|
```
|
|
|
|
|
|
|
|
We also have unit tests which we run via:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ go test ./...
|
|
|
|
```
|
2020-02-06 11:54:26 +00:00
|
|
|
|
2019-08-07 10:46:36 +00:00
|
|
|
## Continuous Integration
|
|
|
|
|
|
|
|
When a Pull Request is submitted, continuous integration jobs are run
|
2020-02-06 11:54:26 +00:00
|
|
|
automatically to ensure the code builds and is relatively well-written. The jobs
|
|
|
|
are run on [Buildkite](https://buildkite.com/matrix-dot-org/dendrite/), and the
|
|
|
|
Buildkite pipeline configuration can be found in Matrix.org's [pipelines
|
|
|
|
repository](https://github.com/matrix-org/pipelines).
|
2019-08-07 10:46:36 +00:00
|
|
|
|
|
|
|
If a job fails, click the "details" button and you should be taken to the job's
|
|
|
|
logs.
|
|
|
|
|
2020-02-06 11:54:26 +00:00
|
|
|
![Click the details button on the failing build
|
|
|
|
step](docs/images/details-button-location.jpg)
|
2019-08-07 10:46:36 +00:00
|
|
|
|
2020-02-06 11:54:26 +00:00
|
|
|
Scroll down to the failing step and you should see some log output. Scan the
|
|
|
|
logs until you find what it's complaining about, fix it, submit a new commit,
|
|
|
|
then rinse and repeat until CI passes.
|
2019-08-07 10:46:36 +00:00
|
|
|
|
|
|
|
### Running CI Tests Locally
|
|
|
|
|
|
|
|
To save waiting for CI to finish after every commit, it is ideal to run the
|
2020-02-06 11:54:26 +00:00
|
|
|
checks locally before pushing, fixing errors first. This also saves other people
|
|
|
|
time as only so many PRs can be tested at a given time.
|
2019-08-07 10:46:36 +00:00
|
|
|
|
2020-08-24 17:13:43 +00:00
|
|
|
To execute what Buildkite tests, first run `./build/scripts/build-test-lint.sh`; this
|
2020-02-06 11:54:26 +00:00
|
|
|
script will build the code, lint it, and run `go test ./...` with race condition
|
|
|
|
checking enabled. If something needs to be changed, fix it and then run the
|
|
|
|
script again until it no longer complains. Be warned that the linting can take a
|
|
|
|
significant amount of CPU and RAM.
|
2019-08-07 10:46:36 +00:00
|
|
|
|
2019-10-02 03:01:52 +00:00
|
|
|
Once the code builds, run [Sytest](https://github.com/matrix-org/sytest)
|
|
|
|
according to the guide in
|
2019-08-07 10:46:36 +00:00
|
|
|
[docs/sytest.md](https://github.com/matrix-org/dendrite/blob/master/docs/sytest.md#using-a-sytest-docker-image)
|
2019-10-02 03:01:52 +00:00
|
|
|
so you can see whether something is being broken and whether there are newly
|
|
|
|
passing tests.
|
|
|
|
|
|
|
|
If these two steps report no problems, the code should be able to pass the CI
|
|
|
|
tests.
|
2019-08-07 10:46:36 +00:00
|
|
|
|
2017-10-06 10:23:49 +00:00
|
|
|
|
2017-10-06 01:11:51 +00:00
|
|
|
## Picking Things To Do
|
|
|
|
|
2020-02-06 11:54:26 +00:00
|
|
|
If you're new then feel free to pick up an issue labelled [good first
|
|
|
|
issue](https://github.com/matrix-org/dendrite/labels/good%20first%20issue).
|
2017-10-06 01:11:51 +00:00
|
|
|
These should be well-contained, small pieces of work that can be picked up to
|
|
|
|
help you get familiar with the code base.
|
|
|
|
|
|
|
|
Once you're comfortable with hacking on Dendrite there are issues lablled as
|
2020-08-25 07:11:41 +00:00
|
|
|
[help wanted](https://github.com/matrix-org/dendrite/labels/help-wanted),
|
2020-02-06 11:54:26 +00:00
|
|
|
these are often slightly larger or more complicated pieces of work but are
|
|
|
|
hopefully nonetheless fairly well-contained.
|
2017-10-06 01:11:51 +00:00
|
|
|
|
2020-02-06 11:54:26 +00:00
|
|
|
We ask people who are familiar with Dendrite to leave the [good first
|
|
|
|
issue](https://github.com/matrix-org/dendrite/labels/good%20first%20issue)
|
2017-10-06 01:11:51 +00:00
|
|
|
issues so that there is always a way for new people to come and get involved.
|
|
|
|
|
|
|
|
## Getting Help
|
|
|
|
|
|
|
|
For questions related to developing on Dendrite we have a dedicated room on
|
2019-01-28 10:15:33 +00:00
|
|
|
Matrix [#dendrite-dev:matrix.org](https://matrix.to/#/#dendrite-dev:matrix.org)
|
2017-10-06 01:11:51 +00:00
|
|
|
where we're happy to help.
|
|
|
|
|
2020-02-06 11:54:26 +00:00
|
|
|
For more general questions please use
|
|
|
|
[#dendrite:matrix.org](https://matrix.to/#/#dendrite:matrix.org).
|
2017-10-06 01:11:51 +00:00
|
|
|
|
|
|
|
## Sign off
|
|
|
|
|
|
|
|
We ask that everyone who contributes to the project signs off their
|
2020-02-06 11:54:26 +00:00
|
|
|
contributions, in accordance with the
|
|
|
|
[DCO](https://github.com/matrix-org/matrix-doc/blob/master/CONTRIBUTING.rst#sign-off).
|