| 1 |
Development workflow |
| 2 |
==================== |
| 3 |
|
| 4 |
Brian development is done in a `git`_ repository on `github`_. Continuous |
| 5 |
integration testing is provided by `GitHub Actions`_, code coverage is measured with |
| 6 |
`coveralls.io`_. |
| 7 |
|
| 8 |
.. _git: https://git-scm.com/ |
| 9 |
.. _github: https://github.com/ |
| 10 |
.. _`GitHub Actions`: https://github.com/features/actions |
| 11 |
.. _`coveralls.io`: https://coveralls.io/ |
| 12 |
|
| 13 |
The repository structure |
| 14 |
------------------------ |
| 15 |
Brian's repository structure is very simple, as we are normally not supporting |
| 16 |
older versions with bugfixes or other complicated things. The *master* branch of |
| 17 |
the repository is the basis for releases, a release is nothing more than adding |
| 18 |
a tag to the branch, creating the tarball, etc. The *master* branch should |
| 19 |
always be in a deployable state, i.e. one should be able to use it as the base |
| 20 |
for everyday work without worrying about random breakages due to updates. To |
| 21 |
ensure this, no commit ever goes into the *master* branch without passing the |
| 22 |
test suite before (see below). The only exception to this rule is if a commit |
| 23 |
not touches any code files, e.g. additions to the README file or to the |
| 24 |
documentation (but even in this case, care should be taken that the |
| 25 |
documentation is still built correctly). |
| 26 |
|
| 27 |
For every feature that a developer works on, a new branch should be opened |
| 28 |
(normally based on the *master* branch), with a descriptive name (e.g. |
| 29 |
``add-numba-support``). For developers that are members of "brian-team", the |
| 30 |
branch should ideally be created in the main repository. This way, one can |
| 31 |
easily get an overview over what the "core team" is currently working on. |
| 32 |
Developers who are not members of the team should fork the repository and work |
| 33 |
in their own repository (if working on multiple issues/features, also using |
| 34 |
branches). |
| 35 |
|
| 36 |
Implementing a feature/fixing a bug |
| 37 |
----------------------------------- |
| 38 |
Every new feature or bug fix should be done in a dedicated branch and have |
| 39 |
an issue in the issue database. For bugs, it is important to not only fix the |
| 40 |
bug but also to introduce a new test case (see :doc:`testing`) that makes sure |
| 41 |
that the bug will not ever be reintroduced by other changes. It is often a good |
| 42 |
idea to first define the test cases (that should fail) and then work on the fix |
| 43 |
so that the tests pass. As soon as the feature/fix is complete *or* as soon as |
| 44 |
specific feedback on the code is needed, open a "pull request" to merge the |
| 45 |
changes from your branch into *master*. In this pull request, others can comment |
| 46 |
on the code and make suggestions for improvements. New commits to the respective |
| 47 |
branch automatically appear in the pull request which makes it a great tool for |
| 48 |
iterative code review. Even more useful, GitHub Actions will automatically run the test |
| 49 |
suite on the result of the merge. As a reviewer, always wait for the result of |
| 50 |
this test (it can take up to 30 minutes or so until it appears) before doing |
| 51 |
the merge and never merge when a test fails. As soon as the reviewer (someone |
| 52 |
from the core team and not the author of the feature/fix) decides that the |
| 53 |
branch is ready to merge, he/she can merge the pull request and optionally |
| 54 |
delete the corresponding branch (but it will be hidden by default, anyway). |
| 55 |
|
| 56 |
Useful links |
| 57 |
------------ |
| 58 |
* The Brian repository: https://github.com/brian-team/brian2 |
| 59 |
* GitHub Actions tests for Brian: https://github.com/brian-team/brian2/actions |
| 60 |
* Code Coverage for Brian: https://coveralls.io/github/brian-team/brian2 |
| 61 |
* The Pro Git book: https://git-scm.com/book/en/v2 |
| 62 |
* github's documentation on pull requests: https://help.github.com/articles/using-pull-requests |