Skip to content

Commit 24fedc2

Browse files
turt2liverichvdh
authored andcommitted
Merge branch 'master' into hs/proposal-appservice-login
2 parents fb091fe + 5d4713f commit 24fedc2

File tree

678 files changed

+25666
-28342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

678 files changed

+25666
-28342
lines changed

.buildkite/pipeline.yaml

+29-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
11
steps:
2-
- label: ":books: Build spec"
2+
- label: ":snake: Build swagger definitions for matrix.org"
33
command:
4-
- python3 -m venv env
5-
- env/bin/pip install -r scripts/requirements.txt
6-
- ". env/bin/activate; scripts/generate-matrix-org-assets"
4+
# Install the python dependencies necessary to build the spec
5+
- python3 -m venv env && . env/bin/activate
6+
- pip install -r scripts/requirements.txt
7+
# Build the spec
8+
- scripts/generate-matrix-org-assets
79
artifact_paths:
810
- assets.tar.gz
911
plugins:
10-
- docker#v3.0.1:
11-
image: "python:3.6"
12+
- docker#v3.7.0:
13+
image: python:3.9
1214

1315
- label: "rebuild matrix.org"
1416
trigger: "matrix-dot-org"
1517
async: true
1618
branches: "master"
19+
20+
- label: ":books: Build the spec"
21+
command:
22+
# Install package dependencies
23+
- apk add nodejs npm git hugo
24+
# Install the node dependencies necessary to build the spec
25+
- npm i
26+
# Pull all git submodules, required for the hugo theme
27+
- git submodule update --init --recursive
28+
# Pull current proposal information
29+
- npm run get-proposals
30+
# Build the spec, will build to './spec'
31+
# Set the baseURL as we're deploying to https://spec.matrix.org/unstable
32+
- hugo --baseURL "/unstable" -d "spec"
33+
# Compress the result and make it available as an artifact
34+
- tar -czf spec.tar.gz spec
35+
artifact_paths:
36+
- spec.tar.gz
37+
plugins:
38+
- docker#v3.7.0:
39+
image: alpine

.circleci/config.yml

+19-27
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
gendoc: &gendoc
22
name: Generate the docs
3+
# Note: Node dependencies are required for the hugo build.
4+
# Note: We use a custom config file for circleci due to some specifics with hosting the
5+
# site using CircleCI's artifacts platform. See config-circleci.toml for details.
36
command: |
4-
source /env/bin/activate
5-
scripts/gendoc.py
7+
apk add nodejs npm git hugo
8+
npm i
9+
cat config-circleci.toml config.toml > hugo-config.toml
10+
hugo --config hugo-config.toml --baseURL "/${CIRCLE_NODE_INDEX}/public"
611
712
genswagger: &genswagger
8-
name: Generate the swagger
13+
name: Validate sources and generate swagger json
914
command: |
1015
source /env/bin/activate
16+
scripts/check-swagger-sources.py
1117
scripts/dump-swagger.py
1218
1319
buildswaggerui: &buildswaggerui
@@ -27,36 +33,21 @@ checkexamples: &checkexamples
2733
name: Check Event Examples
2834
command: |
2935
source /env/bin/activate
30-
cd event-schemas
31-
./check_examples.py
32-
cd ../api
33-
./check_examples.py
34-
35-
genmatrixassets: &genmatrixassets
36-
name: Generate/Verify matrix.org assets
37-
command: |
38-
source /env/bin/activate
39-
./scripts/generate-matrix-org-assets
36+
scripts/check-event-schema-examples.py
4037
4138
validateapi: &validateapi
4239
name: Validate OpenAPI specifications
4340
command: |
44-
cd api
41+
cd scripts
4542
npm install
46-
node validator.js -s "client-server"
43+
node validator.js -s "../data/api/client-server"
4744
4845
buildspeculator: &buildspeculator
4946
name: Build Speculator
5047
command: |
5148
cd scripts/speculator
5249
go build -v
5350
54-
buildcontinuserv: &buildcontinuserv
55-
name: Build Continuserv
56-
command: |
57-
cd scripts/continuserv
58-
go build -v
59-
6051
version: 2
6152
jobs:
6253
validate-docs:
@@ -71,18 +62,21 @@ jobs:
7162
steps:
7263
- checkout
7364
- run: *checkexamples
74-
- run: *genmatrixassets # We don't actually use the assets, but we do want to make sure they build
7565
build-docs:
7666
docker:
77-
- image: uhoreg/matrix-doc-build
67+
- image: alpine
7868
steps:
69+
# Note: We install git in the image so we can pull git submodules. The hugo theme in use
70+
# is a git submodule, which has its own submodules, and all need to be loaded.
71+
- run: apk add git
7972
- checkout
73+
- run: git submodule update --init --recursive
8074
- run: *gendoc
8175
- store_artifacts:
82-
path: scripts/gen
76+
path: public
8377
- run:
8478
name: "Doc build is available at:"
85-
command: DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}/scripts/gen/index.html"; echo $DOCS_URL
79+
command: DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/public/index.html"; echo $DOCS_URL
8680
build-swagger:
8781
docker:
8882
- image: uhoreg/matrix-doc-build
@@ -104,8 +98,6 @@ jobs:
10498
name: Install Dependencies
10599
command: |
106100
go get -v github.com/hashicorp/golang-lru
107-
go get -v gopkg.in/fsnotify/fsnotify.v1
108-
- run: *buildcontinuserv
109101
- run: *buildspeculator
110102

