169 lines
4.8 KiB
YAML
169 lines
4.8 KiB
YAML
.static-analysis-base:
|
|
extends:
|
|
- .default-retry
|
|
- .default-before_script
|
|
stage: lint
|
|
needs: []
|
|
variables:
|
|
SETUP_DB: "false"
|
|
ENABLE_SPRING: "1"
|
|
# 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"
|
|
GRAPHQL_SCHEMA_APOLLO_FILE: "tmp/tests/graphql/gitlab_schema_apollo.graphql"
|
|
|
|
update-static-analysis-cache:
|
|
extends:
|
|
- .static-analysis-base
|
|
- .rubocop-job-cache-push
|
|
- .shared:rules:update-cache
|
|
stage: prepare
|
|
script:
|
|
- run_timed_command "bundle exec rubocop --parallel" # For the moment we only cache `tmp/rubocop_cache` so we don't need to run all the tasks.
|
|
|
|
static-analysis:
|
|
extends:
|
|
- .static-analysis-base
|
|
- .static-analysis-cache
|
|
- .static-analysis:rules:static-analysis
|
|
parallel: 2
|
|
script:
|
|
- run_timed_command "retry yarn install --frozen-lockfile"
|
|
- scripts/static-analysis
|
|
|
|
static-analysis as-if-foss:
|
|
extends:
|
|
- static-analysis
|
|
- .static-analysis:rules:static-analysis-as-if-foss
|
|
- .as-if-foss
|
|
|
|
static-verification-with-database:
|
|
extends:
|
|
- .static-analysis-base
|
|
- .rubocop-job-cache
|
|
- .static-analysis:rules:static-verification-with-database
|
|
- .use-pg12
|
|
script:
|
|
- bundle exec rake lint:static_verification_with_database
|
|
variables:
|
|
SETUP_DB: "true"
|
|
|
|
generate-apollo-graphql-schema:
|
|
extends:
|
|
- .static-analysis-base
|
|
- .frontend:rules:default-frontend-jobs
|
|
image:
|
|
name: ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images:apollo
|
|
entrypoint: [""]
|
|
needs: ['graphql-schema-dump']
|
|
variables:
|
|
USE_BUNDLE_INSTALL: "false"
|
|
script:
|
|
- apollo client:download-schema --config=config/apollo.config.js ${GRAPHQL_SCHEMA_APOLLO_FILE}
|
|
artifacts:
|
|
name: graphql-schema-apollo
|
|
paths:
|
|
- "${GRAPHQL_SCHEMA_APOLLO_FILE}"
|
|
|
|
generate-apollo-graphql-schema as-if-foss:
|
|
extends:
|
|
- generate-apollo-graphql-schema
|
|
- .frontend:rules:eslint-as-if-foss
|
|
- .as-if-foss
|
|
needs: ['graphql-schema-dump as-if-foss']
|
|
|
|
eslint:
|
|
extends:
|
|
- .static-analysis-base
|
|
- .yarn-cache
|
|
- .frontend:rules:default-frontend-jobs
|
|
needs: ['generate-apollo-graphql-schema']
|
|
variables:
|
|
USE_BUNDLE_INSTALL: "false"
|
|
script:
|
|
- run_timed_command "retry yarn install --frozen-lockfile"
|
|
- run_timed_command "yarn run lint:eslint:all"
|
|
|
|
eslint as-if-foss:
|
|
extends:
|
|
- eslint
|
|
- .frontend:rules:eslint-as-if-foss
|
|
- .as-if-foss
|
|
needs: ['generate-apollo-graphql-schema as-if-foss']
|
|
|
|
haml-lint:
|
|
extends:
|
|
- .static-analysis-base
|
|
- .ruby-cache
|
|
- .static-analysis:rules:haml-lint
|
|
script:
|
|
- run_timed_command "bin/rake 'haml_lint[app/views]'"
|
|
artifacts:
|
|
expire_in: 31d
|
|
when: always
|
|
paths:
|
|
- tmp/feature_flags/
|
|
|
|
haml-lint ee:
|
|
extends:
|
|
- "haml-lint"
|
|
- .static-analysis:rules:haml-lint-ee
|
|
script:
|
|
- run_timed_command "bin/rake 'haml_lint[ee/app/views]'"
|
|
|
|
rubocop:
|
|
extends:
|
|
- .static-analysis-base
|
|
- .rubocop-job-cache
|
|
- .static-analysis:rules:rubocop
|
|
needs: ["detect-tests"]
|
|
script:
|
|
- |
|
|
# For non-merge request, or when RUN_ALL_RUBOCOP is 'true', run all RuboCop rules
|
|
if [ -z "${CI_MERGE_REQUEST_IID}" ] || [ "${RUN_ALL_RUBOCOP}" == "true" ]; then
|
|
run_timed_command "bundle exec rubocop --parallel"
|
|
else
|
|
run_timed_command "bundle exec rubocop --parallel --force-exclusion $(cat tmp/changed_files.txt)"
|
|
fi
|
|
|
|
qa:metadata-lint:
|
|
extends:
|
|
- .static-analysis-base
|
|
- .static-analysis:rules:qa:metadata-lint
|
|
before_script:
|
|
- !reference [.default-before_script, before_script]
|
|
- cd qa/
|
|
- bundle_install_script
|
|
script:
|
|
- run_timed_command "bundle exec bin/qa Test::Instance::All http://localhost:3000 --test-metadata-only"
|
|
- cd ..
|
|
- run_timed_command "./scripts/qa/testcases-check qa/tmp/test-metadata.json"
|
|
- run_timed_command "./scripts/qa/quarantine-types-check qa/tmp/test-metadata.json"
|
|
variables:
|
|
USE_BUNDLE_INSTALL: "false"
|
|
SETUP_DB: "false"
|
|
QA_EXPORT_TEST_METRICS: "false"
|
|
# 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"
|
|
artifacts:
|
|
expire_in: 31d
|
|
when: always
|
|
paths:
|
|
- qa/tmp/
|
|
|
|
feature-flags-usage:
|
|
extends:
|
|
- .static-analysis-base
|
|
- .rubocop-job-cache
|
|
- .static-analysis:rules:rubocop
|
|
script:
|
|
# We need to disable the cache for this cop since it creates files under tmp/feature_flags/*.used,
|
|
# the cache would prevent these files from being created.
|
|
- run_timed_command "bundle exec rubocop --only Gitlab/MarkUsedFeatureFlags --cache false"
|
|
artifacts:
|
|
expire_in: 31d
|
|
when: always
|
|
paths:
|
|
- tmp/feature_flags/
|