gitlab-org--gitlab-foss/.gitlab/ci/frontend.gitlab-ci.yml

292 lines
7.7 KiB
YAML
Raw Normal View History

# Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-default: &if-default
if: '$CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ || $CI_COMMIT_REF_NAME =~ /^\d+-\d+-auto-deploy-\d+$/ || $CI_COMMIT_REF_NAME =~ /^security\// || $CI_MERGE_REQUEST_IID || $CI_COMMIT_TAG'
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-default-ee: &if-default-ee
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME =~ /^[\d-]+-stable(-ee)?$/ || $CI_COMMIT_REF_NAME =~ /^\d+-\d+-auto-deploy-\d+$/ || $CI_COMMIT_REF_NAME =~ /^security\// || $CI_MERGE_REQUEST_IID || $CI_COMMIT_TAG) && $CI_PROJECT_NAME =~ /^gitlab(-ee)?$/'
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-master: &if-master
if: '$CI_COMMIT_REF_NAME == "master"'
# Make sure to update all the similar patterns in other CI config files if you modify these patterns
.code-backstage-patterns: &code-backstage-patterns
- ".gitlab/ci/**/*"
- ".{eslintignore,gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}"
- ".{codeclimate,eslintrc,gitlab-ci,haml-lint,haml-lint_todo,rubocop,rubocop_todo,scss-lint}.yml"
- ".csscomb.json"
- "Dockerfile.assets"
- "*_VERSION"
- "Gemfile{,.lock}"
- "Rakefile"
- "{babel.config,jest.config}.js"
- "config.ru"
- "{package.json,yarn.lock}"
- "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
- "doc/api/graphql/reference/*" # Files in this folder are auto-generated
# Backstage changes
- "Dangerfile"
- "danger/**/*"
- "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*"
- "doc/README.md" # Some RSpec test rely on this file
.assets-compile-cache:
2019-04-12 04:56:38 -04:00
cache:
paths:
- vendor/ruby/
- .yarn-cache/
- tmp/cache/assets/sprockets
- tmp/cache/babel-loader
- tmp/cache/vue-loader
2019-04-12 04:56:38 -04:00
.gitlab:assets:compile-metadata:
extends:
- .default-tags
- .default-retry
- .default-only
- .default-before_script
- .assets-compile-cache
- .only:changes-code-backstage-qa
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-19.03.1
stage: prepare
2019-04-12 04:56:38 -04:00
services:
- docker:19.03.0-dind
2019-04-12 04:56:38 -04:00
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
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
cache:
key: "assets-compile:production:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:tmp_cache_webpack:v7"
artifacts:
name: webpack-report
expire_in: 31d
paths:
- webpack-report/
- public/assets/
2019-04-12 04:56:38 -04:00
script:
- node --version
2019-07-02 10:29:47 -04:00
- retry yarn install --frozen-lockfile --production --cache-folder .yarn-cache --prefer-offline
2019-04-12 04:56:38 -04:00
- free -m
- retry bundle exec rake gitlab:assets:compile
2019-04-12 04:56:38 -04:00
- time scripts/build_assets_image
- scripts/clean-old-cached-assets
- 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
only:
variables:
- $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/)/ # Matches the gitlab-org group and its subgroups
- $CI_SERVER_HOST == "dev.gitlab.org"
2019-04-12 04:56:38 -04:00
tags:
- gitlab-org
- docker
2019-04-12 04:56:38 -04:00
gitlab:assets:compile pull-push-cache:
extends: .gitlab:assets:compile-metadata
only:
refs:
- master
cache:
policy: pull-push
gitlab:assets:compile pull-cache:
extends: .gitlab:assets:compile-metadata
cache:
policy: pull
.compile-assets-metadata:
extends:
- .default-tags
- .default-retry
- .default-only
- .default-before_script
- .assets-compile-cache
- .only:changes-code-backstage-qa
2019-04-12 04:56:38 -04:00
stage: prepare
script:
- node --version
2019-07-02 10:29:47 -04:00
- retry yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
2019-04-12 04:56:38 -04:00
- free -m
- retry bundle exec rake gitlab:assets:compile
2019-04-12 04:56:38 -04:00
- scripts/clean-old-cached-assets
variables:
SETUP_DB: "false"
2019-04-12 04:56:38 -04:00
# we override the max_old_space_size to prevent OOM errors
NODE_OPTIONS: --max_old_space_size=3584
cache:
key: "assets-compile:v8"
2019-04-12 04:56:38 -04:00
artifacts:
expire_in: 7d
paths:
- node_modules
- public/assets
compile-assets pull-push-cache:
extends: .compile-assets-metadata
only:
refs:
- master
cache:
policy: pull-push
compile-assets pull-push-cache foss:
extends: [".compile-assets-metadata", ".only-ee-as-if-foss"]
only:
refs:
- master
cache:
policy: pull-push
key: "assets-compile:v8:foss"
compile-assets pull-cache:
extends: .compile-assets-metadata
cache:
policy: pull
compile-assets pull-cache foss:
extends: [".compile-assets-metadata", ".only-ee-as-if-foss"]
cache:
policy: pull
key: "assets-compile:v8:foss"
2019-04-12 04:56:38 -04:00
.only-code-frontend-job-base:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-only
- .default-before_script
- .only:changes-code-backstage
- .use-pg9
stage: test
needs: ["setup-test-env", "compile-assets pull-cache"]
.karma-base:
extends: .only-code-frontend-job-base
2019-04-12 04:56:38 -04:00
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
- scripts/gitaly-test-spawn
- date
- bundle exec rake karma
karma:
extends: .karma-base
2019-04-12 04:56:38 -04:00
coverage: '/^Statements *: (\d+\.\d+%)/'
artifacts:
name: coverage-javascript
expire_in: 31d
when: always
paths:
- chrome_debug.log
- coverage-javascript/
2019-07-18 13:52:52 -04:00
- tmp/tests/frontend/
reports:
junit: junit_karma.xml
2019-04-12 04:56:38 -04:00
karma-foss:
extends:
- .karma-base
- .only-ee-as-if-foss
.jest-base:
extends: .only-code-frontend-job-base
2019-04-12 04:56:38 -04:00
script:
- scripts/gitaly-test-spawn
- date
- bundle exec rake frontend:fixtures
2019-04-12 04:56:38 -04:00
- date
- yarn jest --ci --coverage
cache:
key: jest
paths:
- tmp/jest/jest/
policy: pull-push
jest:
extends: .jest-base
2019-04-12 04:56:38 -04:00
artifacts:
name: coverage-frontend
expire_in: 31d
when: always
paths:
- coverage-frontend/
- junit_jest.xml
2019-07-18 13:52:52 -04:00
- tmp/tests/frontend/
reports:
junit: junit_jest.xml
jest-foss:
extends:
- .jest-base
- .only-ee-as-if-foss
2019-04-12 04:56:38 -04:00
cache:
policy: pull
2019-04-12 04:56:38 -04:00
.qa-frontend-node:
extends:
- .default-tags
- .default-retry
- .default-cache
stage: test
rules:
- <<: *if-master
when: on_success
dependencies: []
2019-04-12 04:56:38 -04:00
cache:
key: "$CI_JOB_NAME"
paths:
- .yarn-cache/
policy: pull-push
script:
- date
2019-07-02 10:29:47 -04:00
- yarn install --frozen-lockfile --cache-folder .yarn-cache --prefer-offline
2019-04-12 04:56:38 -04:00
- date
- yarn run webpack-prod
qa-frontend-node:8:
extends: .qa-frontend-node
image: node:carbon
2019-04-12 04:56:38 -04:00
qa-frontend-node:10:
extends: .qa-frontend-node
image: node:dubnium
2019-04-12 04:56:38 -04:00
qa-frontend-node:latest:
extends: .qa-frontend-node
image: node:latest
2019-04-12 04:56:38 -04:00
allow_failure: true
2019-09-11 12:36:18 -04:00
webpack-dev-server:
extends:
- .default-tags
- .default-retry
- .default-cache
stage: test
rules:
- <<: *if-default
changes: *code-backstage-patterns
when: on_success
needs: ["setup-test-env", "compile-assets pull-cache"]
2019-09-11 12:36:18 -04:00
variables:
WEBPACK_MEMORY_TEST: "true"
WEBPACK_VENDOR_DLL: "true"
2019-09-11 12:36:18 -04:00
script:
- yarn webpack-vendor
2019-09-11 12:36:18 -04:00
- node --expose-gc node_modules/.bin/webpack-dev-server --config config/webpack.config.js
artifacts:
name: webpack-dev-server
expire_in: 31d
paths:
- webpack-dev-server.json