111103
workflows:
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Clarity problem
3+
about: Report an area of the spec that is unclear.
4+
title: ''
5+
labels: 'clarification'
6+
assignees: ''
7+
8+
---
9+
10+
**Link to problem area**:
11+
12+
**Issue**
13+
What is wrong? How can we improve?

.github/ISSUE_TEMPLATE/config.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Matrix Spec Discussion
4+
url: "https://matrix.to/#/#matrix-spec:matrix.org"
5+
about: Questions about the spec and proposal process can be asked here.
6+
- name: Matrix Security Policy
7+
url: https://www.matrix.org/security-disclosure-policy/
8+
about: Learn more about our security disclosure policy.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Cosmetic issue
3+
about: Report an issue with how the spec looks.
4+
title: ''
5+
labels: 'aesthetic'
6+
assignees: ''
7+
8+
---
9+
10+
**Link to problem area**:
11+
12+
**Issue**
13+
What is wrong? What can we do to improve?

.github/ISSUE_TEMPLATE/idea.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: Spec idea
3+
about: Suggest a future MSC idea.
4+
title: ''
5+
labels: 'improvement'
6+
assignees: ''
7+
8+
---
9+
10+
**Suggestion**
11+
What would you like to see in Matrix? If your idea is vaguely complete enough, we
12+
recommend submitting [an MSC](https://matrix.org/docs/spec/proposals) instead.

.github/ISSUE_TEMPLATE/spec-bug.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Documentation error
3+
about: Report an issue with the spec itself (incorrect text).
4+
title: ''
5+
labels: 'spec-bug'
6+
assignees: ''
7+
8+
---
9+
10+
**Link to problem area**:
11+
12+
**Issue**
13+
What is wrong?
14+
15+
**Expected behaviour**
16+
How can the issue be fixed? Links to implementations/documents which prove the spec is wrong are appreciated.

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
/api/node_modules
22
/assets
33
/assets.tar.gz
4+
/data/msc
45
/env*
6+
/node_modules
7+
/resources
58
/scripts/gen
69
/scripts/continuserv/continuserv
710
/scripts/speculator/speculator
811
/scripts/swagger
912
/scripts/tmp
1013
/templating/out
14+
/hugo-config.toml
15+
/public
1116
*.pyc
1217
*.swp
1318
_rendered.rst
1419
/.vscode/
1520
/.idea/
21+
/spec/

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "themes/docsy"]
2+
path = themes/docsy
3+
url = https://github.com/matrix-org/docsy.git
4+
branch = master

CONTRIBUTING.rst

+9-7
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ some time to complete.
2929
Changes to the protocol (new endpoints, ideas, etc) need to go through the
3030
`proposals process <https://matrix.org/docs/spec/proposals>`_. Other changes,
3131
such as fixing bugs, typos, or clarifying existing behaviour do not need a proposal.
32-
If you're not sure, visit us at `#matrix-spec:matrix.org`_
33-
and ask.
34-
32+
If you're not sure, visit us at `#matrix-spec:matrix.org`_ and ask.
3533

