debian-mirror-gitlab/.gitlab/ci/frontend.gitlab-ci.yml

299 lines
7.9 KiB
YAML
Raw Normal View History

2020-06-23 00:09:42 +05:30
.frontend-base:
2019-12-04 20:38:33 +05:30
extends:
- .default-retry
- .default-before_script
2020-06-23 00:09:42 +05:30
variables:
SETUP_DB: "false"
# we override the max_old_space_size to prevent OOM errors
NODE_OPTIONS: --max_old_space_size=3584
.compile-assets-base:
2020-07-28 23:09:34 +05:30
extends:
- .frontend-base
- .assets-compile-cache
2020-10-24 23:57:45 +05:30
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.6-git-2.28-lfs-2.9-node-12.x-yarn-1.21-graphicsmagick-1.3.34
2020-07-28 23:09:34 +05:30
variables:
WEBPACK_VENDOR_DLL: "true"
2020-03-13 15:44:24 +05:30
stage: prepare
2020-06-23 00:09:42 +05:30
script:
- node --version
- run_timed_command "retry yarn install --frozen-lockfile"
- free -m
- run_timed_command "bin/rake gitlab:assets:compile > assets-compile.log 2>&1"
- run_timed_command "scripts/clean-old-cached-assets"
compile-production-assets:
extends:
- .compile-assets-base
- .frontend:rules:compile-production-assets
2019-07-31 22:56:46 +05:30
variables:
NODE_ENV: "production"
RAILS_ENV: "production"
WEBPACK_REPORT: "true"
2019-12-04 20:38:33 +05:30
artifacts:
name: webpack-report
expire_in: 31d
paths:
2020-04-22 19:07:51 +05:30
- assets-compile.log
2020-05-24 23:13:21 +05:30
# These assets are used in multiple locations:
# - in `build-assets-image` job to create assets image for packaging systems
# - GitLab UI for integration tests: https://gitlab.com/gitlab-org/gitlab-ui/-/blob/e88493b3c855aea30bf60baee692a64606b0eb1e/.storybook/preview-head.pug#L1
2020-06-23 00:09:42 +05:30
- public/assets/
- webpack-report/
2020-04-22 19:07:51 +05:30
when: always
2020-06-23 00:09:42 +05:30
after_script:
2019-09-04 21:01:54 +05:30
- rm -f /etc/apt/sources.list.d/google*.list # We don't need to update Chrome here
2019-07-31 22:56:46 +05:30
2020-06-23 00:09:42 +05:30
compile-test-assets:
2020-03-13 15:44:24 +05:30
extends:
2020-06-23 00:09:42 +05:30
- .compile-assets-base
- .frontend:rules:compile-test-assets
2019-07-31 22:56:46 +05:30
artifacts:
expire_in: 7d
paths:
2020-04-22 19:07:51 +05:30
- assets-compile.log
2020-06-23 00:09:42 +05:30
- public/assets/
- node_modules/@gitlab/svgs/dist/icons.json # app/helpers/icons_helper.rb uses this file
2020-04-22 19:07:51 +05:30
when: always
2019-09-30 21:07:59 +05:30
2020-06-23 00:09:42 +05:30
compile-test-assets as-if-foss:
2020-03-13 15:44:24 +05:30
extends:
2020-06-23 00:09:42 +05:30
- compile-test-assets
- .frontend:rules:compile-test-assets-as-if-foss
- .as-if-foss
2019-09-30 21:07:59 +05:30
2020-06-23 00:09:42 +05:30
update-assets-compile-production-cache:
2020-03-13 15:44:24 +05:30
extends:
2020-06-23 00:09:42 +05:30
- compile-production-assets
- .shared:rules:update-cache
stage: prepare
artifacts: {} # This job's purpose is only to update the cache.
2019-12-21 20:55:43 +05:30
cache:
2020-06-23 00:09:42 +05:30
policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up.
2019-12-21 20:55:43 +05:30
2020-06-23 00:09:42 +05:30
update-assets-compile-test-cache:
2020-03-13 15:44:24 +05:30
extends:
2020-06-23 00:09:42 +05:30
- compile-test-assets
- .shared:rules:update-cache
stage: prepare
artifacts: {} # This job's purpose is only to update the cache.
2019-12-21 20:55:43 +05:30
cache:
2020-06-23 00:09:42 +05:30
policy: push # We want to rebuild the cache from scratch to ensure stale dependencies are cleaned up.
2019-12-21 20:55:43 +05:30
2020-06-23 00:09:42 +05:30
update-yarn-cache:
2020-03-13 15:44:24 +05:30
extends:
2020-06-23 00:09:42 +05:30
- .default-retry
- .yarn-cache
- .shared:rules:update-cache
stage: prepare
script:
- source scripts/utils.sh
- run_timed_command "retry yarn install --frozen-lockfile"
2019-12-04 20:38:33 +05:30
cache:
2020-06-23 00:09:42 +05:30
policy: push
2020-04-08 14:13:33 +05:30
.frontend-fixtures-base:
2019-12-04 20:38:33 +05:30
extends:
2020-06-23 00:09:42 +05:30
- .frontend-base
2020-05-24 23:13:21 +05:30
- .rails-cache
2020-04-22 19:07:51 +05:30
- .use-pg11
2020-04-08 14:13:33 +05:30
stage: fixtures
2020-06-23 00:09:42 +05:30
needs: ["setup-test-env", "compile-test-assets"]
variables:
SETUP_DB: "true"
2020-07-28 23:09:34 +05:30
WEBPACK_VENDOR_DLL: "true"
2020-04-08 14:13:33 +05:30
script:
2020-05-24 23:13:21 +05:30
- run_timed_command "scripts/gitaly-test-build"
- run_timed_command "scripts/gitaly-test-spawn"
2020-06-23 00:09:42 +05:30
- run_timed_command "bin/rake frontend:fixtures"
2020-04-08 14:13:33 +05:30
artifacts:
name: frontend-fixtures
expire_in: 31d
when: always
paths:
- tmp/tests/frontend/
frontend-fixtures:
extends:
- .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs
frontend-fixtures-as-if-foss:
extends:
- .frontend-fixtures-base
2020-05-24 23:13:21 +05:30
- .frontend:rules:default-frontend-jobs-as-if-foss
2020-04-08 14:13:33 +05:30
- .as-if-foss
2020-06-23 00:09:42 +05:30
.frontend-test-base:
2020-04-08 14:13:33 +05:30
extends:
2020-07-28 23:09:34 +05:30
- .frontend-base
2020-06-23 00:09:42 +05:30
- .yarn-cache
2020-04-08 14:13:33 +05:30
variables:
USE_BUNDLE_INSTALL: "false"
2019-12-21 20:55:43 +05:30
stage: test
2020-07-28 23:09:34 +05:30
eslint-as-if-foss:
extends:
- .frontend-test-base
- .frontend:rules:eslint-as-if-foss
- .as-if-foss
needs: []
script:
- run_timed_command "retry yarn install --frozen-lockfile"
- yarn run eslint
2019-07-31 22:56:46 +05:30
2019-12-21 20:55:43 +05:30
.karma-base:
2020-06-23 00:09:42 +05:30
extends: .frontend-test-base
2019-07-31 22:56:46 +05:30
script:
- export BABEL_ENV=coverage CHROME_LOG_FILE=chrome_debug.log
2020-06-23 00:09:42 +05:30
- run_timed_command "retry yarn install --frozen-lockfile"
- run_timed_command "yarn karma"
2019-12-21 20:55:43 +05:30
karma:
2020-03-13 15:44:24 +05:30
extends:
- .karma-base
- .frontend:rules:default-frontend-jobs
2020-04-08 14:13:33 +05:30
needs: ["frontend-fixtures"]
2019-07-31 22:56:46 +05:30
coverage: '/^Statements *: (\d+\.\d+%)/'
artifacts:
name: coverage-javascript
expire_in: 31d
when: always
paths:
- chrome_debug.log
- coverage-javascript/
2019-10-12 21:52:04 +05:30
- tmp/tests/frontend/
reports:
junit: junit_karma.xml
2020-07-28 23:09:34 +05:30
cobertura: coverage-javascript/cobertura-coverage.xml
2019-07-31 22:56:46 +05:30
2020-03-13 15:44:24 +05:30
karma-as-if-foss:
2019-12-21 20:55:43 +05:30
extends:
- .karma-base
2020-05-24 23:13:21 +05:30
- .frontend:rules:default-frontend-jobs-as-if-foss
2020-03-13 15:44:24 +05:30
- .as-if-foss
2020-04-08 14:13:33 +05:30
needs: ["frontend-fixtures-as-if-foss"]
2019-12-21 20:55:43 +05:30
.jest-base:
2020-06-23 00:09:42 +05:30
extends: .frontend-test-base
2019-07-31 22:56:46 +05:30
script:
2020-06-23 00:09:42 +05:30
- run_timed_command "retry yarn install --frozen-lockfile"
- run_timed_command "yarn jest --ci --coverage --testSequencer ./scripts/frontend/parallel_ci_sequencer.js"
2019-12-21 20:55:43 +05:30
jest:
2020-03-13 15:44:24 +05:30
extends:
- .jest-base
- .frontend:rules:default-frontend-jobs
2020-04-08 14:13:33 +05:30
needs: ["frontend-fixtures"]
2019-07-31 22:56:46 +05:30
artifacts:
name: coverage-frontend
expire_in: 31d
when: always
paths:
2019-09-04 21:01:54 +05:30
- coverage-frontend/
- junit_jest.xml
2019-10-12 21:52:04 +05:30
- tmp/tests/frontend/
reports:
junit: junit_jest.xml
2020-06-23 00:09:42 +05:30
parallel: 4
2019-07-31 22:56:46 +05:30
2020-05-24 23:13:21 +05:30
jest-integration:
extends:
2020-06-23 00:09:42 +05:30
- .frontend-test-base
2020-05-24 23:13:21 +05:30
- .frontend:rules:default-frontend-jobs
script:
2020-06-23 00:09:42 +05:30
- run_timed_command "retry yarn install --frozen-lockfile"
- run_timed_command "yarn jest:integration --ci"
2020-05-24 23:13:21 +05:30
needs: ["frontend-fixtures"]
2020-03-13 15:44:24 +05:30
jest-as-if-foss:
2019-12-04 20:38:33 +05:30
extends:
2019-12-21 20:55:43 +05:30
- .jest-base
2020-05-24 23:13:21 +05:30
- .frontend:rules:default-frontend-jobs-as-if-foss
2020-03-13 15:44:24 +05:30
- .as-if-foss
2020-04-08 14:13:33 +05:30
needs: ["frontend-fixtures-as-if-foss"]
2020-06-23 00:09:42 +05:30
parallel: 2
2019-07-31 22:56:46 +05:30
2020-04-08 14:13:33 +05:30
coverage-frontend:
extends:
- .default-retry
2020-05-24 23:13:21 +05:30
- .yarn-cache
- .frontend:rules:ee-mr-and-master-only
2020-04-08 14:13:33 +05:30
needs: ["jest"]
stage: post-test
before_script:
2020-05-24 23:13:21 +05:30
- source scripts/utils.sh
2020-06-23 00:09:42 +05:30
- run_timed_command "retry yarn install --frozen-lockfile"
2020-04-08 14:13:33 +05:30
script:
2020-06-23 00:09:42 +05:30
- run_timed_command "yarn node scripts/frontend/merge_coverage_frontend.js"
2020-07-28 23:09:34 +05:30
coverage: '/^Statements\s*:\s*?(\d+(?:\.\d+)?)%/'
2020-04-08 14:13:33 +05:30
artifacts:
name: coverage-frontend
expire_in: 31d
paths:
- coverage-frontend/
2020-07-28 23:09:34 +05:30
reports:
cobertura: coverage-frontend/cobertura-coverage.xml
2020-04-08 14:13:33 +05:30
2019-12-04 20:38:33 +05:30
.qa-frontend-node:
extends:
- .default-retry
2020-06-23 00:09:42 +05:30
- .yarn-cache
2020-03-13 15:44:24 +05:30
- .frontend:rules:qa-frontend-node
2019-12-21 20:55:43 +05:30
stage: test
2019-12-04 20:38:33 +05:30
dependencies: []
2019-07-31 22:56:46 +05:30
script:
2020-06-23 00:09:42 +05:30
- source scripts/utils.sh
- run_timed_command "yarn install --frozen-lockfile"
- run_timed_command "yarn run webpack-prod"
2019-07-31 22:56:46 +05:30
qa-frontend-node:10:
2019-12-04 20:38:33 +05:30
extends: .qa-frontend-node
2019-10-12 21:52:04 +05:30
image: node:dubnium
2019-07-31 22:56:46 +05:30
qa-frontend-node:latest:
2020-05-24 23:13:21 +05:30
extends:
- .qa-frontend-node
- .frontend:rules:qa-frontend-node-latest
2019-10-12 21:52:04 +05:30
image: node:latest
2019-07-31 22:56:46 +05:30
2019-12-04 20:38:33 +05:30
webpack-dev-server:
extends:
- .default-retry
2020-06-23 00:09:42 +05:30
- .yarn-cache
2020-03-13 15:44:24 +05:30
- .frontend:rules:default-frontend-jobs
2019-12-21 20:55:43 +05:30
stage: test
2020-05-24 23:13:21 +05:30
needs: []
2019-12-04 20:38:33 +05:30
variables:
WEBPACK_MEMORY_TEST: "true"
2020-01-01 13:55:28 +05:30
WEBPACK_VENDOR_DLL: "true"
2019-07-31 22:56:46 +05:30
script:
2020-05-24 23:13:21 +05:30
- source scripts/utils.sh
2020-06-23 00:09:42 +05:30
- run_timed_command "retry yarn install --frozen-lockfile"
- run_timed_command "retry yarn webpack-vendor"
- run_timed_command "node --expose-gc node_modules/.bin/webpack-dev-server --config config/webpack.config.js"
2020-01-01 13:55:28 +05:30
artifacts:
name: webpack-dev-server
expire_in: 31d
paths:
- webpack-dev-server.json
2020-06-23 00:09:42 +05:30
bundle-size-review:
extends:
- .default-retry
- .frontend:rules:bundle-size-review
image: registry.gitlab.com/gitlab-org/gitlab-build-images:danger
stage: test
needs: ["compile-production-assets"]
script:
- mkdir -p bundle-size-review
- cp webpack-report/index.html bundle-size-review/bundle-report.html
- yarn global add https://gitlab.com/gitlab-org/frontend/playground/webpack-memory-metrics.git
- danger --dangerfile=danger/bundle_size/Dangerfile --fail-on-errors=true --verbose --danger_id=bundle-size-review
artifacts:
when: always
name: bundle-size-review
expire_in: 31d
paths:
- bundle-size-review