how to: gitlab-ci.yml : only/except: changes

Hi

I have a project that takes a very long time to build and where unit testing code is inside the repository.

I want to to create two variants of the pipeline depending on the files that changed:

  1. when source files change, I want to build the code + run unit test.
  2. when ONLY the unit testing code changes, I want to download prebuilt binaries and run the unit testing code with that. There may be no other changes besides test code.

I'm looking for a job constraint that says "only create this job when the only files that changed are in test directory (not when there are any changes outside of /test/*)"

I've tried various combination of only/except changes with globs and RE2 syntax. I've also tried the new rules: introduced in 12.3, but I haven't been able to come up with something that works.

Thank you

Assignee Loading
Time tracking Loading