Diff selection is a key way to save time within your runs. It leverages the diffs in your changes to determine what tests need to be run, omitting testing changes that would otherwise pass and waste time and resources. Diff selection is only utilized on incoming pull requests.
Two major points about diff selection:
- It is completely optional. If you do not wish to use diff selection, simply
do not put
task.ymlfiles in subdirectories in your tree. If you keep only one
task.ymlat the root, diff selection will always resolve to that file. Everything else will function unabated, including parallel runs.
- Master always runs a full, uninterruptible test on any push to it. This ensures your master is tested appropriately.
How Diff Selection works
Let's say you have a tree of files:
foo/ task.yml source_code.go bar/ baz/ task.yml source_code.go source_code.go task.yml main.go
Let's examine it for a minute. In there we have
task.yml at the root. This will be keys for the diff
selection algorithm. Inside of each task.yml is repository configuration
relating to the runs triggered by modifying code in that directory or beneath
it. The search happens from the diff's perspective, back through dirs towards
the root; stopping at the first found
So, if you provide a diff that contains these files:
Then the following
task.yml's would be triggered:
bar/baz/task.yml, as that would be technically unrelated. If someone
added a change that affected that directory, or a subdirectory of it, then it
Using the task.yml property
dependencies can go far with dirs that depend on a swath of other things
working as well.
For example, our own tinyCI
datasvc agent has database routines stuffed in
model/. In this
case, we need to test our services any time the model is also affected.
So, in our model/task.yml you can see that we've added dependencies to those services which transitively depend on changes to this package.