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: ...@@ -112,10 +112,10 @@ downtime_check:
.rspec-base-pg11: .rspec-base-pg11:
extends: extends:
- .rspec-base - .rspec-base
- .rails:rules:ee-and-foss
- .use-pg11 - .use-pg11
.rspec-base-migration: .rspec-base-migration:
extends: .rails:rules:ee-and-foss-migration
script: script:
- run_timed_command "scripts/gitaly-test-build" - run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn" - run_timed_command "scripts/gitaly-test-spawn"
...@@ -129,26 +129,34 @@ rspec migration pg11: ...@@ -129,26 +129,34 @@ rspec migration pg11:
parallel: 5 parallel: 5
rspec unit pg11: rspec unit pg11:
extends: .rspec-base-pg11 extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-unit
parallel: 20 parallel: 20
rspec integration pg11: rspec integration pg11:
extends: .rspec-base-pg11 extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-integration
parallel: 8 parallel: 8
rspec system pg11: rspec system pg11:
extends: .rspec-base-pg11 extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-system
parallel: 24 parallel: 24
rspec fast_spec_helper: rspec fast_spec_helper:
extends: .rspec-base-pg11 extends:
- .rspec-base-pg11
- .rails:rules:ee-and-foss-fast_spec_helper
script: script:
- bin/rspec spec/fast_spec_helper.rb - bin/rspec spec/fast_spec_helper.rb
.db-job-base: .db-job-base:
extends: extends:
- .rails-job-base - .rails-job-base
- .rails:rules:ee-and-foss - .rails:rules:ee-and-foss-migration
- .use-pg11 - .use-pg11
stage: test stage: test
needs: ["setup-test-env"] needs: ["setup-test-env"]
...@@ -253,62 +261,70 @@ rspec:coverage: ...@@ -253,62 +261,70 @@ rspec:coverage:
################################################## ##################################################
# EE: default refs (MRs, master, schedules) jobs # # EE: default refs (MRs, master, schedules) jobs #
.rspec-base-ee:
extends:
- .rspec-base
- .rails:rules:ee-only
.rspec-base-pg11-as-if-foss: .rspec-base-pg11-as-if-foss:
extends: extends:
- .rspec-base - .rspec-base
- .rails:rules:as-if-foss
- .as-if-foss - .as-if-foss
- .use-pg11 - .use-pg11
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-test-assets as-if-foss"] 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: rspec migration pg11-as-if-foss:
extends: extends:
- .rspec-base-pg11-as-if-foss - .rspec-base-pg11-as-if-foss
- .rspec-base-migration - .rspec-base-migration
- .rails:rules:as-if-foss-migration
parallel: 5 parallel: 5
rspec unit pg11-as-if-foss: 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 parallel: 20
rspec integration pg11-as-if-foss: 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 parallel: 8
rspec system pg11-as-if-foss: 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 parallel: 24
.rspec-ee-base-pg11:
extends:
- .rspec-base
- .use-pg11-ee
rspec-ee migration pg11: rspec-ee migration pg11:
extends: extends:
- .rspec-ee-base-pg11 - .rspec-ee-base-pg11
- .rspec-base-migration - .rspec-base-migration
- .rails:rules:ee-only-migration
parallel: 2 parallel: 2
rspec-ee unit pg11: rspec-ee unit pg11:
extends: .rspec-ee-base-pg11 extends:
- .rspec-ee-base-pg11
- .rails:rules:ee-only-unit
parallel: 10 parallel: 10
rspec-ee integration pg11: rspec-ee integration pg11:
extends: .rspec-ee-base-pg11 extends:
- .rspec-ee-base-pg11
- .rails:rules:ee-only-integration
parallel: 4 parallel: 4
rspec-ee system pg11: rspec-ee system pg11:
extends: .rspec-ee-base-pg11 extends:
- .rspec-ee-base-pg11
- .rails:rules:ee-only-system
parallel: 6 parallel: 6
.rspec-ee-base-geo: .rspec-ee-base-geo:
extends: .rspec-base-ee extends: .rspec-base
script: script:
- run_timed_command "scripts/gitaly-test-build" - run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn" - run_timed_command "scripts/gitaly-test-spawn"
...@@ -322,19 +338,25 @@ rspec-ee system pg11: ...@@ -322,19 +338,25 @@ rspec-ee system pg11:
- .use-pg11-ee - .use-pg11-ee
rspec-ee unit pg11 geo: rspec-ee unit pg11 geo:
extends: .rspec-ee-base-geo-pg11 extends:
- .rspec-ee-base-geo-pg11
- .rails:rules:ee-only-unit
parallel: 2 parallel: 2
rspec-ee integration pg11 geo: 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: 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: db:rollback geo:
extends: extends:
- db:rollback - db:rollback
- .rails:rules:ee-only - .rails:rules:ee-only-migration
script: script:
- bundle exec rake geo:db:migrate VERSION=20170627195211 - bundle exec rake geo:db:migrate VERSION=20170627195211
- bundle exec rake geo:db:migrate - bundle exec rake geo:db:migrate
......
...@@ -92,6 +92,17 @@ ...@@ -92,6 +92,17 @@
- "vendor/assets/**/*" - "vendor/assets/**/*"
- "{,ee/}{app/assets,app/helpers,app/presenters,app/views,locale,public,symbol}/**/*" - "{,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 .backstage-patterns: &backstage-patterns
- "Dangerfile" - "Dangerfile"
- "danger/**/*" - "danger/**/*"
...@@ -382,24 +393,86 @@ ...@@ -382,24 +393,86 @@
############### ###############
# Rails rules # # Rails rules #
############### ###############
.rails:rules:ee-and-foss: .rails:rules:ee-and-foss-migration:
rules: rules:
- <<: *if-default-refs - changes: *db-patterns
changes: *code-backstage-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: .rails:rules:default-refs-code-backstage-qa:
rules: rules:
- <<: *if-default-refs - <<: *if-default-refs
changes: *code-backstage-qa-patterns changes: *code-backstage-qa-patterns
.rails:rules:ee-only: .rails:rules:ee-only-migration:
rules: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never when: never
- <<: *if-default-refs - changes: *db-patterns
changes: *code-backstage-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: rules:
- <<: *if-not-ee - <<: *if-not-ee
when: never 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