-
|
I have a monorepo with multiple projects. Let’s assume each uses python and has tests in pytest. If any of the py files in a python project has changed, i want to run pytest for that project. AND If there are python projects with zero changed python files, i don't want to run pytest for that project. Is there a clean lefthook abstraction to handle this scenario? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hey! Good question. I think you can use a few approaches:
For the first approach I think you can have something like this: # lefthook.yml
pre-commit:
jobs:
- name: pytest
glob: "*.py"
group:
parallel: true
jobs:
- root: 'subfolder1'
run: pytest
- root: 'subfolder2'
run: pytest
- root: 'subfolder3'
run: pytestFor the second approach: # lefthook.yml
extends:
- subfolder1/lefthook.yml
- subfolder2/lefthook.yml# subfolder1/lefthook.yml
pre-commit:
jobs:
- run: pytest
glob: "*.py"
root: 'subfolder1'# subfolder2/lefthook.yml
pre-commit:
jobs:
- run: pytest
glob: "*.py"
root: 'subfolder2'I think the first approach is more convenient, since you don't have to duplicate the |
Beta Was this translation helpful? Give feedback.
Hey! Good question. I think you can use a few approaches:
For the first approach I think you can have something like this:
For the second approach: