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