Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.1 on 2022-01-26 at 16:00 UTC+1 (a few minutes of down time)

frontend.gitlab-ci.yml 5.83 KB
Newer Older
Stan Hu's avatar
Stan Hu committed
1
.assets-compile-cache:
Kamil Trzciński's avatar
Kamil Trzciński committed
2
3
4
5
6
7
  cache:
    paths:
      - vendor/ruby/
      - .yarn-cache/
      - tmp/cache/assets/sprockets

8
.gitlab:assets:compile-metadata:
Stan Hu's avatar
Stan Hu committed
9
10
11
  extends:
    - .default-tags
    - .default-retry
12
    - .default-only
Stan Hu's avatar
Stan Hu committed
13
    - .default-before_script
14
    - .assets-compile-cache
15
    - .only:changes-code-backstage-qa
16
  image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-git-2.22-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1
17
  stage: test
Stan Hu's avatar
Stan Hu committed
18
  dependencies: ["setup-test-env"]
19
  needs: ["setup-test-env"]
Kamil Trzciński's avatar
Kamil Trzciński committed
20
  services:
21
    - docker:19.03.0-dind
Kamil Trzciński's avatar
Kamil Trzciński committed
22
23
24
25
26
27
28
29
30
31
  variables:
    NODE_ENV: "production"
    RAILS_ENV: "production"
    SETUP_DB: "false"
    SKIP_STORAGE_VALIDATION: "true"
    WEBPACK_REPORT: "true"
    # we override the max_old_space_size to prevent OOM errors
    NODE_OPTIONS: --max_old_space_size=3584
    DOCKER_DRIVER: overlay2
    DOCKER_HOST: tcp://docker:2375
Stan Hu's avatar
Stan Hu committed
32
33
34
35
36
37
38
39
  cache:
    key: "assets-compile:production:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:v6"
  artifacts:
    name: webpack-report
    expire_in: 31d
    paths:
      - webpack-report/
      - public/assets/
Kamil Trzciński's avatar
Kamil Trzciński committed
40
41
  script:
    - node --version
Lukas Eipert's avatar
Lukas Eipert committed
42
    - retry yarn install --frozen-lockfile --production --cache-folder .yarn-cache --prefer-offline
Kamil Trzciński's avatar
Kamil Trzciński committed
43
    - free -m
44
    - retry bundle exec rake gitlab:assets:compile
Kamil Trzciński's avatar
Kamil Trzciński committed
45
46
    - time scripts/build_assets_image
    - scripts/clean-old-cached-assets
Kamil Trzciński's avatar
Kamil Trzciński committed
47
    - rm -f /etc/apt/sources.list.d/google*.list  # We don't need to update Chrome here
Kamil Trzciński's avatar
Kamil Trzciński committed
48
  only:
49
    variables:
50
      - $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/)/  # Matches the gitlab-org group and its subgroups
51
      - $CI_SERVER_HOST == "dev.gitlab.org"
Kamil Trzciński's avatar
Kamil Trzciński committed
52
53
  tags:
    - gitlab-org
Stan Hu's avatar
Stan Hu committed
54
    - docker
Kamil Trzciński's avatar
Kamil Trzciński committed
55

56
gitlab:assets:compile pull-push-cache:
57
  extends: .gitlab:assets:compile-metadata
Stan Hu's avatar
Stan Hu committed
58
59
  only:
    refs:
60
      - master
61
62
63
64
65
  cache:
    policy: pull-push

gitlab:assets:compile pull-cache:
  extends: .gitlab:assets:compile-metadata
Stan Hu's avatar
Stan Hu committed
66
67
  cache:
    policy: pull
68
69

.compile-assets-metadata:
Stan Hu's avatar
Stan Hu committed
70
71
72
  extends:
    - .default-tags
    - .default-retry
73
    - .default-only
Stan Hu's avatar
Stan Hu committed
74
    - .default-before_script
75
    - .assets-compile-cache
76
    - .only:changes-code-backstage-qa
77
    - .use-pg9
Kamil Trzciński's avatar
Kamil Trzciński committed
78
79
80
  stage: prepare
  script:
    - node --version
Lukas Eipert's avatar
Lukas Eipert committed
81
    - retry yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
Kamil Trzciński's avatar
Kamil Trzciński committed
82
    - free -m
83
    - retry bundle exec rake gitlab:assets:compile
Kamil Trzciński's avatar
Kamil Trzciński committed
84
85
86
87
    - scripts/clean-old-cached-assets
  variables:
    # we override the max_old_space_size to prevent OOM errors
    NODE_OPTIONS: --max_old_space_size=3584
Stan Hu's avatar
Stan Hu committed
88
  cache:
89
    key: "assets-compile:v7"
Kamil Trzciński's avatar
Kamil Trzciński committed
90
91
92
93
94
  artifacts:
    expire_in: 7d
    paths:
      - node_modules
      - public/assets
95

96
compile-assets pull-push-cache:
97
  extends: .compile-assets-metadata
Stan Hu's avatar
Stan Hu committed
98
99
  only:
    refs:
100
      - master
101
102
103
  cache:
    policy: pull-push

104
105
106
compile-assets pull-push-cache foss:
  extends: [".compile-assets-metadata", ".only-ee-as-if-foss"]
  only:
Philippe Lafoucrière's avatar
Philippe Lafoucrière committed
107
    refs:
108
      - master
109
110
111
112
113
114
115
116
117
118
119
  cache:
    policy: pull-push
    key: "assets-compile:v7:foss"

compile-assets pull-cache:
  extends: .compile-assets-metadata
  cache:
    policy: pull

