Filter workflow steps depending on file changes #5721
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
Fixes #5720
This is an optimization on the CI workflow
ci.yml
. By filtering some steps based on file changes we can reduce the workflow execution time.For Example: If only a javascript file is changed then there is no need to run Ruby tests.
Changes
Current
file-filters.yml
contents are:Here a backend filter is defined. The codebase has ruby files everywhere so I have defined the backend is everything other than frontend code,
.github
andtraining_content
. The more definite this list will be the better it is. Let me know any other paths that needed to be defined here. (One can be all the markdowns*.md
)Ruby tests that took 30 mins will be skipped on all these folders. I have taken inspiration from how sentry repository used this.
I have tested the workflow on my fork at this branch.
Here are some examples of successful workflows:
On Push -> https://github.com/prathamVaidya/WikiEduDashboard/actions/runs/8403231749
On Pull Request -> https://github.com/prathamVaidya/WikiEduDashboard/actions/runs/8403275731 (It failed because it ran flaky RSpecs which it should have because there was a modified ruby file)
@ragesoss Let me know if there is a breaking change associated with this feature. Especially on my assumption that the files in
training_content
,app/assets
do not affect the ruby tests.