Commit b1b3ccae authored by Rémy Coutable's avatar Rémy Coutable

Introduce dedicated rules for rspec jobs per level

This allows to run different level of rspec jobs based on the changes.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 75fea12c
......@@ -112,10 +112,10 @@ downtime_check:
.rspec-base-pg11:
extends:
- .rspec-base
- .rails:rules:ee-and-foss
- .use-pg11
.rspec-base-migration:
extends: .rails:rules:ee-and-foss-migration
script:
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
......@@ -129,26 +129,34 @@ rspec migration pg11:
parallel: 5
rspec unit pg11:
extends: .rspec-base-pg11
extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-unit
parallel: 20
rspec integration pg11:
extends: .rspec-base-pg11
extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-integration
parallel: 8
rspec system pg11:
extends: .rspec-base-pg11
extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-system
parallel: 24
rspec fast_spec_helper:
extends: .rspec-base-pg11
extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-fast_spec_helper
script:
- bin/rspec spec/fast_spec_helper.rb
.db-job-base:
extends:
- .rails-job-base
- .rails:rules:ee-and-foss
- .rails:rules:ee-and-foss-migration
- .use-pg11
stage: test
needs: ["setup-test-env"]
......@@ -253,62 +261,70 @@ rspec:coverage:
##################################################
# EE: default refs (MRs, master, schedules) jobs #
.rspec-base-ee:
extends:
- .rspec-base
- .rails:rules:ee-only
.rspec-base-pg11-as-if-foss:
extends:
- .rspec-base
- .rails:rules:as-if-foss
- .as-if-foss
- .use-pg11
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-test-assets as-if-foss"]
.rspec-ee-base-pg11:
extends:
- .rspec-base-ee
- .use-pg11-ee
rspec migration pg11-as-if-foss:
extends:
- .rspec-base-pg11-as-if-foss
- .rspec-base-migration
- .rails:rules:as-if-foss-migration
parallel: 5
rspec unit pg11-as-if-foss:
extends: .rspec-base-pg11-as-if-foss
extends:
- .rspec-base-pg11-as-if-foss
- .rails:rules:as-if-foss-unit
parallel: 20
rspec integration pg11-as-if-foss:
extends: .rspec-base-pg11-as-if-foss
extends:
- .rspec-base-pg11-as-if-foss
- .rails:rules:as-if-foss-integration
parallel: 8
rspec system pg11-as-if-foss:
extends: .rspec-base-pg11-as-if-foss
extends:
- .rspec-base-pg11-as-if-foss
- .rails:rules:as-if-foss-system
parallel: 24
.rspec-ee-base-pg11:
extends:
- .rspec-base
- .use-pg11-ee
rspec-ee migration pg11:
extends:
- .rspec-ee-base-pg11
- .rspec-base-migration
- .rails:rules:ee-only-migration
parallel: 2
rspec-ee unit pg11:
extends: .rspec-ee-base-pg11
extends:
- .rspec-ee-base-pg11
- .rails:rules:ee-only-unit
parallel: 10
rspec-ee integration pg11:
extends: .rspec-ee-base-pg11
extends:
- .rspec-ee-base-pg11
- .rails:rules:ee-only-integration
parallel: 4
rspec-ee system pg11:
extends: .rspec-ee-base-pg11
extends:
- .rspec-ee-base-pg11
- .rails:rules:ee-only-system
parallel: 6
.rspec-ee-base-geo:
extends: .rspec-base-ee
extends: .rspec-base
script:
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
......@@ -322,19 +338,25 @@ rspec-ee system pg11:
- .use-pg11-ee
rspec-ee unit pg11 geo:
extends: .rspec-ee-base-geo-pg11
extends:
- .rspec-ee-base-geo-pg11
- .rails:rules:ee-only-unit
parallel: 2
rspec-ee integration pg11 geo:
extends: .rspec-ee-base-geo-pg11
extends:
- .rspec-ee-base-geo-pg11
- .rails:rules:ee-only-integration
rspec-ee system pg11 geo:
extends: .rspec-ee-base-geo-pg11
extends:
- .rspec-ee-base-geo-pg11
- .rails:rules:ee-only-system
db:rollback geo:
extends:
- db:rollback
- .rails:rules:ee-only
- .rails:rules:ee-only-migration
script:
- bundle exec rake geo:db:migrate VERSION=20170627195211
- bundle exec rake geo:db:migrate
......
......@@ -92,6 +92,17 @@
- "vendor/assets/**/*"
- "{,ee/}{app/assets,app/helpers,app/presenters,app/views,locale,public,symbol}/**/*"
.backend-patterns: &backend-patterns
- "Gemfile{,.lock}"
- "Rakefile"
- "config.ru"
# List explicitly all the app/ dirs that aren't backend (i.e. all except app/assets).
- "{,ee/}{app/channels,app/controllers,app/finders,app/graphql,app/helpers,app/mailers,app/models,app/policies,app/presenters,app/serializers,app/services,app/uploaders,app/validators,app/views,app/workers}/**/*"
- "{,ee/}{bin,cable,config,db,lib}/**/*"
.db-patterns: &db-patterns
- "{,ee/}{db}/**/*"
.backstage-patterns: &backstage-patterns
- "Dangerfile"
- "danger/**/*"
......@@ -382,24 +393,86 @@
###############
# Rails rules #
###############
.rails:rules:ee-and-foss:
.rails:rules:ee-and-foss-migration:
rules:
- <<: *if-default-refs
changes: *code-backstage-patterns
- changes: *db-patterns
.rails:rules:ee-and-foss-unit:
rules:
- changes: *backend-patterns
.rails:rules:ee-and-foss-integration:
rules:
- changes: *backend-patterns
.rails:rules:ee-and-foss-system:
rules:
- changes: *code-backstage-patterns
.rails:rules:ee-and-foss-fast_spec_helper:
rules:
- changes: ["config/**/*"]
.rails:rules:default-refs-code-backstage-qa:
rules:
- <<: *if-default-refs
changes: *code-backstage-qa-patterns
.rails:rules:ee-only:
.rails:rules:ee-only-migration:
rules:
- <<: *if-not-ee
when: never
- <<: *if-default-refs
changes: *code-backstage-patterns
- changes: *db-patterns
.rails:rules:ee-only-unit:
rules:
- <<: *if-not-ee
when: never
- changes: *backend-patterns
.rails:rules:ee-only-integration:
rules:
- <<: *if-not-ee
when: never
- changes: *backend-patterns
.rails:rules:ee-only-system:
rules:
- <<: *if-not-ee
when: never
- changes: *code-backstage-patterns
.rails:rules:as-if-foss-migration:
rules:
- <<: *if-not-ee
when: never
- <<: *if-security-merge-request
changes: *db-patterns
- <<: *if-merge-request-title-as-if-foss
- <<: *if-merge-request
changes: *ci-patterns
.rails:rules:as-if-foss-unit:
rules:
- <<: *if-not-ee
when: never
- <<: *if-security-merge-request
changes: *backend-patterns
- <<: *if-merge-request-title-as-if-foss
- <<: *if-merge-request
changes: *ci-patterns
.rails:rules:as-if-foss-integration:
rules:
- <<: *if-not-ee
when: never
- <<: *if-security-merge-request
changes: *backend-patterns
- <<: *if-merge-request-title-as-if-foss
- <<: *if-merge-request
changes: *ci-patterns
.rails:rules:as-if-foss:
.rails:rules:as-if-foss-system:
rules:
- <<: *if-not-ee
when: never
......
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