TP #2 : Pipelines gitlab

Setting up a GitLab Project

  • Create a new project in GitLab.
  • Clone the project to your local machine.
  • Navigate to the project directory in the terminal.
  • Create a basic project structure with some C source code files (you can reuse the code from the previous TP).

Writing a Simple Pipeline

  • Create a .gitlab-ci.yml file in the project’s root directory.
  • Define a basic pipeline that consists of two stages: build and test.
  • Configure the build stage to compile the C source code files.
  • Configure the test stage to execute automated tests on the compiled project.
  • Commit and push the .gitlab-ci.yml file to trigger the pipeline execution.

Adding Stages

  • Define a lint stage in the .gitlab-ci.yml file.
  • Configure the lint stage to lint your source code using clang-format
  • Commit and push the changes to trigger the pipeline execution and verify that the code is linted.
  • Define a cov stage that computes the code coverage after the tests (see TP 1).
  • Create or update a Readme.md that includes the pipeline status and the code coverage badges (see https://docs.gitlab.com/ee/user/project/badges.html).

Adding Additional Pipeline Features

  • Explore and add additional pipeline features, such as:
    • Caching dependencies for faster builds.
    • Environment variables for secure configuration.
    • Notifications and alerts on pipeline status.
    • Integration with external tools, such as code quality (clang-tidy, ccpcheck…)