2020-02-05 21:09:02 +00:00
|
|
|
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
|
|
|
|
.if-default-refs: &if-default-refs
|
|
|
|
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 patterns in other CI config files if you modify these patterns
|
|
|
|
.code-patterns: &code-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
|
|
|
|
|
2019-09-17 14:16:34 +00:00
|
|
|
.only-code-memory-job-base:
|
2019-08-26 20:41:55 +00:00
|
|
|
extends:
|
|
|
|
- .default-tags
|
|
|
|
- .default-retry
|
|
|
|
- .default-cache
|
|
|
|
- .default-before_script
|
2020-02-05 21:09:02 +00:00
|
|
|
rules:
|
|
|
|
- <<: *if-default-refs
|
|
|
|
changes: *code-patterns
|
|
|
|
when: on_success
|
2019-09-17 14:16:34 +00:00
|
|
|
|
|
|
|
memory-static:
|
|
|
|
extends: .only-code-memory-job-base
|
2019-08-26 20:41:55 +00:00
|
|
|
variables:
|
|
|
|
SETUP_DB: "false"
|
2019-06-13 15:14:06 +00:00
|
|
|
script:
|
|
|
|
# Uses two different reports from the 'derailed_benchmars' gem.
|
|
|
|
|
|
|
|
# Loads each of gems in the Gemfile and checks how much memory they consume when they are required.
|
|
|
|
# 'derailed_benchmarks' internally uses 'get_process_mem'
|
2019-06-19 00:52:34 +00:00
|
|
|
- bundle exec derailed bundle:mem > tmp/memory_bundle_mem.txt
|
|
|
|
- scripts/generate-gems-size-metrics-static tmp/memory_bundle_mem.txt >> 'tmp/memory_metrics.txt'
|
2019-06-13 15:14:06 +00:00
|
|
|
|
|
|
|
# Outputs detailed information about objects created while gems are loaded.
|
|
|
|
# 'derailed_benchmarks' internally uses 'memory_profiler'
|
2019-06-19 00:52:34 +00:00
|
|
|
- bundle exec derailed bundle:objects > tmp/memory_bundle_objects.txt
|
|
|
|
- scripts/generate-gems-memory-metrics-static tmp/memory_bundle_objects.txt >> 'tmp/memory_metrics.txt'
|
2019-06-13 15:14:06 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2019-06-19 00:52:34 +00:00
|
|
|
- tmp/memory_*.txt
|
2019-06-13 15:14:06 +00:00
|
|
|
reports:
|
2019-06-19 00:52:34 +00:00
|
|
|
metrics: tmp/memory_metrics.txt
|
2019-06-25 12:11:06 +00:00
|
|
|
|
|
|
|
# Show memory usage caused by invoking require per gem.
|
|
|
|
# Unlike `memory-static`, it hits the app with one request to ensure that any last minute require-s have been called.
|
|
|
|
# The application is booted in `production` environment.
|
|
|
|
# All tests are run without a webserver (directly using Rack::Mock by default).
|
|
|
|
memory-on-boot:
|
2019-08-26 20:41:55 +00:00
|
|
|
extends:
|
2019-09-17 14:16:34 +00:00
|
|
|
- .only-code-memory-job-base
|
2019-09-27 15:06:16 +00:00
|
|
|
- .use-pg10
|
2019-06-25 12:11:06 +00:00
|
|
|
variables:
|
|
|
|
NODE_ENV: "production"
|
|
|
|
RAILS_ENV: "production"
|
|
|
|
SETUP_DB: "true"
|
|
|
|
SKIP_STORAGE_VALIDATION: "true"
|
|
|
|
# we override the max_old_space_size to prevent OOM errors
|
|
|
|
NODE_OPTIONS: --max_old_space_size=3584
|
|
|
|
script:
|
|
|
|
# Both bootsnap and derailed monkey-patch Kernel#require, which leads to circular dependency
|
2019-07-19 20:00:46 +00:00
|
|
|
- ENABLE_BOOTSNAP=false PATH_TO_HIT="/users/sign_in" CUT_OFF=0.3 bundle exec derailed exec perf:mem >> 'tmp/memory_on_boot.txt'
|
2019-06-25 12:11:06 +00:00
|
|
|
- scripts/generate-memory-metrics-on-boot tmp/memory_on_boot.txt >> 'tmp/memory_on_boot_metrics.txt'
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- tmp/memory_*.txt
|
|
|
|
reports:
|
|
|
|
metrics: tmp/memory_on_boot_metrics.txt
|