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

337 lines
8.3 KiB
YAML
Raw Normal View History

2019-12-04 20:38:33 +05:30
.assets-compile-cache:
2019-07-31 22:56:46 +05:30
cache:
paths:
- vendor/ruby/
2020-04-22 19:07:51 +05:30
- public/assets/webpack/
- assets-hash.txt
2019-07-31 22:56:46 +05:30
- .yarn-cache/
- tmp/cache/assets/sprockets
2020-03-13 15:44:24 +05:30
- tmp/cache/babel-loader
- tmp/cache/vue-loader
2020-04-08 14:13:33 +05:30
- tmp/cache/webpack-dlls
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
.gitlab:assets:compile-metadata:
2019-12-04 20:38:33 +05:30
extends:
- .default-retry
- .default-before_script
- .assets-compile-cache
2020-05-24 23:13:21 +05:30
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.6-git-2.26-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-graphicsmagick-1.3.34-docker-19.03.1
2020-03-13 15:44:24 +05:30
stage: prepare
2019-07-31 22:56:46 +05:30
variables:
NODE_ENV: "production"
RAILS_ENV: "production"
SETUP_DB: "false"
SKIP_STORAGE_VALIDATION: "true"
WEBPACK_REPORT: "true"
# we override the max_old_space_size to prevent OOM errors
NODE_OPTIONS: --max_old_space_size=3584
2019-12-04 20:38:33 +05:30
cache:
2020-04-22 19:07:51 +05:30
key: "assets-compile:production:v1"
2019-12-04 20:38:33 +05:30
artifacts:
name: webpack-report
expire_in: 31d
paths:
- webpack-report/
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
- public/assets
2020-04-22 19:07:51 +05:30
when: always
2019-07-31 22:56:46 +05:30
script:
- node --version
2019-09-30 21:07:59 +05:30
- retry yarn install --frozen-lockfile --production --cache-folder .yarn-cache --prefer-offline
2019-07-31 22:56:46 +05:30
- free -m
2020-04-22 19:07:51 +05:30
- time bin/rake gitlab:assets:compile > assets-compile.log 2>&1
2019-07-31 22:56:46 +05:30
- scripts/clean-old-cached-assets
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
2019-12-21 20:55:43 +05:30
gitlab:assets:compile pull-push-cache:
2020-03-13 15:44:24 +05:30
extends:
- .gitlab:assets:compile-metadata
- .frontend:rules:gitlab-assets-compile-pull-push-cache
2019-09-30 21:07:59 +05:30
cache:
policy: pull-push
gitlab:assets:compile pull-cache:
2020-03-13 15:44:24 +05:30
extends:
- .gitlab:assets:compile-metadata
- .frontend:rules:gitlab-assets-compile-pull-cache
2019-12-04 20:38:33 +05:30
cache:
policy: pull
2019-09-30 21:07:59 +05:30
2020-05-24 23:13:21 +05:30
build-assets-image:
extends:
- .use-kaniko
- .frontend:rules:gitlab-assets-compile-pull-cache
stage: build-images
needs: ["gitlab:assets:compile pull-cache"]
variables:
GIT_DEPTH: "1"
script:
# TODO: Change the image tag to be the MD5 of assets files and skip image building if the image exists
# We'll also need to pass GITLAB_ASSETS_TAG to the trigerred omnibus-gitlab pipeline similarly to how we do it for trigerred CNG pipelines
# https://gitlab.com/gitlab-org/gitlab/issues/208389
- scripts/build_assets_image
2019-09-30 21:07:59 +05:30
.compile-assets-metadata:
2019-12-04 20:38:33 +05:30
extends:
- .default-retry
- .default-before_script
- .assets-compile-cache
2019-07-31 22:56:46 +05:30
stage: prepare
script:
- node --version
2019-09-30 21:07:59 +05:30
- retry yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
2019-07-31 22:56:46 +05:30
- free -m
2020-04-22 19:07:51 +05:30
- time bin/rake gitlab:assets:compile > assets-compile.log 2>&1
2019-07-31 22:56:46 +05:30
- scripts/clean-old-cached-assets
variables:
2020-01-01 13:55:28 +05:30
SETUP_DB: "false"
2019-07-31 22:56:46 +05:30
# we override the max_old_space_size to prevent OOM errors
NODE_OPTIONS: --max_old_space_size=3584
2020-04-08 14:13:33 +05:30
WEBPACK_VENDOR_DLL: "true"
2019-12-04 20:38:33 +05:30
cache:
2020-04-22 19:07:51 +05:30
key: "assets-compile:test:v1"
2019-07-31 22:56:46 +05:30
artifacts:
expire_in: 7d
paths:
- node_modules
- public/assets
2020-04-22 19:07:51 +05:30
- assets-compile.log
when: always
2019-09-30 21:07:59 +05:30
2019-12-21 20:55:43 +05:30
compile-assets pull-push-cache:
2020-03-13 15:44:24 +05:30
extends:
- .compile-assets-metadata
- .frontend:rules:compile-assets-pull-push-cache
2019-09-30 21:07:59 +05:30
cache:
policy: pull-push
2020-03-13 15:44:24 +05:30
compile-assets pull-push-cache as-if-foss:
extends:
- .compile-assets-metadata
- .frontend:rules:compile-assets-pull-push-cache-as-if-foss
- .as-if-foss
2019-12-21 20:55:43 +05:30
cache:
policy: pull-push
2020-04-22 19:07:51 +05:30
key: "assets-compile:test:as-if-foss:v1"
2019-12-21 20:55:43 +05:30
compile-assets pull-cache:
2020-03-13 15:44:24 +05:30
extends:
- .compile-assets-metadata
- .frontend:rules:compile-assets-pull-cache
2019-12-21 20:55:43 +05:30
cache:
policy: pull
2020-03-13 15:44:24 +05:30
compile-assets pull-cache as-if-foss:
extends:
- .compile-assets-metadata
- .frontend:rules:compile-assets-pull-cache-as-if-foss
- .as-if-foss
2019-12-04 20:38:33 +05:30
cache:
policy: pull
2020-04-22 19:07:51 +05:30
key: "assets-compile:test:as-if-foss:v1"
2019-12-04 20:38:33 +05:30
2020-04-08 14:13:33 +05:30
.frontend-fixtures-base:
2019-12-04 20:38:33 +05:30
extends:
- .default-retry
2020-05-24 23:13:21 +05:30
- .rails-cache
2019-12-04 20:38:33 +05:30
- .default-before_script
2020-04-22 19:07:51 +05:30
- .use-pg11
2020-04-08 14:13:33 +05:30
stage: fixtures
2020-05-24 23:13:21 +05:30
needs: ["setup-test-env", "compile-assets pull-cache"]
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"
- run_timed_command "bundle exec rake frontend:fixtures"
2020-04-08 14:13:33 +05:30
artifacts:
name: frontend-fixtures
expire_in: 31d
when: always
paths:
- node_modules
- public/assets
- 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
.frontend-job-base:
extends:
- .default-retry
- .default-cache
- .default-before_script
variables:
USE_BUNDLE_INSTALL: "false"
SETUP_DB: "false"
2019-12-21 20:55:43 +05:30
stage: test
2019-07-31 22:56:46 +05:30
2019-12-21 20:55:43 +05:30
.karma-base:
2020-03-13 15:44:24 +05:30
extends: .frontend-job-base
2019-07-31 22:56:46 +05:30
variables:
# we override the max_old_space_size to prevent OOM errors
NODE_OPTIONS: --max_old_space_size=3584
script:
- export BABEL_ENV=coverage CHROME_LOG_FILE=chrome_debug.log
- date
2020-04-08 14:13:33 +05:30
- 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
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-03-13 15:44:24 +05:30
extends: .frontend-job-base
2019-07-31 22:56:46 +05:30
script:
- date
2020-04-08 14:13:33 +05:30
- yarn jest --ci --coverage --testSequencer ./scripts/frontend/parallel_ci_sequencer.js
2019-12-21 20:55:43 +05:30
cache:
key: jest
paths:
2020-04-08 14:13:33 +05:30
- tmp/cache/jest/
2019-12-21 20:55:43 +05:30
policy: pull-push
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-04-08 14:13:33 +05:30
parallel: 2
2019-07-31 22:56:46 +05:30
2020-05-24 23:13:21 +05:30
jest-integration:
extends:
- .frontend-job-base
- .frontend:rules:default-frontend-jobs
script:
- date
- yarn jest:integration --ci
needs: ["frontend-fixtures"]
cache:
key: jest-integration
paths:
- tmp/cache/jest/
policy: pull-push
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"]
2019-12-21 20:55:43 +05:30
cache:
policy: pull
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
- retry yarn install --frozen-lockfile
2020-04-08 14:13:33 +05:30
script:
- yarn node scripts/frontend/merge_coverage_frontend.js
artifacts:
name: coverage-frontend
expire_in: 31d
paths:
- coverage-frontend/
cache:
2020-05-24 23:13:21 +05:30
policy: pull
2020-04-08 14:13:33 +05:30
2019-12-04 20:38:33 +05:30
.qa-frontend-node:
extends:
- .default-retry
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
cache:
key: "$CI_JOB_NAME"
paths:
- .yarn-cache/
policy: pull-push
script:
- date
2019-09-30 21:07:59 +05:30
- yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
2019-07-31 22:56:46 +05:30
- date
- yarn run webpack-prod
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-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"
2020-05-24 23:13:21 +05:30
cache:
key:
files:
- yarn.lock
prefix: "v1"
paths:
- node_modules/
- tmp/cache/webpack-dlls/
2019-07-31 22:56:46 +05:30
script:
2020-05-24 23:13:21 +05:30
- source scripts/utils.sh
- retry yarn install --frozen-lockfile
- retry yarn webpack-vendor
2019-12-04 20:38:33 +05:30
- 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