Skip to content

Commit 00858ee

Browse files
committed
docs: add contributing guide
Port the contributing guide from the Django-based project and rewrite it for Go. Cover coding standards, building, testing, commit message conventions, documentation, release notes and patch submission. Link to the live docs from the README. Signed-off-by: Robin Jarry <robin@jarry.cc>
1 parent 6e4ce06 commit 00858ee

4 files changed

Lines changed: 169 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ The web interface is now available at http://127.0.0.1:8080 and the SMTP
5151
ingress daemon listens on 127.0.0.1:2525.
5252

5353
For production deployment with systemd, nginx and Postfix, see the
54-
[deployment guide](docs/deployment/installation.rst).
54+
[full documentation](https://getpatchwork.github.io/patchwork-next/).

docs/development/contributing.rst

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
.. Patchwork - automated patch tracking system
2+
.. Copyright (C) The Patchwork Contributors (see CONTRIBUTORS)
3+
..
4+
.. SPDX-License-Identifier: GPL-2.0-or-later
5+
6+
Contributing
7+
============
8+
9+
Coding Standards
10+
----------------
11+
12+
All Go code must pass ``make lint`` which runs goimports-reviser, gofumpt and
13+
golangci-lint. Running ``make format`` will auto-fix most formatting issues.
14+
15+
All code must be licensed using `GPL v2.0 or later`_ and must have a `SPDX
16+
License Identifier`_ stating this. A copyright line should be included on new
17+
files:
18+
19+
.. code-block:: go
20+
21+
// Patchwork - automated patch tracking system
22+
// Copyright (C) The Patchwork Contributors (see CONTRIBUTORS)
23+
//
24+
// SPDX-License-Identifier: GPL-2.0-or-later
25+
26+
.. _GPL v2.0 or later: https://spdx.org/licenses/GPL-2.0-or-later.html
27+
.. _SPDX License Identifier: https://spdx.org/using-spdx-license-identifier
28+
29+
30+
Building
31+
--------
32+
33+
Building requires a Go toolchain (see ``go.mod`` for the minimum version):
34+
35+
.. code-block:: console
36+
37+
$ make
38+
39+
This runs ``go generate`` (for templ templates) then ``go build``. The
40+
resulting binary is ``./pw``.
41+
42+
43+
Testing
44+
-------
45+
46+
Run the test suite:
47+
48+
.. code-block:: console
49+
50+
$ make test
51+
52+
Tests use in-memory SQLite databases, so no external database is required.
53+
54+
55+
Getting Started
56+
---------------
57+
58+
After cloning the repository, run ``make git-config`` to set up your local
59+
clone with sensible defaults (subject prefix for ``git format-patch``,
60+
``sendemail.to`` address, and a commit message hook):
61+
62+
.. code-block:: console
63+
64+
$ make git-config
65+
git config format.subjectPrefix "PATCH patchwork"
66+
git config sendemail.to "patchwork@lists.ozlabs.org"
67+
ln -s ../../devtools/commit-msg .git/hooks/commit-msg
68+
69+
Commit Messages
70+
---------------
71+
72+
Follow the Linux kernel commit message conventions. In particular:
73+
74+
- Use a ``component:`` prefix derived from the files changed (look at
75+
``git log --oneline`` for examples).
76+
- Imperative mood, lowercase after the prefix, no trailing period.
77+
- Hard wrap the body at 72 columns.
78+
- Explain *why*, not *what*.
79+
- Include a ``Signed-off-by`` trailer.
80+
81+
Patches should be checked with ``make check-patches`` before submission.
82+
83+
84+
Documentation
85+
-------------
86+
87+
Documentation is authored in `reStructuredText`_ and built with `Sphinx`_.
88+
To build the docs locally:
89+
90+
.. code-block:: console
91+
92+
$ make docs
93+
94+
The output is in ``docs/_build/``. The live documentation is published at
95+
https://getpatchwork.github.io/patchwork-next/.
96+
97+
.. _reStructuredText: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
98+
.. _Sphinx: https://www.sphinx-doc.org/en/master/
99+
100+
101+
Release Notes
102+
-------------
103+
104+
Patchwork uses `reno`_ for release note management. To create a new release
105+
note:
106+
107+
.. code-block:: console
108+
109+
$ pip install reno
110+
$ reno new <slugified-summary-of-change>
111+
112+
Edit the created file under ``releasenotes/notes/``, removing irrelevant
113+
sections, and include it in your change.
114+
115+
.. _reno: https://docs.openstack.org/developer/reno/
116+
117+
118+
Reporting Issues
119+
----------------
120+
121+
Issues can be reported to the `mailing list`_ or the `GitHub issue tracker`_.
122+
123+
.. _GitHub issue tracker: https://github.com/getpatchwork/patchwork
124+
125+
126+
Submitting Changes
127+
------------------
128+
129+
All patches should be sent to the `mailing list`_. You must be subscribed to
130+
the list in order to submit patches. Patches should be submitted using
131+
``git send-email``.
132+
133+
Before submitting, ensure:
134+
135+
- All tests pass (``make test``).
136+
- The linter is happy (``make lint``).
137+
- Commit messages pass validation (``make check-patches``).
138+
- Documentation has been updated if needed.
139+
- A release note is included for user-visible changes.
140+
141+
142+
.. _mailing-lists:
143+
144+
Mailing List
145+
------------
146+
147+
Patchwork uses a single mailing list for development, questions and
148+
announcements:
149+
150+
patchwork@lists.ozlabs.org
151+
152+
Further information is available on `lists.ozlabs.org`_.
153+
154+
.. _mailing list: https://lists.ozlabs.org/listinfo/patchwork
155+
.. _lists.ozlabs.org: https://lists.ozlabs.org/listinfo/patchwork

docs/development/index.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.. Patchwork - automated patch tracking system
2+
.. Copyright (C) The Patchwork Contributors (see CONTRIBUTORS)
3+
..
4+
.. SPDX-License-Identifier: GPL-2.0-or-later
5+
6+
Development
7+
===========
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
12+
contributing

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ Patchwork -- |release|
1212
usage/index
1313
deployment/index
1414
api/index
15+
development/index
1516
releases/index

0 commit comments

Comments
 (0)