diff --git a/.gitlab/ci/doc.gitlab-ci.yml b/.gitlab/ci/doc.gitlab-ci.yml index 59179f7a7..a869d025a 100644 --- a/.gitlab/ci/doc.gitlab-ci.yml +++ b/.gitlab/ci/doc.gitlab-ci.yml @@ -23,5 +23,5 @@ generate-helpers-doc: artifacts: paths: - doc/helpers.md - only: - - tags + rules: + - !reference [.on_tags_rules, rules] \ No newline at end of file diff --git a/.gitlab/ci/lint.gitlab-ci.yml b/.gitlab/ci/lint.gitlab-ci.yml index 9c48bd912..b884bed34 100644 --- a/.gitlab/ci/lint.gitlab-ci.yml +++ b/.gitlab/ci/lint.gitlab-ci.yml @@ -45,6 +45,5 @@ format-run: - git commit -am "[CI] Format code" || true - git push -f origin "ci-format-${CI_COMMIT_REF_NAME}":"ci-format-${CI_COMMIT_REF_NAME}" - hub pull-request -m "[CI] Format code" -b Yunohost:dev -p || true # GITHUB_USER and GITHUB_TOKEN registered here https://gitlab.com/yunohost/yunohost/-/settings/ci_cd - only: - refs: - - dev + rules: + - !reference [.on_default_branch_rules, rules] diff --git a/.gitlab/ci/rules.gitlab-ci.yaml b/.gitlab/ci/rules.gitlab-ci.yaml new file mode 100644 index 000000000..459523bc8 --- /dev/null +++ b/.gitlab/ci/rules.gitlab-ci.yaml @@ -0,0 +1,7 @@ +.on_default_branch_rules: + rules: + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + +.on_tags_rules: + rules: + - if: $CI_COMMIT_TAG \ No newline at end of file diff --git a/.gitlab/ci/test.gitlab-ci.yml b/.gitlab/ci/test.gitlab-ci.yml index f146442e4..6426bb5da 100644 --- a/.gitlab/ci/test.gitlab-ci.yml +++ b/.gitlab/ci/test.gitlab-ci.yml @@ -54,24 +54,30 @@ test-i18n-keys: extends: .test-stage script: - python3 -m pytest tests tests/test_i18n_keys.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - locales/* test-translation-format-consistency: extends: .test-stage script: - python3 -m pytest tests tests/test_translation_format_consistency.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - locales/* test-actionmap: extends: .test-stage script: - python3 -m pytest tests tests/test_actionmap.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - data/actionsmap/*.yml test-helpers: @@ -79,8 +85,10 @@ test-helpers: script: - cd tests - bash test_helpers.sh - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - data/helpers.d/* test-apps: @@ -88,8 +96,10 @@ test-apps: script: - cd src/yunohost - python3 -m pytest tests/test_apps.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/app.py test-appscatalog: @@ -97,8 +107,10 @@ test-appscatalog: script: - cd src/yunohost - python3 -m pytest tests/test_appscatalog.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/app.py test-appurl: @@ -106,8 +118,10 @@ test-appurl: script: - cd src/yunohost - python3 -m pytest tests/test_appurl.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/app.py test-apps-arguments-parsing: @@ -115,8 +129,10 @@ test-apps-arguments-parsing: script: - cd src/yunohost - python3 -m pytest tests/test_apps_arguments_parsing.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/app.py test-changeurl: @@ -124,8 +140,10 @@ test-changeurl: script: - cd src/yunohost - python3 -m pytest tests/test_changeurl.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/app.py test-backuprestore: @@ -133,8 +151,10 @@ test-backuprestore: script: - cd src/yunohost - python3 -m pytest tests/test_backuprestore.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/backup.py test-permission: @@ -142,8 +162,10 @@ test-permission: script: - cd src/yunohost - python3 -m pytest tests/test_permission.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/permission.py test-settings: @@ -151,8 +173,10 @@ test-settings: script: - cd src/yunohost - python3 -m pytest tests/test_settings.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/settings.py test-user-group: @@ -160,8 +184,10 @@ test-user-group: script: - cd src/yunohost - python3 -m pytest tests/test_user-group.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/user.py test-regenconf: @@ -169,8 +195,10 @@ test-regenconf: script: - cd src/yunohost - python3 -m pytest tests/test_regenconf.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/regenconf.py test-service: @@ -178,6 +206,8 @@ test-service: script: - cd src/yunohost - python3 -m pytest tests/test_service.py - only: - changes: + rules: + - !reference [.on_default_branch_rules, rules] + - !reference [.on_tags_rules, rules] + - changes: - src/yunohost/service.py diff --git a/.gitlab/ci/translation.gitlab-ci.yml b/.gitlab/ci/translation.gitlab-ci.yml index eef57ca22..e3166c7f8 100644 --- a/.gitlab/ci/translation.gitlab-ci.yml +++ b/.gitlab/ci/translation.gitlab-ci.yml @@ -20,8 +20,5 @@ remove-stale-translated-strings: - git commit -am "[CI] Remove stale translated strings" || true - git push -f origin "ci-remove-stale-translated-strings-${CI_COMMIT_REF_NAME}":"ci-remove-stale-translated-strings-${CI_COMMIT_REF_NAME}" - hub pull-request -m "[CI] Remove stale translated strings" -b Yunohost:dev -p || true # GITHUB_USER and GITHUB_TOKEN registered here https://gitlab.com/yunohost/yunohost/-/settings/ci_cd - only: - variables: - - $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH - changes: - - locales/* + rules: + - !reference [.on_default_branch_rules, rules]