feat(test): add ci jobs to test gitlab rules

!76
This commit is contained in:
2024-02-15 23:14:33 +09:30
parent bea398200f
commit 8f25d1a09e
2 changed files with 100 additions and 0 deletions

View File

@ -19,6 +19,7 @@ include:
- local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/lint/markdown.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/python/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/test/.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
#- template: Security/License-Scanning.gitlab-ci.yml

99
test/.gitlab-ci.yml Normal file
View File

@ -0,0 +1,99 @@
# This gitlab-ci file is for testing job rules
API Only:
stage: test
needs: []
script:
- echo should only run on
rules:
- if:
$CI_PIPELINE_SOURCE == "api"
when: always
- when: never
Push Only:
stage: test
needs: []
script:
- echo testing rules
rules:
- if:
$CI_COMMIT_BRANCH != ""
&&
$CI_PIPELINE_SOURCE == "push"
when: always
- when: never
MR-On Merging Only:
stage: test
needs: []
script:
- echo should only run on merging a MR
rules:
- if:
$CI_MERGE_REQUEST_IID == ""
&&
$CI_PIPELINE_SOURCE == "merge_request_event"
when: always
- when: never
MR-Not On Merging:
stage: test
needs: []
script:
- echo should never run on merging a MR
rules:
- if:
$CI_MERGE_REQUEST_IID != ""
&&
$CI_PIPELINE_SOURCE == "merge_request_event"
when: always
- when: never
MR-Merge Request Event:
stage: test
needs: []
script:
- echo should only run on merge event
rules:
- if:
$CI_PIPELINE_SOURCE == "merge_request_event"
when: always
- when: never
Trigger Only:
stage: test
needs: []
script:
- echo should only run on trigger event
rules:
- if:
$CI_PIPELINE_SOURCE == "trigger"
when: always
- when: never
Web Only:
stage: test
needs: []
script:
- echo should only run on web only trigger
rules:
- if:
$CI_PIPELINE_SOURCE == "web"
when: always
- when: never