compile-assets pull-cache foss:
  extends: [".compile-assets-metadata", ".only-ee-as-if-foss"]
Stan Hu's avatar
Stan Hu committed
120
121
  cache:
    policy: pull
122
    key: "assets-compile:v7:foss"
Kamil Trzciński's avatar
Kamil Trzciński committed
123

124
.only-code-frontend-job-base:
Stan Hu's avatar
Stan Hu committed
125
126
127
128
  extends:
    - .default-tags
    - .default-retry
    - .default-cache
129
    - .default-only
Stan Hu's avatar
Stan Hu committed
130
    - .default-before_script
131
    - .only:changes-code-backstage
132
    - .use-pg9
133
134
135
  stage: test
  needs: ["setup-test-env", "compile-assets pull-cache"]
  dependencies: ["setup-test-env", "compile-assets pull-cache"]
136

137
.karma-base:
138
  extends: .only-code-frontend-job-base
Kamil Trzciński's avatar
Kamil Trzciński committed
139
140
141
142
143
144
145
146
147
  variables:
    # we override the max_old_space_size to prevent OOM errors
    NODE_OPTIONS: --max_old_space_size=3584
  script:
    - export BABEL_ENV=coverage CHROME_LOG_FILE=chrome_debug.log
    - date
    - scripts/gitaly-test-spawn
    - date
    - bundle exec rake karma
148
149
150

karma:
  extends: .karma-base
Kamil Trzciński's avatar
Kamil Trzciński committed
151
152
153
154
155
156
157
158
  coverage: '/^Statements *: (\d+\.\d+%)/'
  artifacts:
    name: coverage-javascript
    expire_in: 31d
    when: always
    paths:
      - chrome_debug.log
      - coverage-javascript/
159
      - tmp/tests/frontend/
Steve Azzopardi's avatar
Steve Azzopardi committed
160
161
    reports:
      junit: junit_karma.xml
Kamil Trzciński's avatar
Kamil Trzciński committed
162

163
164
165
166
167
168
karma-foss:
  extends:
    - .karma-base
    - .only-ee-as-if-foss

.jest-base:
169
  extends: .only-code-frontend-job-base
Kamil Trzciński's avatar
Kamil Trzciński committed
170
171
172
  script:
    - scripts/gitaly-test-spawn
    - date
Mike Greiling's avatar
Mike Greiling committed
173
    - bundle exec rake frontend:fixtures
Kamil Trzciński's avatar
Kamil Trzciński committed
174
175
    - date
    - yarn jest --ci --coverage
176
177
178
179
180
181
182
183
  cache:
    key: jest
    paths:
      - tmp/jest/jest/
    policy: pull-push

jest:
  extends: .jest-base
Kamil Trzciński's avatar
Kamil Trzciński committed
184
185
186
187
188
  artifacts:
    name: coverage-frontend
    expire_in: 31d
    when: always
    paths:
Kamil Trzciński's avatar
Kamil Trzciński committed
189
190
      - coverage-frontend/
      - junit_jest.xml
191
      - tmp/tests/frontend/
Steve Azzopardi's avatar
Steve Azzopardi committed
192
193
    reports:
      junit: junit_jest.xml
194
195
196
197
198

jest-foss:
  extends:
    - .jest-base
    - .only-ee-as-if-foss
Kamil Trzciński's avatar
Kamil Trzciński committed
199
  cache:
200
    policy: pull
Kamil Trzciński's avatar
Kamil Trzciński committed
201

Stan Hu's avatar
Stan Hu committed
202
203
204
205
206
.qa-frontend-node:
  extends:
    - .default-tags
    - .default-retry
    - .default-cache
207
    - .default-only
208
    - .only:changes-code-backstage
209
  stage: test
Stan Hu's avatar
Stan Hu committed
210
  dependencies: []
Kamil Trzciński's avatar
Kamil Trzciński committed
211
212
213
214
215
216
217
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - .yarn-cache/
    policy: pull-push
  script:
    - date
Lukas Eipert's avatar
Lukas Eipert committed
218
    - yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
Kamil Trzciński's avatar
Kamil Trzciński committed
219
220
221
222
    - date
    - yarn run webpack-prod

qa-frontend-node:8:
Stan Hu's avatar
Stan Hu committed
223
  extends: .qa-frontend-node
224
  image: node:carbon
Kamil Trzciński's avatar
Kamil Trzciński committed
225
226

qa-frontend-node:10:
Stan Hu's avatar
Stan Hu committed
227
  extends: .qa-frontend-node
228
  image: node:dubnium
Kamil Trzciński's avatar
Kamil Trzciński committed
229
230

qa-frontend-node:latest:
Stan Hu's avatar
Stan Hu committed
231
  extends: .qa-frontend-node
232
  image: node:latest
Kamil Trzciński's avatar
Kamil Trzciński committed
233
  allow_failure: true
Mike Greiling's avatar
Mike Greiling committed
234
235
236
237
238
239

webpack-dev-server:
  extends:
    - .default-tags
    - .default-retry
    - .default-cache
240
    - .default-only
241
    - .only:changes-code-backstage
242
243
244
  stage: test
  needs: ["setup-test-env", "compile-assets pull-cache"]
  dependencies: ["setup-test-env", "compile-assets pull-cache"]
Mike Greiling's avatar
Mike Greiling committed
245
246
247
248
249
  variables:
    WEBPACK_MEMORY_TEST: "true"
  script:
    - node --version
    - node --expose-gc node_modules/.bin/webpack-dev-server --config config/webpack.config.js