3634
Other changes
3735
~~~~~~~~~~~~~
@@ -64,12 +62,17 @@ following:
6462
to fix. On the other hand, introducing new behaviour is best represented by a
6563
proposal.
6664

65+
* Design or aesthetic changes, such as improving accessibility, colour schemes,
66+
etc. Please check in with us at `#matrix-docs:matrix.org`_ with your proposed
67+
design change before opening a PR so we can work with you on it.
68+
6769
For such changes, please do just open a `pull request`_. If you're not sure if
6870
your change is covered by the above, please visit `#matrix-spec:matrix.org` and
6971
ask.
7072

7173
.. _`pull request`: https://help.github.com/articles/about-pull-requests
7274
.. _`#matrix-spec:matrix.org`: https://matrix.to/#/#matrix-spec:matrix.org
75+
.. _`#matrix-docs:matrix.org`: https://matrix.to/#/#matrix-docs:matrix.org
7376

7477

7578
Adding to the changelog
@@ -86,8 +89,8 @@ To create a changelog entry, create a file named in the format ``prNumber.type``
8689
the ``newsfragments`` directory. The ``type`` can be one of the following:
8790

8891
* ``new`` - Used when adding new endpoints. Please have the file contents be the
89-
method and route being added, surrounded in RST code tags. For example: ``POST
90-
/accounts/whoami``
92+
method and route being added, surrounded in markdown code tags. For example: \`POST
93+
/accounts/whoami\`.
9194

9295
* ``feature`` - Used when adding backwards-compatible changes to the API.
9396

@@ -100,8 +103,7 @@ the ``newsfragments`` directory. The ``type`` can be one of the following:
100103

101104
All news fragments must have a brief summary explaining the change in the
102105
contents of the file. The summary must end in a full stop to be in line with
103-
the style guide and and formatting must be done using `Restructured Text
104-
<http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_.
106+
the style guide and formatting must be done using Markdown.
105107

106108
Changes that do not change the spec, such as changes to the build script, formatting,
107109
CSS, etc should not get a news fragment.

