2021-01-03 14:25:43 +05:30
.yarn-install : &yarn-install
- source scripts/utils.sh
- run_timed_command "retry yarn install --frozen-lockfile"
2021-09-30 23:02:18 +05:30
.storybook-yarn-install : &storybook-yarn-install
- source scripts/utils.sh
- run_timed_command "retry yarn run storybook: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
2022-05-07 20:08:51 +05:30
image : ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images:debian-${DEBIAN_VERSION}-ruby-2.7-git-2.33-lfs-2.9-node-16.14-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
2021-09-30 23:02:18 +05:30
before_script :
- if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA" ]; then
echo "Checking out \$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA ($CI_MERGE_REQUEST_SOURCE_BRANCH_SHA) instead of \$CI_COMMIT_SHA (merge result commit $CI_COMMIT_SHA) so that GitLab assets image tag actually reflect the commit for which assets were compiled.";
git checkout -f ${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA};
else
echo "Building the image from \$CI_COMMIT_SHA ($CI_COMMIT_SHA) for this non-merge result pipeline.";
fi;
- echo "See https://docs.gitlab.com/ee/development/testing_guide/end_to_end/index.html#with-pipeline-for-merged-results for more details.";
- !reference [.default-before_script, before_script]
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
2021-11-18 22:05:49 +05:30
compile-test-assets as-if-jh :
extends :
- compile-test-assets
- .frontend:rules:compile-test-assets-as-if-jh
needs : [ "add-jh-folder" ]
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
2021-09-30 23:02:18 +05:30
update-storybook-yarn-cache :
extends :
- .default-retry
- .storybook-yarn-cache-push
- .shared:rules:update-cache
stage : prepare
script :
- *storybook-yarn-install
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-11-18 22:05:49 +05:30
needs : [ "setup-test-env" , "retrieve-tests-metadata" ]
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
2021-09-30 23:02:18 +05:30
- rspec_paralellized_job
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/
2021-12-11 22:18:48 +05:30
- crystalball/
2020-04-08 14:13:33 +05:30
2021-11-18 22:05:49 +05:30
# Builds FOSS, and EE fixtures in the EE project.
# Builds FOSS fixtures in the FOSS project.
rspec-all frontend_fixture :
2020-04-08 14:13:33 +05:30
extends :
- .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs
2021-11-18 22:05:49 +05:30
needs :
- !reference [.frontend-fixtures-base, needs]
- "compile-test-assets"
parallel : 5
2020-04-08 14:13:33 +05:30
2021-11-18 22:05:49 +05:30
# Builds FOSS fixtures in the EE project, with the `ee/` folder removed (due to `as-if-foss`).
rspec-all 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-11-18 22:05:49 +05:30
needs :
- !reference [.frontend-fixtures-base, needs]
- "compile-test-assets as-if-foss"
2020-04-08 14:13:33 +05:30
2021-11-18 22:05:49 +05:30
# Builds FOSS, EE, and JH fixtures in the EE project, with the `jh/` folder added (due to `as-if-jh`).
rspec-all frontend_fixture as-if-jh :
2021-01-29 00:20:46 +05:30
extends :
- .frontend-fixtures-base
2021-11-18 22:05:49 +05:30
- .frontend:rules:default-frontend-jobs-as-if-jh
needs :
- !reference [.frontend-fixtures-base, needs]
- "compile-test-assets as-if-jh"
- "add-jh-folder"
script :
- echo "This job is currently doing nothing since there's no specific JH fixtures yet. To enable this job, remove this line."
2021-01-29 00:20:46 +05:30
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"
2021-11-11 11:23:49 +05:30
before_script :
- *yarn-install
2019-12-21 20:55:43 +05:30
stage : test
2020-07-28 23:09:34 +05:30
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-11-11 11:23:49 +05:30
- run_timed_command "yarn jest:ci"
2019-12-21 20:55:43 +05:30
jest :
2020-03-13 15:44:24 +05:30
extends :
- .jest-base
2021-11-11 11:23:49 +05:30
- .frontend:rules:jest
2021-11-18 22:05:49 +05:30
needs : [ "rspec-all frontend_fixture" ]
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
2021-10-27 15:23:28 +05:30
parallel : 5
2019-07-31 22:56:46 +05:30
2021-11-11 11:23:49 +05:30
jest minimal :
extends :
- jest
- .frontend:rules:jest:minimal
2021-11-18 22:05:49 +05:30
needs :
- !reference [jest, needs]
- "detect-tests"
2021-11-11 11:23:49 +05:30
script :
- run_timed_command "yarn jest:ci:minimal"
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 "yarn jest:integration --ci"
2021-06-08 01:23:25 +05:30
needs :
2021-11-18 22:05:49 +05:30
- job : "rspec-all frontend_fixture"
2021-06-08 01:23:25 +05:30
- 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-11-18 22:05:49 +05:30
needs : [ "rspec-all frontend_fixture as-if-foss" ]
2020-06-23 00:09:42 +05:30
parallel : 2
2019-07-31 22:56:46 +05:30
2021-11-18 22:05:49 +05:30
jest-as-if-jh :
extends :
- .jest-base
- .frontend:rules:default-frontend-jobs-as-if-jh
needs : [ "rspec-all frontend_fixture as-if-jh" , "add-jh-folder" ]
script :
- echo "This job is currently doing nothing since there's no specific JH Jest tests yet. To enable this job, remove this line."
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
2021-11-11 11:23:49 +05:30
needs :
- job : "jest"
optional : true
- job : "jest minimal"
optional : true
2020-04-08 14:13:33 +05:30
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 :
2022-06-02 21:05:25 +05:30
coverage_report :
coverage_format : cobertura
path : 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
2021-11-11 11:23:49 +05:30
qa-frontend-node:14 :
2019-12-04 20:38:33 +05:30
extends : .qa-frontend-node
2021-11-11 11:23:49 +05:30
image : ${GITLAB_DEPENDENCY_PROXY}node:14
2019-07-31 22:56:46 +05:30
2022-06-21 17:19:12 +05:30
qa-frontend-node:16 :
extends : .qa-frontend-node
image : ${GITLAB_DEPENDENCY_PROXY}node:16
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
2022-01-26 12:08:38 +05:30
image : ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images:danger
2020-06-23 00:09:42 +05:30
stage : test
needs : [ "compile-production-assets" ]
script :
2022-06-21 17:19:12 +05:30
- source scripts/utils.sh
2020-06-23 00:09:42 +05:30
- 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
2022-06-21 17:19:12 +05:30
- |
danger_id=$(echo -n ${DANGER_GITLAB_API_TOKEN} | md5sum | awk '{print $1}' | cut -c5-10)
run_timed_command "danger --dangerfile=danger/Dangerfile-bundle_size --fail-on-errors=true --verbose --danger_id=bundle-size-review-${danger_id}"
2020-06-23 00:09:42 +05:30
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 :
- 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"
2021-11-18 22:05:49 +05:30
- job : "rspec-all frontend_fixture"
2021-09-04 01:27:46 +05:30
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"
2021-11-18 22:05:49 +05:30
- job : "rspec-all frontend_fixture as-if-foss"
2021-09-30 23:02:18 +05:30
.compile-storybook-base :
extends :
- .frontend-test-base
- .storybook-yarn-cache
script :
- *storybook-yarn-install
- yarn run storybook:build
2021-11-18 22:05:49 +05:30
needs : [ "graphql-schema-dump" ]
2021-09-30 23:02:18 +05:30
compile-storybook :
extends :
- .compile-storybook-base
- .frontend:rules:default-frontend-jobs
2021-11-18 22:05:49 +05:30
needs :
- !reference [.compile-storybook-base, needs]
- job : "rspec-all frontend_fixture"
2021-09-30 23:02:18 +05:30
artifacts :
name : storybook
expire_in : 31d
when : always
paths :
- storybook/public
compile-storybook as-if-foss :
extends :
- .compile-storybook-base
- .as-if-foss
- .frontend:rules:default-frontend-jobs-as-if-foss
2021-11-18 22:05:49 +05:30
needs :
- !reference [.compile-storybook-base, needs]
- job : "rspec-all frontend_fixture as-if-foss"