2020-10-08 18:08:32 +00:00
.yarn-install : &yarn-install
- source scripts/utils.sh
- run_timed_command "retry yarn install --frozen-lockfile"
2021-06-18 12:10:03 +00:00
.storybook-yarn-install : &storybook-yarn-install
- source scripts/utils.sh
- run_timed_command "retry yarn run storybook:install --frozen-lockfile"
2020-06-02 12:08:33 +00:00
.compile-assets-base :
2020-07-09 09:09:27 +00:00
extends :
2021-04-08 12:09:18 +00:00
- .default-retry
- .default-before_script
2020-07-09 09:09:27 +00:00
- .assets-compile-cache
2022-02-14 06:12:49 +00:00
image : ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images:debian-bullseye-ruby-2.7-git-2.33-lfs-2.9-node-14.15-yarn-1.22-graphicsmagick-1.3.36
2020-07-09 09:09:27 +00:00
variables :
2021-04-08 12:09:18 +00:00
SETUP_DB : "false"
2020-07-09 09:09:27 +00:00
WEBPACK_VENDOR_DLL : "true"
2021-07-27 21:09:42 +00:00
# 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-24 12:08:01 +00:00
stage : prepare
2020-06-02 12:08:33 +00:00
script :
2020-10-08 18:08:32 +00:00
- *yarn-install
2020-09-23 15:10:14 +00:00
- run_timed_command "bin/rake gitlab:assets:compile"
2020-06-02 12:08:33 +00:00
- run_timed_command "scripts/clean-old-cached-assets"
compile-production-assets :
extends :
- .compile-assets-base
- .frontend:rules:compile-production-assets
2019-04-12 08:56:38 +00:00
variables :
NODE_ENV : "production"
RAILS_ENV : "production"
WEBPACK_REPORT : "true"
2019-08-26 20:41:55 +00:00
artifacts :
name : webpack-report
expire_in : 31d
paths :
2020-04-30 09:09:39 +00:00
# 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-02 12:08:33 +00:00
- public/assets/
- webpack-report/
2020-03-19 15:09:41 +00:00
when : always
2021-07-19 18:08:23 +00:00
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-02 12:08:33 +00:00
after_script :
2019-06-05 16:31:35 +00:00
- rm -f /etc/apt/sources.list.d/google*.list # We don't need to update Chrome here
2019-04-12 08:56:38 +00:00
2020-06-02 12:08:33 +00:00
compile-test-assets :
2020-02-18 15:08:51 +00:00
extends :
2020-06-02 12:08:33 +00:00
- .compile-assets-base
- .frontend:rules:compile-test-assets
2019-04-12 08:56:38 +00:00
artifacts :
expire_in : 7d
paths :
2020-06-02 12:08:33 +00:00
- public/assets/
- node_modules/@gitlab/svgs/dist/icons.json # app/helpers/icons_helper.rb uses this file
2020-04-01 06:07:50 +00:00
when : always
2019-06-14 10:13:35 +00:00
2020-06-02 12:08:33 +00:00
compile-test-assets as-if-foss :
2020-02-18 15:08:51 +00:00
extends :
2020-06-02 12:08:33 +00:00
- compile-test-assets
- .frontend:rules:compile-test-assets-as-if-foss
- .as-if-foss
2019-06-14 10:13:35 +00:00
2021-10-13 21:09:56 +00:00
compile-test-assets as-if-jh :
extends :
- compile-test-assets
- .frontend:rules:compile-test-assets-as-if-jh
needs : [ "add-jh-folder" ]
2020-06-02 12:08:33 +00:00
update-assets-compile-production-cache :
2020-01-28 18:08:35 +00:00
extends :
2020-06-02 12:08:33 +00:00
- compile-production-assets
2021-05-18 12:10:26 +00:00
- .assets-compile-cache-push
2020-06-02 12:08:33 +00:00
- .shared:rules:update-cache
stage : prepare
artifacts : {} # This job's purpose is only to update the cache.
2019-10-16 18:08:01 +00:00
2020-06-02 12:08:33 +00:00
update-assets-compile-test-cache :
2020-02-18 15:08:51 +00:00
extends :
2020-06-02 12:08:33 +00:00
- compile-test-assets
2021-05-18 12:10:26 +00:00
- .assets-compile-cache-push
2020-06-02 12:08:33 +00:00
- .shared:rules:update-cache
stage : prepare
artifacts : {} # This job's purpose is only to update the cache.
2019-10-16 18:08:01 +00:00
2020-06-02 12:08:33 +00:00
update-yarn-cache :
2020-01-28 18:08:35 +00:00
extends :
2020-06-02 12:08:33 +00:00
- .default-retry
2021-05-18 12:10:26 +00:00
- .yarn-cache-push
2020-06-02 12:08:33 +00:00
- .shared:rules:update-cache
stage : prepare
script :
2020-10-08 18:08:32 +00:00
- *yarn-install
2020-06-02 12:08:33 +00:00
2021-06-18 12:10:03 +00:00
update-storybook-yarn-cache :
extends :
- .default-retry
- .storybook-yarn-cache-push
- .shared:rules:update-cache
stage : prepare
script :
- *storybook-yarn-install
2020-02-20 12:08:51 +00:00
.frontend-fixtures-base :
2019-08-26 20:41:55 +00:00
extends :
2021-04-08 12:09:18 +00:00
- .default-retry
- .default-before_script
2020-05-19 09:08:12 +00:00
- .rails-cache
2021-05-10 12:10:26 +00:00
- .use-pg12
2020-02-20 12:08:51 +00:00
stage : fixtures
2021-10-13 21:09:56 +00:00
needs : [ "setup-test-env" , "retrieve-tests-metadata" ]
2020-06-02 12:08:33 +00:00
variables :
2020-07-09 09:09:27 +00:00
WEBPACK_VENDOR_DLL : "true"
2020-02-20 12:08:51 +00:00
script :
2020-11-10 15:09:14 +00:00
- run_timed_command "gem install knapsack --no-document"
2020-05-19 09:08:12 +00:00
- run_timed_command "scripts/gitaly-test-spawn"
2020-11-10 15:09:14 +00:00
- source ./scripts/rspec_helpers.sh
2021-06-29 15:07:48 +00:00
- rspec_paralellized_job
2020-02-20 12:08:51 +00:00
artifacts :
name : frontend-fixtures
expire_in : 31d
when : always
paths :
- tmp/tests/frontend/
2020-11-10 15:09:14 +00:00
- knapsack/
2021-11-10 00:11:48 +00:00
- crystalball/
2020-02-20 12:08:51 +00:00
2021-10-13 21:09:56 +00:00
# Builds FOSS, and EE fixtures in the EE project.
# Builds FOSS fixtures in the FOSS project.
2021-10-04 18:12:46 +00:00
rspec-all frontend_fixture :
2020-02-20 12:08:51 +00:00
extends :
- .frontend-fixtures-base
- .frontend:rules:default-frontend-jobs
2021-10-13 21:09:56 +00:00
needs :
- !reference [.frontend-fixtures-base, needs]
- "compile-test-assets"
2021-10-04 18:12:46 +00:00
parallel : 5
2020-02-20 12:08:51 +00:00
2021-10-13 21:09:56 +00:00
# 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-02-20 12:08:51 +00:00
extends :
- .frontend-fixtures-base
2020-05-15 15:08:04 +00:00
- .frontend:rules:default-frontend-jobs-as-if-foss
2020-02-20 12:08:51 +00:00
- .as-if-foss
2021-10-13 21:09:56 +00:00
needs :
- !reference [.frontend-fixtures-base, needs]
- "compile-test-assets as-if-foss"
# 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 :
extends :
- .frontend-fixtures-base
- .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."
2020-02-20 12:08:51 +00:00
2021-02-19 15:10:30 +00:00
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-02 12:08:33 +00:00
.frontend-test-base :
2020-02-20 12:08:51 +00:00
extends :
2021-04-08 12:09:18 +00:00
- .default-retry
2020-06-02 12:08:33 +00:00
- .yarn-cache
2021-07-27 21:09:42 +00:00
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-09-08 09:09:10 +00:00
before_script :
- *yarn-install
2019-10-16 18:08:01 +00:00
stage : test
2020-07-09 09:09:27 +00:00
2019-10-04 15:06:38 +00:00
.jest-base :
2020-06-02 12:08:33 +00:00
extends : .frontend-test-base
2019-04-12 08:56:38 +00:00
script :
2021-09-08 09:09:10 +00:00
- run_timed_command "yarn jest:ci"
2019-10-04 15:06:38 +00:00
jest :
2020-02-18 15:08:51 +00:00
extends :
- .jest-base
2021-09-08 09:09:10 +00:00
- .frontend:rules:jest
2021-10-13 21:09:56 +00:00
needs : [ "rspec-all frontend_fixture" ]
2019-04-12 08:56:38 +00:00
artifacts :
name : coverage-frontend
expire_in : 31d
when : always
paths :
2019-06-05 16:31:35 +00:00
- coverage-frontend/
- junit_jest.xml
2019-07-18 17:52:52 +00:00
- tmp/tests/frontend/
2019-07-19 06:53:53 +00:00
reports :
junit : junit_jest.xml
2021-07-28 12:10:41 +00:00
parallel : 5
2019-10-04 15:06:38 +00:00
2021-09-08 09:09:10 +00:00
jest minimal :
extends :
- jest
- .frontend:rules:jest:minimal
2021-10-13 21:09:56 +00:00
needs :
- !reference [jest, needs]
- "detect-tests"
2021-09-08 09:09:10 +00:00
script :
- run_timed_command "yarn jest:ci:minimal"
2020-05-15 21:08:21 +00:00
jest-integration :
2020-05-16 03:08:23 +00:00
extends :
2020-06-02 12:08:33 +00:00
- .frontend-test-base
2020-05-16 03:08:23 +00:00
- .frontend:rules:default-frontend-jobs
2020-05-15 21:08:21 +00:00
script :
2020-06-02 12:08:33 +00:00
- run_timed_command "yarn jest:integration --ci"
2021-04-28 12:10:09 +00:00
needs :
2021-10-04 18:12:46 +00:00
- job : "rspec-all frontend_fixture"
2021-04-28 12:10:09 +00:00
- job : "graphql-schema-dump"
2020-05-15 21:08:21 +00:00
2020-02-18 15:08:51 +00:00
jest-as-if-foss :
2019-10-04 15:06:38 +00:00
extends :
- .jest-base
2020-05-15 15:08:04 +00:00
- .frontend:rules:default-frontend-jobs-as-if-foss
2020-02-04 09:08:32 +00:00
- .as-if-foss
2021-10-13 21:09:56 +00:00
needs : [ "rspec-all frontend_fixture as-if-foss" ]
2020-06-16 03:08:24 +00:00
parallel : 2
2019-04-12 08:56:38 +00:00
2021-10-13 21:09:56 +00:00
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-02-26 09:08:47 +00:00
coverage-frontend :
extends :
- .default-retry
2020-05-15 15:08:04 +00:00
- .yarn-cache
2021-03-30 15:11:08 +00:00
- .frontend:rules:ee-mr-and-default-branch-only
2021-09-08 09:09:10 +00:00
needs :
- job : "jest"
optional : true
- job : "jest minimal"
optional : true
2020-02-26 09:08:47 +00:00
stage : post-test
before_script :
2020-10-08 18:08:32 +00:00
- *yarn-install
2020-02-26 09:08:47 +00:00
script :
2020-06-02 12:08:33 +00:00
- run_timed_command "yarn node scripts/frontend/merge_coverage_frontend.js"
2021-01-12 06:10:31 +00:00
# Removing the individual coverage results, as we just merged them.
- rm -r coverage-frontend/jest-*
2020-07-08 15:09:24 +00:00
coverage : '/^Statements\s*:\s*?(\d+(?:\.\d+)?)%/'
2020-02-26 09:08:47 +00:00
artifacts :
name : coverage-frontend
expire_in : 31d
paths :
- coverage-frontend/
2020-06-23 15:08:41 +00:00
reports :
cobertura : coverage-frontend/cobertura-coverage.xml
2020-02-26 09:08:47 +00:00
2019-08-26 20:41:55 +00:00
.qa-frontend-node :
extends :
- .default-retry
2020-06-02 12:08:33 +00:00
- .yarn-cache
2020-02-18 15:08:51 +00:00
- .frontend:rules:qa-frontend-node
2019-10-16 18:08:01 +00:00
stage : test
2019-08-26 20:41:55 +00:00
dependencies : [ ]
2019-04-12 08:56:38 +00:00
script :
2020-10-08 18:08:32 +00:00
- *yarn-install
- run_timed_command "retry yarn run webpack-prod"
2019-04-12 08:56:38 +00:00
2021-08-20 12:09:31 +00:00
qa-frontend-node:12 :
2019-08-26 20:41:55 +00:00
extends : .qa-frontend-node
2021-08-20 12:09:31 +00:00
image : ${GITLAB_DEPENDENCY_PROXY}node:12
qa-frontend-node:14 :
extends : .qa-frontend-node
image : ${GITLAB_DEPENDENCY_PROXY}node:14
2019-04-12 08:56:38 +00:00
qa-frontend-node:latest :
2020-05-07 09:09:51 +00:00
extends :
- .qa-frontend-node
- .frontend:rules:qa-frontend-node-latest
2021-02-03 18:09:25 +00:00
image : ${GITLAB_DEPENDENCY_PROXY}node:latest
2019-09-11 16:36:18 +00:00
webpack-dev-server :
extends :
- .default-retry
2020-06-02 12:08:33 +00:00
- .yarn-cache
2020-02-18 15:08:51 +00:00
- .frontend:rules:default-frontend-jobs
2019-10-16 18:08:01 +00:00
stage : test
2020-04-23 21:09:31 +00:00
needs : [ ]
2019-09-11 16:36:18 +00:00
variables :
WEBPACK_MEMORY_TEST : "true"
2019-12-17 09:07:48 +00:00
WEBPACK_VENDOR_DLL : "true"
2019-09-11 16:36:18 +00:00
script :
2020-10-08 18:08:32 +00:00
- *yarn-install
2020-06-02 12:08:33 +00:00
- run_timed_command "retry yarn webpack-vendor"
- run_timed_command "node --expose-gc node_modules/.bin/webpack-dev-server --config config/webpack.config.js"
2019-12-04 15:11:23 +00:00
artifacts :
name : webpack-dev-server
expire_in : 31d
paths :
- webpack-dev-server.json
2020-05-20 18:08:00 +00:00
bundle-size-review :
extends :
- .default-retry
- .frontend:rules:bundle-size-review
2021-12-14 18:11:35 +00:00
image : ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images:danger
2020-05-20 18:08:00 +00:00
stage : test
2020-06-02 12:08:33 +00:00
needs : [ "compile-production-assets" ]
2020-05-20 18:08:00 +00:00
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-06-03 18:09:58 +00:00
.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-10-04 18:12:46 +00:00
- job : "rspec-all frontend_fixture"
2021-06-03 18:09:58 +00:00
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-10-13 21:09:56 +00:00
- job : "rspec-all frontend_fixture as-if-foss"
2021-06-18 12:10:03 +00:00
.compile-storybook-base :
extends :
- .frontend-test-base
- .storybook-yarn-cache
script :
- *storybook-yarn-install
- yarn run storybook:build
2021-10-13 21:09:56 +00:00
needs : [ "graphql-schema-dump" ]
2021-06-18 12:10:03 +00:00
compile-storybook :
extends :
- .compile-storybook-base
- .frontend:rules:default-frontend-jobs
2021-09-30 18:11:31 +00:00
needs :
2021-10-13 21:09:56 +00:00
- !reference [.compile-storybook-base, needs]
2021-10-04 18:12:46 +00:00
- job : "rspec-all frontend_fixture"
2021-06-18 12:10:03 +00:00
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-09-30 18:11:31 +00:00
needs :
2021-10-13 21:09:56 +00:00
- !reference [.compile-storybook-base, needs]
- job : "rspec-all frontend_fixture as-if-foss"