Add rules to check code jobs to run only if targeted files have changed

This commit is contained in:
Cédric Krier
2024-10-24 10:43:59 +02:00
parent 64bcec5fa6
commit c1a736f118
+15 -2
View File
@@ -111,7 +111,11 @@ check-doc:
- .gitlab-scripts/doctest2python.py - .gitlab-scripts/doctest2python.py
rules: rules:
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
changes:
- "**/*.py"
- "**/tests/*.rst"
when: always when: always
- when: never
check-flake8: check-flake8:
extends: .check-code extends: .check-code
@@ -145,6 +149,12 @@ check-eslint:
- cd sao - cd sao
- npm install --cache ${NODE_CACHE_DIR} --unsafe-perm --legacy-peer-deps - npm install --cache ${NODE_CACHE_DIR} --unsafe-perm --legacy-peer-deps
- npm run check - npm run check
rules:
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
changes:
- "sao/**/*.js"
when: always
- when: never
check-ci-modules: check-ci-modules:
extends: .check extends: .check
@@ -166,8 +176,11 @@ check-cookiecutter-module:
- flake8 /tmp/my_module - flake8 /tmp/my_module
- isort --multi-line VERTICAL_GRID --check --diff /tmp/my_module - isort --multi-line VERTICAL_GRID --check --diff /tmp/my_module
rules: rules:
- changes: - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
- cookiecutter-module/**/* changes:
- cookiecutter-module/**/*
when: always
- when: never
check-template-modules: check-template-modules:
extends: .check extends: .check