Skip to content

Commit af9765b

Browse files
committed
Update the contributing guidelines
1 parent b0b940a commit af9765b

File tree

3 files changed

+74
-114
lines changed

3 files changed

+74
-114
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,4 @@
22

33
Thank you for taking the time to contribute to Matrix!
44

5-
This is the repository for MAS (Matrix Authentication Service), an OAuth 2.0 and OpenID Provider server for Matrix.
6-
75
Please see the [contributors' guide](https://element-hq.github.io/matrix-authentication-service/development/contributing.html) in our rendered documentation.
8-
9-
## Sign off
10-
11-
We ask that everybody who contributes to this project signs off their contributions, as explained below.
12-
13-
We follow a simple 'inbound=outbound' model for contributions: the act of submitting an 'inbound' contribution means that the contributor agrees to license their contribution under the same terms as the project's overall 'outbound' license - in our case, this is Apache Software License v2 (see [LICENSE](./LICENSE)).
14-
15-
In order to have a concrete record that your contribution is intentional and you agree to license it under the same terms as the project's license, we've adopted the same lightweight approach used by the [Linux Kernel](https://www.kernel.org/doc/html/latest/process/submitting-patches.html), [Docker](https://github.com/docker/docker/blob/master/CONTRIBUTING.md), and many other projects: the [Developer Certificate of Origin](https://developercertificate.org/) (DCO). This is a simple declaration that you wrote the contribution or otherwise have the right to contribute it to Matrix:
16-
17-
```
18-
Developer Certificate of Origin
19-
Version 1.1
20-
21-
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
22-
660 York Street, Suite 102,
23-
San Francisco, CA 94110 USA
24-
25-
Everyone is permitted to copy and distribute verbatim copies of this
26-
license document, but changing it is not allowed.
27-
28-
Developer's Certificate of Origin 1.1
29-
30-
By making a contribution to this project, I certify that:
31-
32-
(a) The contribution was created in whole or in part by me and I
33-
have the right to submit it under the open source license
34-
indicated in the file; or
35-
36-
(b) The contribution is based upon previous work that, to the best
37-
of my knowledge, is covered under an appropriate open source
38-
license and I have the right under that license to submit that
39-
work with modifications, whether created in whole or in part
40-
by me, under the same open source license (unless I am
41-
permitted to submit under a different license), as indicated
42-
in the file; or
43-
44-
(c) The contribution was provided directly to me by some other
45-
person who certified (a), (b) or (c) and I have not modified
46-
it.
47-
48-
(d) I understand and agree that this project and the contribution
49-
are public and that a record of the contribution (including all
50-
personal information I submit with it, including my sign-off) is
51-
maintained indefinitely and may be redistributed consistent with
52-
this project or the open source license(s) involved.
53-
```
54-
55-
If you agree to this for your contribution, then all that's needed is to include the line in your commit or pull request comment:
56-
57-
```
58-
Signed-off-by: Your Name <your@email.example.org>
59-
```
60-
61-
Git allows you to add this signoff automatically when using the `-s` flag to `git commit`, which uses the name and email set in your `user.name` and `user.email` git configs.

docs/development/contributing.md

Lines changed: 73 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,79 +2,48 @@
22

33
This document aims to get you started with contributing to the Matrix Authentication Service!
44

5-
# 1. Who can contribute to MAS?
5+
## 1. Who can contribute to MAS?
66

7-
We ask that everybody who contributes to this project signs off their contributions, as explained below.
7+
Everyone is welcome to contribute code to [Synapse](https://github.com/element-hq/matrix-authentication-service), provided that they are willing to license their contributions to Element under a [Contributor License Agreement](https://cla-assistant.io/element-hq/matrix-authentication-service) (CLA). This ensures that their contribution will be made available under an OSI-approved open-source license, currently Affero General Public License v3 (AGPLv3).
88

9-
Everyone is welcome to contribute code to [matrix.org projects](https://github.com/matrix-org), provided that they are willing to license their contributions under the same license as the project itself. We follow a simple 'inbound=outbound' model for contributions: the act of submitting an 'inbound' contribution means that the contributor agrees to license the code under the same terms as the project's overall 'outbound' license - in our case, this is almost always Apache Software License v2 (see [LICENSE](https://github.com/matrix-org/matrix-authentication-service/blob/main/LICENSE)).
9+
Please see the [Element blog post](https://element.io/blog/synapse-now-lives-at-github-com-element-hq-synapse/) for the full rationale.
1010

11-
In order to have a concrete record that your contribution is intentional and you agree to license it under the same terms as the project's license, we've adopted the same lightweight approach used by the [Linux Kernel](https://www.kernel.org/doc/html/latest/process/submitting-patches.html), [Docker](https://github.com/docker/docker/blob/master/CONTRIBUTING.md), and many other projects: the [Developer Certificate of Origin](https://developercertificate.org/) (DCO). This is a simple declaration that you wrote the contribution or otherwise have the right to contribute it to Matrix:
11+
## 2. What can I contribute?
1212

13-
```
14-
Developer Certificate of Origin
15-
Version 1.1
16-
17-
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
18-
660 York Street, Suite 102,
19-
San Francisco, CA 94110 USA
13+
There are two main ways to contribute to MAS:
2014

21-
Everyone is permitted to copy and distribute verbatim copies of this
22-
license document, but changing it is not allowed.
15+
- **Code and documentation**: You can contribute code to the Matrix Authentication Service and help improve its documentation by submitting pull requests to the [GitHub repository](https://github.com/element-hq/matrix-authentication-service).
16+
- **Translations**: You can contribute translations to the Matrix Authentication Service through [Localazy](https://localazy.com/p/matrix-authentication-service).
2317

24-
Developer's Certificate of Origin 1.1
18+
## 3. What do I need?
2519

26-
By making a contribution to this project, I certify that:
27-
28-
(a) The contribution was created in whole or in part by me and I
29-
have the right to submit it under the open source license
30-
indicated in the file; or
20+
To get MAS running locally from source you will need:
3121

32-
(b) The contribution is based upon previous work that, to the best
33-
of my knowledge, is covered under an appropriate open source
34-
license and I have the right under that license to submit that
35-
work with modifications, whether created in whole or in part
36-
by me, under the same open source license (unless I am
37-
permitted to submit under a different license), as indicated
38-
in the file; or
22+
- [Install Rust and Cargo](https://www.rust-lang.org/learn/get-started). We recommend using the latest stable version of Rust.
23+
- [Install Node.js and npm](https://nodejs.org/). We recommend using the latest LTS version of Node.js.
24+
- [Install Open Policy Agent](https://www.openpolicyagent.org/docs#1-download-opa)
3925

40-
(c) The contribution was provided directly to me by some other
41-
person who certified (a), (b) or (c) and I have not modified
42-
it.
26+
## 4. Get the source
4327

44-
(d) I understand and agree that this project and the contribution
45-
are public and that a record of the contribution (including all
46-
personal information I submit with it, including my sign-off) is
47-
maintained indefinitely and may be redistributed consistent with
48-
this project or the open source license(s) involved.
49-
```
28+
The preferred and easiest way to contribute changes is to fork the relevant project on GitHub and then [create a pull request]( https://help.github.com/articles/using-pull-requests/) to ask us to pull your changes into our repo.
5029

51-
If you agree to this for your contribution, then all that's needed is to include the line in your commit or pull request comment:
30+
Please base your changes on the `main` branch.
5231

53-
```
54-
Signed-off-by: Your Name <your@email.example.org>
32+
```sh
33+
git clone git@github.com:YOUR_GITHUB_USER_NAME/matrix-authentication-service.git
34+
cd matrix-authentication-service
35+
git checkout main
5536
```
5637

57-
Git allows you to add this signoff automatically when using the `-s` flag to `git commit`, which uses the name and email set in your `user.name` and `user.email` git configs.
38+
If you need help getting started with git, this is beyond the scope of the document, but you can find many good git tutorials on the web.
5839

59-
# 2. What do I need?
60-
61-
To get MAS running locally from source you will need:
62-
63-
- [Install Rust and Cargo](https://www.rust-lang.org/learn/get-started)
64-
- [Install Node.js and npm](https://nodejs.org/)
65-
- [Install Open Policy Agent](https://www.openpolicyagent.org/docs/latest/#1-download-opa)
66-
67-
# 3. Get the source
68-
69-
- Clone this repository
70-
71-
# 4. Build and run MAS
40+
## 5. Build and run MAS
7241

7342
- Build the frontend
7443
```sh
7544
cd frontend
76-
npm ci
77-
npm run build
45+
npm ci # Install the frontend dependencies
46+
npm run build # Build the frontend
7847
cd ..
7948
```
8049
- Build the Open Policy Agent policies
@@ -91,10 +60,57 @@ To get MAS running locally from source you will need:
9160
docker run -p 5432:5432 -e 'POSTGRES_USER=postgres' -e 'POSTGRES_PASSWORD=postgres' -e 'POSTGRES_DATABASE=postgres' postgres
9261
```
9362
- Update the database URI in `config.yaml` to `postgresql://postgres:postgres@localhost/postgres`
94-
- Run the database migrations via `cargo run -- database migrate`
9563
- Run the server via `cargo run -- server -c config.yaml`
9664
- Go to <http://localhost:8080/>
9765

98-
# 5. Learn about MAS
66+
## 6. Update generated files and format your code
67+
68+
The project includes a few files that are automatically generated.
69+
Most of them can be updated by running `sh misc/update.sh` at the root of the project.
70+
71+
Make sure your code adheres to our Rust and TypeScript code style by running:
72+
73+
- `cargo +nightly fmt` (with the nightly toolchain installed)
74+
- `npm run format` in the `frontend` directory
75+
76+
When updating SQL queries in the `crates/storage-pg/` crate, you may need to update the `sqlx` introspection data. To do this, make sure to install `cargo-sqlx` (`cargo install sqlx-cli`) and:
77+
78+
- Apply the latest migrations: `cargo sqlx migrate run` from the `crates/storage-pg/` directory.
79+
- Update the `sqlx` introspection data: `cargo sqlx prepare` from the `crates/storage-pg/` directory.
80+
81+
## 7. Test, test, test!
82+
83+
While you're developing and before submitting a patch, you'll want to test your code and adhere to many code style and linting guidelines.
84+
85+
### Run the linters
86+
87+
- Run `cargo clippy --workspace` to lint the Rust code.
88+
- Run `npm run lint` in the `frontend` directory to lint the frontend code.
89+
90+
### Run the tests
91+
92+
- Run the tests to the backend by running `cargo test --workspace`. This requires a connection to a PostgreSQL database, set via the `DATABASE_URL` environment variable.
93+
- Run the tests to the frontend by running `npm run test` in the `frontend` directory.
94+
95+
## 8. Submit a pull request
96+
97+
Once you've made changes, you're ready to submit a pull request.
98+
99+
When the pull request is opened, you will see a few things:
100+
101+
1. Our automated CI (Continuous Integration) pipeline will run (again) the linters, the unit tests, the integration tests, and more.
102+
1. One or more of the developers will take a look at your pull request and offer feedback.
103+
104+
From this point, you should:
105+
106+
1. Look at the results of the CI pipeline.
107+
- If there is any error, fix the error.
108+
1. If a developer has requested changes, make these changes and let us know when it is ready for a developer to review again.
109+
- A pull request is a conversation; if you disagree with the suggestions, please respond and discuss it.
110+
1. Create a new commit with the changes.
111+
- Please do *not* overwrite the history. New commits make the reviewer's life easier.
112+
- Push these commits to your pull request.
113+
1. Back to 1.
114+
1. Once the pull request is ready for review again, please **re-request review** from whichever developer did your initial review (or leave a comment in the pull request that you believe all required changes have been made).
99115

100-
You can learn about the [architecture](architecture.md) and [database](database.md) of MAS here.
116+
Once both the CI and the developers are happy, the patch will be merged into Matrix Authentication Service and released shortly!

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"generate": "graphql-codegen",
8+
"generate": "graphql-codegen && i18next",
99
"lint": "graphql-codegen && biome check && tsc && i18next --fail-on-warnings --fail-on-update",
1010
"format": "biome format --write",
1111
"build": "rimraf ./dist/ && vite build",

0 commit comments

Comments
 (0)