You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
a17023962c
This PR attempts to update the CI of matrix-doc to build [the new spec redesign](https://github.com/matrix-org/matrix-doc/issues/2906). It does so by additionally building the new spec in parallel to the old. The plan is to continue to host the old spec at https://matrix.org/docs/spec, while the new spec will be at https://spec.matrix.org. Eventually we will retire the old version of the spec, and have the old URL redirect to the new one. In detail, this PR: * Adds a new step to CircleCI to build the new spec with `hugo`. This step uses alpine, grabs some dependencies, and then builds the HTML. * We needed to hand some specific options to hugo for CircleCI in order to continue allowing CircleCI to host temporary builds of the spec after each CI run. This required changing some assumptions related to relative paths. * CircleCI's artifacts hosting is also quite limited. Specifically it will not automatically resolve `/some/path` to `/some/path/index.html`, which our hugo theme relied on. Fixes were implemented for this, but we may want to consider switching away from CircleCI artifacts as a host, and using something like [netlify](https://www.netlify.com/) instead. * Modifies the existing Buildkite pipeline step to build both the new spec in a separate step. It additionally modifies the old spec to be built with alpine. (Separate out into another PR) * We'd like to separate out the deployment of matrix.org from the new spec. Therefore a new step, with a separate artifact build (`spec.tar.gz`). We will eventually remove the old step and the matrix.org build trigger. * Modifies `pyproject.toml` to update the config of [giles](https://github.com/OpenAstronomy/baldrick/blob/master/baldrick/plugins/circleci_artifacts.py), which is what creates the "docs", "swagger" links in the CI steps for matrix-docs PRs. * A new step was added for the new spec. The old spec was renamed to "legacy". |
3 years ago | |
---|---|---|
.buildkite | 3 years ago | |
.circleci | 3 years ago | |
.github | 3 years ago | |
assets-hugo | 3 years ago | |
attic | 9 years ago | |
changelogs | 4 years ago | |
content | 3 years ago | |
data | 3 years ago | |
data-definitions | 4 years ago | |
drafts | 6 years ago | |
layouts | 3 years ago | |
meta | 4 years ago | |
proposals | 4 years ago | |
scripts | 3 years ago | |
specification | 4 years ago | |
static | 4 years ago | |
themes | 4 years ago | |
.gitignore | 3 years ago | |
.gitmodules | 4 years ago | |
CONTRIBUTING.rst | 5 years ago | |
LICENSE | 8 years ago | |
README.rst | 5 years ago | |
config-circleci.toml | 3 years ago | |
config.toml | 4 years ago | |
openapi_extensions.md | 3 years ago | |
package-lock.json | 3 years ago | |
package.json | 3 years ago | |
pyproject.toml | 3 years ago |
README.rst
This repository contains the Matrix specification. If you want to ask more about the specification, join us on `#matrix-dev:matrix.org <http://matrix.to/#/#matrix-dev:matrix.org>`_. We welcome contributions to the spec! See the notes below on `Building the specification`_, and `<CONTRIBUTING.rst>`_ to get started making contributions. Note that the Matrix Project lists, which were previously kept in this repository, are now in https://github.com/matrix-org/matrix.org. Structure of this repository ============================ - ``api`` : `OpenAPI`_ (swagger) specifications for the the HTTP APIs. - ``attic``: historical sections of specification for reference purposes. - ``changelogs``: change logs for the various parts of the specification. - ``drafts``: Previously, contained documents which were under discussion for future incusion into the specification and/or supporting documentation. This is now historical, as we use separate discussion documents (see `<CONTRIBUTING.rst>`_). - ``event-schemas``: the `JSON Schema`_ for all Matrix events contained in the specification, along with example JSON files. - ``meta``: documents outlining the processes involved when writing documents, e.g. documentation style, guidelines. - ``scripts``: scripts to generate formatted versions of the documentation, typically HTML. - ``specification``: the specification split up into sections. .. _OpenAPI: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md .. _JSON Schema: http://json-schema.org/ Building the specification ========================== The Matrix Spec is generated by a set of scripts, from the RST documents, API specs and event schemas in this repository. Preparation ----------- To use the scripts, it is best to create a Python 3.4+ virtualenv as follows:: virtualenv -p python3 env env/bin/pip install -r scripts/requirements.txt (Benjamin Saunders has contributed a script for `Nix`_ users, which can be invoked with ``nix-shell scripts/contrib/shell.nix``.) .. TODO: Possibly we need some libs installed; should record what they are. .. _`Nix`: https://nixos.org/nix/ Generating the specification ---------------------------- To rebuild the specification, use ``scripts/gendoc.py``:: source env/bin/activate ./scripts/gendoc.py The above will write the rendered version of the specification to ``scripts/gen``. To view it, point your browser at ``scripts/gen/index.html``. Windows users ~~~~~~~~~~~~~ The ``source`` program does not exist on Windows, so instead run one of the ``activate`` files in ``.\env\Scripts\`` to activate the virtual environment. If you're on Windows Vista or higher, be sure that the "Symbolic Links" option was selected when installing Git prior to cloning this repository. If you're still seeing errors about files not being found it is likely because the symlink at ``api/client-server/definitions/event-schemas`` looks like a file. To correct the problem, open an Administrative/Elevated Command Prompt in your cloned matrix-doc directory and run the following:: cd api\client-server\definitions del event-schemas mklink /D event-schemas "..\..\..\event-schemas" This will delete the file and replace it with a symlink. Git should not detect this as a change, and you should be able to go back to building the project. Generating the OpenAPI (Swagger) specs -------------------------------------- `Swagger`_ is a framework for representing RESTful APIs. We use it to generate interactive documentation for our APIs. Before the Swagger docs can be used in the Swagger UI (or other tool expecting a Swagger specs, they must be combined into a single json file. This can be done as follows:: source env/bin/activate ./scripts/dump-swagger.py By default, ``dump-swagger`` will write to ``scripts/swagger/api-docs.json``. To make use of the generated file, there are a number of options: * It can be uploaded from your filesystem to an online editor/viewer such as http://editor.swagger.io/ * You can run a local HTTP server by running ``./scripts/swagger-http-server.py``, and then view the documentation via an online viewer; for example, at http://petstore.swagger.io/?url=http://localhost:8000/api-docs.json * You can host the swagger UI yourself. See https://github.com/swagger-api/swagger-ui#how-to-run for advice on how to do so. .. _`Swagger`: http://swagger.io/ Continuserv ----------- Continuserv is a script which will rebuild the specification every time a file is changed, and will serve it to a browser over HTTP. It is intended for use by specification authors, so that they can quickly see the effects of their changes. It is written in Go, so you will need the ``go`` compiler installed on your computer. You will also need to install fsnotify by running:: go get gopkg.in/fsnotify/fsnotify.v1 Then, create a virtualenv as described above under `Preparation`_, and:: source env/bin/activate go run ./scripts/continuserv/main.go You will then be able to view the generated spec by visiting http://localhost:8000/index.html. Issue tracking ============== Issues with the Matrix specification are tracked in `GitHub <https://github.com/matrix-org/matrix-doc/issues>`_. See `meta/github-labels.rst <meta/github-labels.rst>`_ for notes on what the labels mean.