Sign in Join
Wiki copytemporary

Lazarus Team - Git Workflows: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11This page contains workflows for Lazarus team members, when working with GIT.
22
33# git pull --rebase
44
55Commits made by team members should have a linear history
66
77If you have local commits to push, and the remote branch has new commits too, then use **rebase**. Do not create any merge commits.
88
9-`   git pull --rebase`
9+```text
10+ git pull --rebase
11+```
1012
1113or
1214
13-`   git rebase`
15+```text
16+ git rebase
17+```
1418
1519------------------------------------------------------------------------
1620
1721See also [[SVN to GIT Cheatsheet|SVN_to_GIT_Cheatsheet#Recommended]]
1822
1923# Merge Requests / Pull Requests
2024
2125Merge requests should be included by creating a merge commit
2226
23-`   git merge merge-request/foo`
27+```text
28+ git merge merge-request/foo
29+```
2430
2531> **Note:** To pull merger request to your local git: <https://docs.gitlab.com/ee/user/project/merge_requests/reviews/#checkout-locally-by-modifying-gitconfig-for-a-given-repository>
2632
2733----
2834
2935Merge-requests can be (optionally / recommended, if the fork-point is way back) rebased first. Within the gitlab merge-request website, this can be done adding a comment
3036
31-`   /rebase`
37+```text
38+ /rebase
39+```
3240
3341# Cherry picking / Merging
3442
3543Do not "squash" commits when cherry picking.
3644
3745If commits are squashed, then ["git cherry"](https://git-scm.com/docs/git-cherry) wont work.
3846
3947Use
4048
41-`   git cherry pick -x`
49+```text
50+ git cherry pick -x
51+```
4252
4353The "-x" adds "cherry picked from commit"
4454
4555# ".gitattributes" - Adding new file extensions
4656
4757> **Warning:** Adding new extensions can have unwanted side effects on existing file.
4858
4959If you add files with an new extension (not yet covered by .gitattributes) then it is best to add that extension (or the concrete file)
5060
5161Files not covered by .gitattributes will be left to git figuring out on its own, if they are text. Since this affects line endings, it is best to tell git, what we want the file to be.
5262
5363After editing .gitattributes you must run (before committing):
5464
55-`   git add --renormalize .`
65+```text
66+ git add --renormalize .
67+```
5668
5769Then check **git status** which files were affected.
5870
5971# Issue Tracker
6072
6173## Milestone
6274
6375When closing an issue, ensure to set the correct milestone.
6476
6577If the issues is (or will be) merged to a fixes branch, set the milestone for the fixes release. (If the merge later fails, the milestone must be amended).
6678
6779If you do not merge (cherry pick) yourself:
6880
6981- leave the issue open
7082- Set the fixes milestone
7183- add the label
7284
7385
7486
7587merge::merge-and-close
7688
7789# Continuous integration (CI) System
7890
7991On every commit and every update to merge requests continuous integration (CI) system creates a pipeline, which builds Lazarus for several platforms/widgetsets. If the build fails, it notifies the creator of commit which caused the failure.
8092
8193The building process happens in a virtual machine (Docker container), which loads an operating system image. Our image is based on Debian 12 x86_64 and at the time of writing this section contains:
8294
8395- GTK2, GTK3, Qt5, Qt6 libraries;
8496- FPC (versions 3.2.0 \[oldstable\], 3.2.2 \[stable\], 3.2.3 \[fixes\], 3.3.1 \[main\]) for the following targets:
8597 - x86_64-linux;
8698 - x86_64-win64 (cross-compiler);
8799 - i386-win32 (cross-compiler);
88100- Pas2JS compiler (Git snapshot, compiled with FPC main compiler/sources).
89101
90102Docker image configuration is defined in *buildenv.Dockerfile* file, and pipeline configuration is defined in *.gitlab-ci.yml* (both files are located in Lazarus root directory).
91103
92104At the time of writing this section our pipeline consists of four stages:
93105
941061. Update our Docker image (see above). This process can be triggered manually in **Build**-\>**Pipelines** page by running **update-build-env** job of the first manual stage of the most recent pipeline belonging to *main* branch (rebuilding process takes ~23 min). It should be run in the following cases:
95107 1. When there is a desire to simply update FPC fixes and main snapshots. It is safe if FPC versions haven't changed in the meantime (in rare cases rebuilding process (FPC snapshots compilation) may fail, re-run the job in this case). It is enough to just run the job (no variables need to be defined), the image will be updated automatically and will include FPC snapshots at the time of rebuilding of image.
96108 2. When *buildenv.Dockerfile* and/or FPC version constants in *.gitlab-ci.yml* file have been changed. **Do with care!**
971092. Clear Qt5Pas/Qt6Pas bindings caches if (and only if) any file in bindings is changed. Reasons to keep this stage separate from updating Qt5Pas/Qt6Pas bindings:
98110 1. Cache actually contains all files from bindings directory (both source and object ones) and is extracted after checkout, so it overwrites checked out sources, and thus prevents correct cache update if not cleared appropriately.
99111 2. Sources should be kept in cache, as removing them will cause bindings to be always recompiled (both in bindings and IDE compile jobs). It takes long time and thus undesirable.
100112 3. Simply doing full cache rebuild if any file in bindings is changed is not enough as this job will not be triggered e. g. for a new merge request (if it does not modify bindings) and will cause IDE compile jobs for it to fail. GitLab CI currently does not support conditions for triggering a job if a cache is missing.
1011133. Update Qt5Pas/Qt6Pas bindings and cache results of these jobs. They are required for subsequent building of Lazarus with Qt5 and Qt6 widgetsets. This is needed because building both Qt5 and Qt6 bindings takes a long time (~25 min) and they are rarely changed.
1021144. Build Lazarus for various widgetsets/platforms. The following jobs for building Lazarus are defined:
103115 - x86_64-gtk2 bigide (oldstable, stable, fixes, main FPC);
104116 - x86_64-gtk3 bigide (oldstable, stable FPC);
105117 - x86_64-qt5 bigide (oldstable, stable FPC);
106118 - x86_64-qt6 bigide (oldstable, stable FPC);
107119 - x86_64-win64 bigide (oldstable, stable FPC);
108120 - i386-win32 bigide (oldstable, stable, fixes, main FPC);
109121 - Documentation (stable, fixes, main FPDoc);
110122 - Tests for Codetools (main FPC).
111123
112124At the time of writing this section the following jobs for building Lazarus run automatically on every commit:
113125
114126- x86_64-gtk2 bigide (stable FPC);
115127- x86_64-gtk3 bigide (stable FPC);
116128- x86_64-qt5 bigide (oldstable FPC);
117129- x86_64-qt6 bigide (stable FPC);
118130- i386-win32 bigide (stable FPC);
119131- Tests for Codetools (main FPC).
120132
121133All others can be triggered manually via GitLab web interface.
122134
123135In GitLab web interface you can notice **Build** menu item at the left. By clicking **Build**-\>**Pipelines** you will get to pipelines list, where you can see build status for each commit. By clicking circles in the **Stages** column you will get to submenus which will show status of all jobs and will allow to run/rerun them manually (by clicking at **play**/**retry** button) and to look at job's log (by clicking at job's name).
124136
125137Important notice for Qt5/Qt6 jobs:
126138
127139They use cached results from stage 3. In absolute majority of the builds this should not cause any problems. But still if stage 3 does not pass or if you get Qt5/Qt6 widgetset build failure related to Qt5Pas/Qt6Pas version mismatch or missing cache, make sure to go to the **Pipelines** page and do the following:
128140
1291411. Stop the currently running pipeline if needed.
1301422. Press **Run pipeline** button (you will be asked about defining variables, just skip this step (we don't use them) and confirm running pipeline).
1311433. In case pipeline failed to pass, press **Clear runner caches** button and then rerun pipeline by pressing **Run pipeline** button again.
132144
133145---
134146*From the Free Pascal wiki, page "Lazarus Team - Git Workflows", as it stood on 2023-11-22 after a change by Maxim, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
135147Category: Lazarus
136148Category: Revision control
137149Category: SOPs

Back to history