workflow.md 7.28 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# Workflow

This toolkit is maintained in a GitLab group,
hosted on the [M4Lab's][m4lab] [Transfer-Portal][tr-portal] [GitLab instance][tr-gitlab].  
Source code for for each part is managed in its own repo in this group.

This page tells you for the different parts of this project,
how to do it.  
The following applies project wide:

- language is english (code, comments, documentation, tickets, discussion,...)

## Git/GitLab

!!! danger "disclaimer"
    There are a few rules any developer HAS to follow,
    in order to get _any_ chance his merge-requests will be accepted.

This project is managed using Git, hosted on the universities GitLab instance.

### Issues/Merge Requests handling

Project management happens in the individual GitLab repositories issue board.

First of all, make sure for everything you do a ticket exists.
Extending this, also check regularly your tickets are:

- assigned to you
- are in the correct column

There are three columns as of writing this documentation: `To Do`, `Doing` and `review`.  
Planning something, a new ticket get's created and placed into the `To Do` column.

If you start to work on this ticket

- move it to `Doing`
- create a new feature branch from the master
    - named like: `<ticket-id>-<some-descriptive-name>`
- push the new branch
- create a new merge request
    - title starting with `wip: `
    - description containing `closes #<ticket-id>`
    - assign it to you (even if you're not able to merge)
- start working

After implementing your change

- move your ticket to `review` column
- change your merge requests labels: remove `Doing` and add `review`
- change assignee to someone to review your work

### Branch Names

Branches should always start with the number of the related ticket, followed by a dash.
This way the branch get's automatically shown in the ticket.

### Committing

!!! tip "golden rules"
    - __many small__ > ~~few big~~ commits
    - unrelated changes in separate commit

We encourage everyone to make heavy use of `git status` and `git diff`.
Please always check before committing, what exactly you have changed.  
What we won't accept:

- whole file content removed and added back  
    This most likely happens if you make great use of auto format,
    messing everything up.
    Another one error source is something changed line endings.
- empty lines containing spaces, or trailing spaces on line end (without technical reason)  
    No big deal to fix, but time waste if we have to block your MR because of this.
- multiple changes in one commit, that have nothing to do with each other  
    Great you have fixed a typo in a comment at the other end of the file.
    What do you think happens, if five people fix the same typo in their commits?
    We would have four merge conflicts, needing manual work to fix this mess.
    So create a new ticket for what you found,
    instead of just doing it as it doesn't hurt.
    It hurts, trust me.
- commit messages not following conventional commits specification

!!! tip "view diff of not yet tracked files"
    If you want to check a new file for flaws, sure `git diff` doesn't show anything.
    But you can add the file and before committing check with `git diff --cached`.

!!! tip "add only parts of changes in a file"
    As we want to have more small commits, than one single big one,
    it can be useful to split your changes into multiple commits,
    even inside the same file.  
    You can use `git add -p [path|file]`.
    This allows you to exactly decide which lines of your changes should be staged
    , before committing.

#### Commit Messages

We use the [conventional commits][conv-comm] specification in this repository,
to auto generate a changelog with [conventional-changelog][conv-change].

### Protected Branches/Tags

The repository has the master branch and release tags (format `^[0-9]+\.[0-9]+\.[0-9]+$`)
protected to project maintainers.

### Branching-Model

We use a branch per feature based branching model.
Base and target to merge is always latest `master`.

## Development

First step before changing the source code,
would be to check if there's something going on yet,
or this topic possibly was discussed yet and abandoned for some reason.
For this, check the [defined GitLab workflow](#gitgitlab).

If not, make sure your machine is setup according to the [setup guide][setup-guide].

### Change/Create an existing/new functionality

- make your changes
- make sure all unittests still pass
- commit your changes following the [Git/GitLab](#gitgitlab) workflow defined.

## Documentation

Documentation for the toolkit is done entirely in Markdown
and rendered through MkDocs to a Website.
Each repository global `README.md` just points to the deployed documentation.
The same applies for the `CONTRIBUTING.md`.  
`CHANGELOG.md` and `LICENSE.md` are kept additionally directly in each repo.

With the aim to give the documentation an appealing appearance,
additional to the default markdown specification,
a few extensions are enabled in the mkdocs config.  
Please have a look at them and make use of,
where it seems adequate.
Reference for them can be found in the [MkDocs-Material site][mat-mkdocs-ext-ref].

To make any kind of diagram, sketch or similar,
use [PlantUML][puml].
You have to surround the PlantUML code with code fences,
marked as `plantuml` as language identifier.
Then they will be rendered into an svg on pages creation.

Example:

=== "code"
    ``````
    ```plantuml
    queue "write\nmarkdown" as write
    queue "commit/push/\nmerge changes" as update
    queue "pipeline\ntriggered" as cicd
    queue "MkDocs\nMaterial" as MkDocsMat
    queue "transpiled HTML\nonline" as deployed

    write -right-> update
    update -right-> cicd
    cicd -right-> MkDocsMat
    MkDocsMat -right-> deployed
    ```
    ``````

=== "result"
    ```plantuml
    queue "write\nmarkdown" as write
    queue "commit/push/\nmerge changes" as update
    queue "pipeline\ntriggered" as cicd
    queue "MkDocs\nMaterial" as MkDocsMat
    queue "transpiled HTML\nonline" as deployed

    write -right-> update
    update -right-> cicd
    cicd -right-> MkDocsMat
    MkDocsMat -right-> deployed
    ```

## Schedule a release

For releases this project uses [standard-version][std-ver].
This generates an automatic changelog based on the commits
and tags it.
The version of the library has three numbers
and has to follow the [semantic-version][semver] scheme.

Tags marking a release have the format `^[0-9]+\.[0-9]+\.[0-9]+$`.
Pushing these tags is restricted in the GitLab Repo settings
for maintainers only.  
Pushing a release tag triggers the CI/CD release pipeline for the maven project.

## CI/CD

This toolkit uses CI pipelines for

- publishing backend server and runner docker images to DockerHub
- deploying this pages-documentation

[conv-comm]: https://www.conventionalcommits.org/en/v1.0.0/
[conv-change]: https://github.com/conventional-changelog/conventional-changelog
[m4lab]: https://www.hft-stuttgart.de/forschung/innovative-hochschule-m4-lab
[mat-mkdocs-ext-ref]: https://squidfunk.github.io/mkdocs-material/reference/abbreviations/
[puml]: https://plantuml.com/
[setup-guide]: /contribute/machine-setup.html
[semver]: https://semver.org/
[std-ver]: https://github.com/conventional-changelog/standard-version
[tr-gitlab]: https://transfer.hft-stuttgart.de/gitlab/explore/projects
[tr-portal]: https://transfer.hft-stuttgart.de/