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

354 lines
9.1 KiB
YAML
Raw Normal View History

2021-01-03 14:25:43 +05:30
.yarn-install: &yarn-install
- source scripts/utils.sh
- run_timed_command "retry yarn install --frozen-lockfile"
2020-06-23 00:09:42 +05:30
.compile-assets-base:
2020-07-28 23:09:34 +05:30
extends:
2021-04-29 21:17:54 +05:30
- .default-retry
- .default-before_script
2020-07-28 23:09:34 +05:30
- .assets-compile-cache
2021-04-29 21:17:54 +05:30
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.7.2-git-2.31-lfs-2.9-node-14.15-yarn-1.22-graphicsmagick-1.3.36
2020-07-28 23:09:34 +05:30
variables:
2021-04-29 21:17:54 +05:30
SETUP_DB: "false"
2020-07-28 23:09:34 +05:30
WEBPACK_VENDOR_DLL: "true"
2021-08-04 16:29:09 +05:30
# Disable warnings in browserslist which can break on backports
# https://github.com/browserslist/browserslist/blob/a287ec6/node.js#L367-L384
BROWSERSLIST_IGNORE_OLD_DATA: "true"
2020-03-13 15:44:24 +05:30
stage: prepare
2020-06-23 00:09:42 +05:30
script:
2021-01-03 14:25:43 +05:30
- *yarn-install
- run_timed_command "bin/rake gitlab:assets:compile"
2020-06-23 00:09:42 +05:30
- 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-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-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
2021-06-08 01:23:25 +05:30
- .assets-compile-cache-push
2020-06-23 00:09:42 +05:30
- .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
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
2021-06-08 01:23:25 +05:30
- .assets-compile-cache-push
2020-06-23 00:09:42 +05:30
- .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
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
2021-06-08 01:23:25 +05:30
- .yarn-cache-push
2020-06-23 00:09:42 +05:30
- .shared:rules:update-cache
stage: prepare
script:
2021-01-03 14:25:43 +05:30
- *yarn-install
2020-06-23 00:09:42 +05:30
2020-04-08 14:13:33 +05:30
.frontend-fixtures-base:
2019-12-04 20:38:33 +05:30
extends:
2021-04-29 21:17:54 +05:30
- .default-retry
- .default-before_script
2020-05-24 23:13:21 +05:30
- .rails-cache
2021-06-08 01:23:25 +05:30
- .use-pg12
2020-04-08 14:13:33 +05:30
stage: fixtures
2021-01-29 00:20:46 +05:30
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-test-assets"]
2020-06-23 00:09:42 +05:30
variables:
2020-07-28 23:09:34 +05:30
WEBPACK_VENDOR_DLL: "true"
2020-04-08 14:13:33 +05:30
script:
2021-01-29 00:20:46 +05:30
- run_timed_command "gem install knapsack --no-document"
2020-05-24 23:13:21 +05:30
- run_timed_command "scripts/gitaly-test-spawn"
2021-01-29 00:20:46 +05:30
- source ./scripts/rspec_helpers.sh
- rspec_paralellized_job "--tag frontend_fixture"
2020-04-08 14:13:33 +05:30
artifacts:
name: frontend-fixtures
expire_in: 31d
when: always
paths:
- tmp/tests/frontend/
2021-01-29 00:20:46 +05:30
- knapsack/
2020-04-08 14:13:33 +05:30
2021-01-29 00:20:46 +05:30
rspec frontend_fixture:
2020-04-08 14:13:33 +05:30
extends:
- .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs
2021-01-29 00:20:46 +05:30
rspec frontend_fixture as-if-foss:
2020-04-08 14:13:33 +05:30
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
2021-01-29 00:20:46 +05:30
rspec-ee frontend_fixture:
extends:
- .frontend-fixtures-base
2021-06-08 01:23:25 +05:30
- .frontend:rules:default-frontend-jobs-ee
2021-01-29 00:20:46 +05:30
parallel: 2
2021-04-17 20:07:23 +05:30
graphql-schema-dump:
variables:
SETUP_DB: "false"
extends:
- .default-retry
- .rails-cache
- .default-before_script
- .frontend:rules:default-frontend-jobs
stage: fixtures
needs: []
script:
- bundle exec rake gitlab:graphql:schema:dump
artifacts:
name: graphql-schema
paths:
- tmp/tests/graphql/gitlab_schema.graphql
- tmp/tests/graphql/gitlab_schema.json
2020-06-23 00:09:42 +05:30
.frontend-test-base:
2020-04-08 14:13:33 +05:30
extends:
2021-04-29 21:17:54 +05:30
- .default-retry
2020-06-23 00:09:42 +05:30
- .yarn-cache
2021-08-04 16:29:09 +05:30
variables:
# Disable warnings in browserslist which can break on backports
# https://github.com/browserslist/browserslist/blob/a287ec6/node.js#L367-L384
BROWSERSLIST_IGNORE_OLD_DATA: "true"
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:
2021-01-03 14:25:43 +05:30
- *yarn-install
2021-06-08 01:23:25 +05:30
- run_timed_command "yarn run lint:eslint:all"
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
2021-01-03 14:25:43 +05:30
- *yarn-install
2020-06-23 00:09:42 +05:30
- 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
2021-06-08 01:23:25 +05:30
needs:
- job: "rspec frontend_fixture"
- job: "rspec-ee frontend_fixture"
optional: true
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
2021-01-29 00:20:46 +05:30
needs: ["rspec frontend_fixture 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:
2021-01-03 14:25:43 +05:30
- *yarn-install
2020-06-23 00:09:42 +05:30
- 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
2021-06-08 01:23:25 +05:30
needs:
- job: "rspec frontend_fixture"
- job: "rspec-ee frontend_fixture"
optional: true
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:
2021-01-03 14:25:43 +05:30
- *yarn-install
2020-06-23 00:09:42 +05:30
- run_timed_command "yarn jest:integration --ci"
2021-06-08 01:23:25 +05:30
needs:
- job: "rspec frontend_fixture"
- job: "rspec-ee frontend_fixture"
optional: true
- job: "graphql-schema-dump"
2020-05-24 23:13:21 +05:30
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
2021-01-29 00:20:46 +05:30
needs: ["rspec frontend_fixture 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
2021-04-29 21:17:54 +05:30
- .frontend:rules:ee-mr-and-default-branch-only
2020-04-08 14:13:33 +05:30
needs: ["jest"]
stage: post-test
before_script:
2021-01-03 14:25:43 +05:30
- *yarn-install
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"
2021-03-08 18:12:59 +05:30
# Removing the individual coverage results, as we just merged them.
- rm -r coverage-frontend/jest-*
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:
2021-01-03 14:25:43 +05:30
- *yarn-install
- run_timed_command "retry 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
2021-03-11 19:13:27 +05:30
image: ${GITLAB_DEPENDENCY_PROXY}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
2021-03-11 19:13:27 +05:30
image: ${GITLAB_DEPENDENCY_PROXY}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:
2021-01-03 14:25:43 +05:30
- *yarn-install
2020-06-23 00:09:42 +05:30
- 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
2021-09-04 01:27:46 +05:30
.startup-css-check-base:
extends:
- .frontend-test-base
script:
- *yarn-install
- run_timed_command "yarn generate:startup_css"
- yarn check:startup_css
startup-css-check:
extends:
- .startup-css-check-base
- .frontend:rules:default-frontend-jobs
needs:
- job: "compile-test-assets"
- job: "rspec frontend_fixture"
- job: "rspec-ee frontend_fixture"
optional: true
startup-css-check as-if-foss:
extends:
- .startup-css-check-base
- .as-if-foss
- .frontend:rules:default-frontend-jobs-as-if-foss
needs:
- job: "compile-test-assets as-if-foss"
- job: "rspec frontend_fixture as-if-foss"