summaryrefslogtreecommitdiff
path: root/.gitlab/ci/rails/shared.gitlab-ci.yml
blob: 4943f7c2e28f0db95797ffccbd165f3b4beeae38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
include:
  - local: .gitlab/ci/global.gitlab-ci.yml
  - local: .gitlab/ci/rules.gitlab-ci.yml

.rules:dont-interrupt:
  rules:
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
      allow_failure: true
    - if: $CI_MERGE_REQUEST_IID
      when: manual
      allow_failure: true

#######################
# rspec job base specs
.rails-job-base:
  extends:
    - .default-retry
    - .default-before_script
    - .rails-cache

.base-script:
  script:
    - source ./scripts/rspec_helpers.sh
    # Only install knapsack after bundle install! Otherwise oddly some native
    # gems could not be found under some circumstance. No idea why, hours wasted.
    - run_timed_command "gem install knapsack --no-document"
    - echo -e "\e[0Ksection_start:`date +%s`:gitaly-test-spawn[collapsed=true]\r\e[0KStarting Gitaly"
    - run_timed_command "scripts/gitaly-test-spawn"  # Do not use 'bundle exec' here
    - echo -e "\e[0Ksection_end:`date +%s`:gitaly-test-spawn\r\e[0K"

.predictive-rspec-tests:
  variables:
    RSPEC_TESTS_MAPPING_ENABLED: "true"

.single-db:
  variables:
    DECOMPOSED_DB: "false"

.single-db-rspec:
  extends: .single-db

.praefect-with-db:
  variables:
    GITALY_PRAEFECT_WITH_DB: '1'

.rspec-base:
  extends:
    - .rails-job-base
    - .base-artifacts
  stage: test
  variables:
    RUBY_GC_MALLOC_LIMIT: 67108864
    RUBY_GC_MALLOC_LIMIT_MAX: 134217728
    RECORD_DEPRECATIONS: "true"
    GEO_SECONDARY_PROXY: 0
    RSPEC_TESTS_FILTER_FILE: "${RSPEC_MATCHING_TESTS_PATH}"
    SUCCESSFULLY_RETRIED_TEST_EXIT_CODE: 137
  needs:
    - job: "setup-test-env"
    - job: "retrieve-tests-metadata"
    - job: "compile-test-assets"
    - job: "detect-tests"
      optional: true
  script:
    - !reference [.base-script, script]
    # We need to exclude background migration because unit tests run with
    # spec/lib, yet background migration tests are also sitting there,
    # and they should run on their own jobs so we don't need to run them
    # in unit tests again.
    - rspec_paralellized_job "--tag ~quarantine --tag ~level:background_migration"
  allow_failure:
    exit_codes: !reference [.rspec-base, variables, SUCCESSFULLY_RETRIED_TEST_EXIT_CODE]

.base-artifacts:
  artifacts:
    expire_in: 31d
    when: always
    paths:
      - coverage/
      - crystalball/
      - deprecations/
      - knapsack/
      - query_recorder/
      - rspec/
      - tmp/capybara/
      - log/*.log
    reports:
      junit: ${JUNIT_RESULT_FILE}

.rspec-base-migration:
  script:
    - !reference [.base-script, script]
    - rspec_paralellized_job "--tag ~quarantine --tag ~zoekt"

.rspec-base-pg11:
  extends:
    - .rspec-base
    - .use-pg11

.rspec-base-pg12:
  extends:
    - .rspec-base
    - .use-pg12

.rspec-base-pg12-as-if-foss:
  extends:
    - .rspec-base
    - .as-if-foss
    - .use-pg12
  needs:
    - job: "setup-test-env"
    - job: "retrieve-tests-metadata"
    - job: "compile-test-assets as-if-foss"
    - job: "detect-tests"
      optional: true

.rspec-base-pg13:
  extends:
    - .rspec-base
    - .use-pg13

.rspec-ee-base-pg11:
  extends:
    - .rspec-base
    - .use-pg11-es7-ee

.rspec-ee-base-pg12:
  extends:
    - .rspec-base
    - .use-pg12-es7-ee

.rspec-ee-base-pg12-es8:
  extends:
    - .rspec-base
    - .use-pg12-es8-ee
    - .rails:rules:run-search-tests

.rspec-ee-base-pg12-opensearch1:
  extends:
    - .rspec-base
    - .use-pg12-opensearch1-ee
    - .rails:rules:run-search-tests

.rspec-ee-base-pg12-opensearch2:
  extends:
    - .rspec-base
    - .use-pg12-opensearch2-ee
    - .rails:rules:run-search-tests

.rspec-ee-base-pg13:
  extends:
    - .rspec-base
    - .use-pg13-es7-ee

.db-job-base:
  extends:
    - .rails-job-base
    - .rails:rules:ee-and-foss-migration
    - .use-pg12
  stage: test
  needs: ["setup-test-env"]
# rspec job base specs
######################

############################
# rspec job parallel configs
.rspec-migration-parallel:
  parallel: 8

.rspec-background-migration-parallel:
  parallel: 4

.rspec-ee-migration-parallel:
  parallel: 2

.rspec-ee-background-migration-parallel:
  parallel: 2

.rspec-unit-parallel:
  parallel: 28

.rspec-ee-unit-parallel:
  parallel: 18

.rspec-integration-parallel:
  parallel: 12

.rspec-ee-integration-parallel:
  parallel: 6

.rspec-system-parallel:
  parallel: 28

.rspec-ee-system-parallel:
  parallel: 10
# rspec job parallel configs
############################