README.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Matrix Specification
2+
3+
This repository contains the Matrix Specification, rendered at [spec.matrix.org](http://spec.matrix.org/).
4+
5+
Developers looking to use Matrix should join [#matrix-dev:matrix.org](https://matrix.to/#/#matrix-dev:matrix.org)
6+
on Matrix for help.
7+
8+
Spec authors and proposal writers are welcome to join [#matrix-spec:matrix.org](https://matrix.to/#/#matrix-spec:matrix.org).
9+
We welcome contributions! See [CONTRIBUTING.rst](./CONTRIBUTING.rst) for details.
10+
11+
## Structure
12+
13+
The Matrix spec is compiled with [Hugo](https://gohugo.io/) (a static site generator) with the following structure:
14+
15+
* `/assets`: assets that need postprocessing using [Hugo Pipes](https://gohugo.io/hugo-pipes/introduction/).
16+
For example, Sass files would go here.
17+
18+
* `/content`: files that will become pages in the site go here. Typically these are Markdown files with some YAML front
19+
matter indicating, [among other things](https://gohugo.io/content-management/front-matter/), what layout should be
20+
applied to this page. The organization of files under `/content` determines the organization of pages in the built
21+
site.
22+
23+
* `/data`: this can contain TOML, YAML, or JSON files. Files kept here are directly available to template code as
24+
[data objects](https://gohugo.io/templates/data-templates/), so templates don't need to load them from a file and
25+
parse them. This is also where our Swagger/OpenAPI definitions and schemas are.
26+
27+
* `/layouts`: this contains [Hugo templates](https://gohugo.io/templates/). Some templates define the overall layout of
28+
a page: for example, whether it has header, footer, sidebar, and so on.
29+
* `/layouts/partials`: these templates can be called from other templates, so they can be used to factor out
30+
template code that's used in more than one template. An obvious example here is something like a sidebar, where
31+
several different page layouts might all include the sidebar. But also, partial templates can return values: this
32+
means they can be used like functions, that can be called by multiple templates to do some common processing.
33+
* `/layouts/shortcodes`: these templates can be called directly from files in `/content`.
34+
35+
* `/static`: static files which don't need preprocessing. JS or CSS files could live here.
36+
37+
* `/themes`: you can use just Hugo or use it with a theme. Themes primarily provide additional templates, which are
38+
supplied in a `/themes/$theme_name/layouts` directory. You can use a theme but customise it by providing your own
39+
versions of any of the theme layouts in the base `/layouts` directory. That is, if a theme provides
40+
`/themes/$theme_name/layouts/sidebar.html` and you provide `/layouts/sidebar.html`, then your version of the
41+
template will be used.
42+
43+
It also has the following top-level file:
44+
45+
* `config.toml`: site-wide configuration settings. Some of these are built-in and you can add your own. Config settings
46+
defined here are available in templates. All these directories above are configurable via `config.toml` settings.
47+
48+
Additionally, the following directories may be of interest:
49+
50+
* `/attic`: Here contains historical sections of specification and legacy drafts for the specification.
51+
* `/changelogs`: Various bits of changelog for the specification areas.
52+
* `/data-definitions`: Bits of structured data consumable by Matrix implementations.
53+
* `/meta`: Documentation relating to the spec's processes that are otherwise untracked (release instructions, etc).
54+
* `/scripts`: Various scripts for generating the spec and validating its contents.
55+
* `/proposals`: Matrix Spec Change (MSC) proposals. See <https://spec.matrix.org/unstable/proposals/>.
56+
57+
## Authoring changes to the spec
58+
59+
Please read [CONTRIBUTING.rst](./CONTRIBUTING.rst) before authoring a change to the spec. Note that spec authoring takes
60+
place after an MSC has been accepted, not as part of a proposal itself.
61+
62+
1. Install the extended version (often the OS default) of Hugo: <https://gohugo.io/getting-started/installing>
63+
2. Run `git submodule update --init --recursive` for good measure.
64+
3. Run `npm i` to install the dependencies. Note that this will require NodeJS to be installed.
65+
4. Run `npm run get-proposals` to seed proposal data. This is merely for populating the content of the "Spec Change Proposals"
66+
page and is not required.
67+
5. Run `hugo serve` to run a local webserver which builds whenever a file change is detected. If watching doesn't appear
68+
to be working for you, try `hugo serve --disableFastRender` instead.
69+
6. Edit the specification 🙂
70+
71+
We use a highly customized [Docsy](https://www.docsy.dev/) theme for our generated site, which uses Bootstrap and Font
72+
Awesome. If you're looking at making design-related changes to the spec site, please coordinate with us in
73+
[#matrix-docs:matrix.org](https://matrix.to/#/#matrix-docs:matrix.org) before opening a PR.
74+
75+
## Building the specification
76+
77+
If for some reason you're not a CI/CD system and want to render a static version of the spec for yourself, follow the above
78+
steps for authoring changes to the specification and instead of `hugo serve` run `hugo -d "spec"` - this will generate the
79+
spec to `/spec`. If you'd like to serve the spec off a path instead of a domain root (eg: `/unstable`), add `--baseURL "/unstable"`
80+
to the `hugo -d "spec"` command.
81+
82+
For building the swagger definitions, create a python3 virtualenv and activate it. Then run `pip install -r ./scripts/requirements.txt`
83+
and finally `python ./scripts/dump-swagger.py` to generate it to `./scripts/swagger/api-docs.json`. To make use of the generated file,
84+
there are a number of options:
85+
86+
* It can be uploaded from your filesystem to an online editor/viewer such as [on the swagger website](http://editor.swagger.io/).
87+
* You can run a local HTTP server by running `./scripts/swagger-http-server.py`, and then view the documentation via an
88+
online viewer; for example, at <http://petstore.swagger.io/?url=http://localhost:8000/api-docs.json>.
89+
* You can host the swagger UI yourself. See <https://github.com/swagger-api/swagger-ui#how-to-run> for advice on how to
90+
do so.
91+
92+
## Issue tracking
93+
94+
Specification issues are tracked on github at <https://github.com/matrix-org/matrix-doc/issues>.
95+
96+
See [meta/github-labels.rst](./meta/github-labels.rst) for information on what the labels mean.

0 commit comments

Comments
 (0)