You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
-56Lines changed: 0 additions & 56 deletions
Original file line number
Diff line number
Diff line change
@@ -2,60 +2,4 @@
2
2
3
3
Thank you for taking the time to contribute to Matrix!
4
4
5
-
This is the repository for MAS (Matrix Authentication Service), an OAuth 2.0 and OpenID Provider server for Matrix.
6
-
7
5
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.
Copy file name to clipboardExpand all lines: docs/development/contributing.md
+73-57Lines changed: 73 additions & 57 deletions
Original file line number
Diff line number
Diff line change
@@ -2,79 +2,48 @@
2
2
3
3
This document aims to get you started with contributing to the Matrix Authentication Service!
4
4
5
-
# 1. Who can contribute to MAS?
5
+
##1. Who can contribute to MAS?
6
6
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).
8
8
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.
10
10
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?
12
12
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:
20
14
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).
23
17
24
-
Developer's Certificate of Origin 1.1
18
+
## 3. What do I need?
25
19
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:
31
21
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)
39
25
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
43
27
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.
50
29
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:
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.
58
39
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
72
41
73
42
- Build the frontend
74
43
```sh
75
44
cd frontend
76
-
npm ci
77
-
npm run build
45
+
npm ci# Install the frontend dependencies
46
+
npm run build# Build the frontend
78
47
cd ..
79
48
```
80
49
- Build the Open Policy Agent policies
@@ -91,10 +60,57 @@ To get MAS running locally from source you will need:
- Update the database URI in `config.yaml` to `postgresql://postgres:postgres@localhost/postgres`
94
-
- Run the database migrations via `cargo run -- database migrate`
95
63
- Run the server via `cargo run -- server -c config.yaml`
96
64
- Go to <http://localhost:8080/>
97
65
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).
99
115
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!
0 commit comments