From c1a736f1182b4a2bd19aa72806efcad6178f969b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 24 Oct 2024 10:43:59 +0200 Subject: [PATCH] Add rules to check code jobs to run only if targeted files have changed --- .gitlab-ci.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0ff8b27b9b..f51e631b4a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -111,7 +111,11 @@ check-doc: - .gitlab-scripts/doctest2python.py rules: - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH + changes: + - "**/*.py" + - "**/tests/*.rst" when: always + - when: never check-flake8: extends: .check-code @@ -145,6 +149,12 @@ check-eslint: - cd sao - npm install --cache ${NODE_CACHE_DIR} --unsafe-perm --legacy-peer-deps - npm run check + rules: + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH + changes: + - "sao/**/*.js" + when: always + - when: never check-ci-modules: extends: .check @@ -166,8 +176,11 @@ check-cookiecutter-module: - flake8 /tmp/my_module - isort --multi-line VERTICAL_GRID --check --diff /tmp/my_module rules: - - changes: - - cookiecutter-module/**/* + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH + changes: + - cookiecutter-module/**/* + when: always + - when: never check-template-modules: extends: .check