gitlab-ci: DAG pipeline and job ordering
This MR transforms the CI pipeline to a DAG pipeline, enabling parallel execution of jobs on different runners. To better group the jobs, it further assigns them to the default stages and re-orders them to group them together by stage name. Since it is a DAG pipeline, short jobs like formatting checks can be run while the project is being built and are thus not slowed down by adding them to the test stage.
The inter-jobs dependencies require checking by a maintainer, since I only guessed based on my experience.