Commit 69cbfcba authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'caalberts-rspec-jobs-filtered' into 'master'

Run minimal rspec jobs based on test detection on Merge Requests pipelines

See merge request gitlab-org/gitlab!48741
parents 19c8d3f3 112beb44
......@@ -14,6 +14,10 @@
- run_timed_command "scripts/gitaly-test-spawn"
- source ./scripts/rspec_helpers.sh
.minimal-rspec-tests:
variables:
RSPEC_TESTS_MAPPING_ENABLED: "true"
.rspec-base:
extends: .rails-job-base
stage: test
......@@ -240,24 +244,48 @@ rspec migration pg11:
- .rspec-base-migration
- .rspec-migration-parallel
rspec migration pg11 minimal:
extends:
- rspec migration pg11
- .minimal-rspec-tests
- .rails:rules:ee-and-foss-migration:minimal
rspec unit pg11:
extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-unit
- .rspec-unit-parallel
rspec unit pg11 minimal:
extends:
- rspec unit pg11
- .minimal-rspec-tests
- .rails:rules:ee-and-foss-unit:minimal
rspec integration pg11:
extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-integration
- .rspec-integration-parallel
rspec integration pg11 minimal:
extends:
- rspec integration pg11
- .minimal-rspec-tests
- .rails:rules:ee-and-foss-integration:minimal
rspec system pg11:
extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-system
- .rspec-system-parallel
rspec system pg11 minimal:
extends:
- rspec system pg11
- .minimal-rspec-tests
- .rails:rules:ee-and-foss-system:minimal
rspec fast_spec_helper:
extends:
- .rspec-base-pg11
......@@ -265,6 +293,12 @@ rspec fast_spec_helper:
script:
- bin/rspec spec/fast_spec_helper.rb
rspec fast_spec_helper minimal:
extends:
- rspec fast_spec_helper
- .minimal-rspec-tests
- .rails:rules:ee-and-foss-fast_spec_helper:minimal
db:migrate:reset:
extends: .db-job-base
script:
......@@ -418,24 +452,48 @@ rspec migration pg11-as-if-foss:
- .rails:rules:as-if-foss-migration
- .rspec-migration-parallel
rspec migration pg11-as-if-foss minimal:
extends:
- rspec migration pg11-as-if-foss
- .minimal-rspec-tests
- .rails:rules:as-if-foss-migration:minimal
rspec unit pg11-as-if-foss:
extends:
- .rspec-base-pg11-as-if-foss
- .rails:rules:as-if-foss-unit
- .rspec-unit-parallel
rspec unit pg11-as-if-foss minimal:
extends:
- rspec unit pg11-as-if-foss
- .minimal-rspec-tests
- .rails:rules:as-if-foss-unit:minimal
rspec integration pg11-as-if-foss:
extends:
- .rspec-base-pg11-as-if-foss
- .rails:rules:as-if-foss-integration
- .rspec-integration-parallel
rspec integration pg11-as-if-foss minimal:
extends:
- rspec integration pg11-as-if-foss
- .minimal-rspec-tests
- .rails:rules:as-if-foss-integration:minimal
rspec system pg11-as-if-foss:
extends:
- .rspec-base-pg11-as-if-foss
- .rails:rules:as-if-foss-system
- .rspec-system-parallel
rspec system pg11-as-if-foss minimal:
extends:
- rspec system pg11-as-if-foss
- .minimal-rspec-tests
- .rails:rules:as-if-foss-system:minimal
rspec-ee migration pg11:
extends:
- .rspec-ee-base-pg11
......@@ -443,40 +501,82 @@ rspec-ee migration pg11:
- .rails:rules:ee-only-migration
- .rspec-ee-migration-parallel
rspec-ee migration pg11 minimal:
extends:
- rspec-ee migration pg11
- .minimal-rspec-tests
- .rails:rules:ee-only-migration:minimal
rspec-ee unit pg11:
extends:
- .rspec-ee-base-pg11
- .rails:rules:ee-only-unit
- .rspec-ee-unit-parallel
rspec-ee unit pg11 minimal:
extends:
- rspec-ee unit pg11
- .minimal-rspec-tests
- .rails:rules:ee-only-unit:minimal
rspec-ee integration pg11:
extends:
- .rspec-ee-base-pg11
- .rails:rules:ee-only-integration
- .rspec-ee-integration-parallel
rspec-ee integration pg11 minimal:
extends:
- rspec-ee integration pg11
- .minimal-rspec-tests
- .rails:rules:ee-only-integration:minimal
rspec-ee system pg11:
extends:
- .rspec-ee-base-pg11
- .rails:rules:ee-only-system
- .rspec-ee-system-parallel
rspec-ee system pg11 minimal:
extends:
- rspec-ee system pg11
- .minimal-rspec-tests
- .rails:rules:ee-only-system:minimal
rspec-ee unit pg11 geo:
extends:
- .rspec-ee-base-geo-pg11
- .rails:rules:ee-only-unit
- .rspec-ee-unit-geo-parallel
rspec-ee unit pg11 geo minimal:
extends:
- rspec-ee unit pg11 geo
- .minimal-rspec-tests
- .rails:rules:ee-only-unit:minimal
rspec-ee integration pg11 geo:
extends:
- .rspec-ee-base-geo-pg11
- .rails:rules:ee-only-integration
rspec-ee integration pg11 geo minimal:
extends:
- rspec-ee integration pg11 geo
- .minimal-rspec-tests
- .rails:rules:ee-only-integration:minimal
rspec-ee system pg11 geo:
extends:
- .rspec-ee-base-geo-pg11
- .rails:rules:ee-only-system
rspec-ee system pg11 geo minimal:
extends:
- rspec-ee system pg11 geo
- .minimal-rspec-tests
- .rails:rules:ee-only-system:minimal
db:rollback geo:
extends:
- db:rollback
......
......@@ -70,6 +70,9 @@
.if-cache-credentials-schedule: &if-cache-credentials-schedule
if: '$CI_REPO_CACHE_CREDENTIALS && $CI_PIPELINE_SOURCE == "schedule"'
.if-merge-request-rspec-minimal-disabled: &if-merge-request-rspec-minimal-disabled
if: '$CI_MERGE_REQUEST_IID && $RSPEC_MINIMAL_ENABLED != "true"'
.if-rspec-fail-fast-disabled: &if-rspec-fail-fast-disabled
if: '$RSPEC_FAIL_FAST_ENABLED != "true"'
......@@ -492,26 +495,86 @@
- changes: *db-patterns
- <<: *if-merge-request-title-run-all-rspec
.rails:rules:ee-and-foss-migration:minimal:
rules:
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request-title-run-all-rspec
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-merge-request
changes: *db-patterns
.rails:rules:ee-and-foss-unit:
rules:
- changes: *backend-patterns
- <<: *if-merge-request-title-run-all-rspec
.rails:rules:ee-and-foss-unit:minimal:
rules:
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request-title-run-all-rspec
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-merge-request
changes: *backend-patterns
.rails:rules:ee-and-foss-integration:
rules:
- changes: *backend-patterns
- <<: *if-merge-request-title-run-all-rspec
.rails:rules:ee-and-foss-integration:minimal:
rules:
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request-title-run-all-rspec
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-merge-request
changes: *backend-patterns
.rails:rules:ee-and-foss-system:
rules:
- changes: *code-backstage-patterns
- <<: *if-merge-request-title-run-all-rspec
.rails:rules:ee-and-foss-system:minimal:
rules:
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request-title-run-all-rspec
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-merge-request
changes: *code-backstage-patterns
.rails:rules:ee-and-foss-fast_spec_helper:
rules:
- changes: ["config/**/*"]
- <<: *if-merge-request-title-run-all-rspec
.rails:rules:ee-and-foss-fast_spec_helper:minimal:
rules:
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request-title-run-all-rspec
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-merge-request
changes: ["config/**/*"]
.rails:rules:default-refs-code-backstage-qa:
rules:
- <<: *if-default-refs
......@@ -525,6 +588,20 @@
- changes: *db-patterns
- <<: *if-merge-request-title-run-all-rspec
.rails:rules:ee-only-migration:minimal:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request-title-run-all-rspec
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-merge-request
changes: *db-patterns
.rails:rules:ee-only-unit:
rules:
- <<: *if-not-ee
......@@ -532,6 +609,20 @@
- changes: *backend-patterns
- <<: *if-merge-request-title-run-all-rspec
.rails:rules:ee-only-unit:minimal:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request-title-run-all-rspec
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-merge-request
changes: *backend-patterns
.rails:rules:ee-only-integration:
rules:
- <<: *if-not-ee
......@@ -539,6 +630,20 @@
- changes: *backend-patterns
- <<: *if-merge-request-title-run-all-rspec
.rails:rules:ee-only-integration:minimal:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request-title-run-all-rspec
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-merge-request
changes: *backend-patterns
.rails:rules:ee-only-system:
rules:
- <<: *if-not-ee
......@@ -546,6 +651,20 @@
- changes: *code-backstage-patterns
- <<: *if-merge-request-title-run-all-rspec
.rails:rules:ee-only-system:minimal:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request-title-run-all-rspec
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-merge-request
changes: *code-backstage-patterns
.rails:rules:as-if-foss-migration:
rules:
- <<: *if-not-ee
......@@ -557,6 +676,20 @@
- <<: *if-merge-request
changes: *ci-patterns
.rails:rules:as-if-foss-migration:minimal:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-security-merge-request
changes: *db-patterns
- <<: *if-merge-request-title-as-if-foss
changes: *db-patterns
.rails:rules:as-if-foss-unit:
rules:
- <<: *if-not-ee
......@@ -568,6 +701,20 @@
- <<: *if-merge-request
changes: *ci-patterns
.rails:rules:as-if-foss-unit:minimal:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-security-merge-request
changes: *backend-patterns
- <<: *if-merge-request-title-as-if-foss
changes: *backend-patterns
.rails:rules:as-if-foss-integration:
rules:
- <<: *if-not-ee
......@@ -579,6 +726,20 @@
- <<: *if-merge-request
changes: *ci-patterns
.rails:rules:as-if-foss-integration:minimal:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-security-merge-request
changes: *backend-patterns
- <<: *if-merge-request-title-as-if-foss
changes: *backend-patterns
.rails:rules:as-if-foss-system:
rules:
- <<: *if-not-ee
......@@ -590,6 +751,20 @@
- <<: *if-merge-request
changes: *ci-patterns
.rails:rules:as-if-foss-system:minimal:
rules:
- <<: *if-not-ee
when: never
- <<: *if-merge-request-rspec-minimal-disabled
when: never
- <<: *if-merge-request
changes: *ci-patterns
when: never
- <<: *if-security-merge-request
changes: *code-backstage-patterns
- <<: *if-merge-request-title-as-if-foss
changes: *code-backstage-patterns
.rails:rules:ee-mr-and-master-only:
rules:
- <<: *if-not-ee
......
......@@ -82,6 +82,7 @@ detect-tests:
- .detect-test-base
- .rails:rules:detect-tests
variables:
RSPEC_TESTS_MAPPING_ENABLED: "true"
MATCHED_TESTS_FILE: tmp/matching_tests.txt
detect-tests as-if-foss:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment