More GitLab Continuous Integration

How to trigger CI only when source code changes.

More GitLab Continuous Integration

I have been tuning .gitlab-ci.yml of my project with CI pipeline.  Writing code is infinitely interesting than figuring out continuous integration configuration, so my project has been limping along.  Many failed pipeline later (because my GitLab instance doesn't understand rules keyword, bad runner configurations and behavior from failed unit tests, etc.), I have settled into something that works.

One of the recent improvements has been to only trigger pipeline for build and test on certain files, seems worth remembering and sharing.  This is the addition responsible for that:

  only:
    refs:
      - master
    changes:
      - "**/*.c"
      - "**/*.cpp"
      - "**/*.h"
      - "**/*.hpp"
      - "**/*.cmake"
      - "CMakeLists.txt"

Commits to master that adds or changes a file ending in one of those extensions, or changes to CMake configuration will trigger CI pipeline.

Reference