Commit f963f761 authored by Robert Speicher's avatar Robert Speicher

Merge branch '31463-group-all-linters' into 'master'

Resolve "Consider grouping all static analysis jobs into a single one"

Closes #31463

See merge request !10946
parents 623eb34f 9b3f728c
......@@ -253,38 +253,32 @@ spinach mysql 9 10: *spinach-knapsack-mysql
SETUP_DB: "false"
USE_BUNDLE_INSTALL: "true"
.exec: &exec
.rake-exec: &rake-exec
<<: *ruby-static-analysis
<<: *dedicated-runner
<<: *except-docs
stage: test
script:
- bundle exec $CI_JOB_NAME
- bundle exec rake $CI_JOB_NAME
rubocop:
static-analysis:
<<: *ruby-static-analysis
<<: *dedicated-runner
<<: *except-docs
stage: test
script:
- bundle exec "rubocop --require rubocop-rspec"
rake haml_lint: *exec
rake scss_lint: *exec
rake config_lint: *exec
rake brakeman: *exec
rake flay: *exec
license_finder: *exec
rake downtime_check:
<<: *exec
- scripts/static-analysis
downtime_check:
<<: *rake-exec
except:
- master
- tags
- /^[\d-]+-stable(-ee)?$/
- /^docs\/*/
rake ee_compat_check:
<<: *exec
ee_compat_check:
<<: *rake-exec
only:
- branches@gitlab-org/gitlab-ce
except:
......@@ -309,12 +303,12 @@ rake ee_compat_check:
script:
- bundle exec rake db:migrate:reset
rake pg db:migrate:reset:
db:migrate:reset pg:
<<: *db-migrate-reset
<<: *use-pg
<<: *except-docs
rake mysql db:migrate:reset:
db:migrate:reset mysql:
<<: *db-migrate-reset
<<: *use-mysql
<<: *except-docs
......@@ -326,12 +320,12 @@ rake mysql db:migrate:reset:
- bundle exec rake db:rollback STEP=120
- bundle exec rake db:migrate
rake pg db:rollback:
db:rollback pg:
<<: *db-rollback
<<: *use-pg
<<: *except-docs
rake mysql db:rollback:
db:rollback mysql:
<<: *db-rollback
<<: *use-mysql
<<: *except-docs
......@@ -353,17 +347,17 @@ rake mysql db:rollback:
paths:
- log/development.log
rake pg db:seed_fu:
db:seed_fu pg:
<<: *db-seed_fu
<<: *use-pg
<<: *except-docs
rake mysql db:seed_fu:
db:seed_fu mysql:
<<: *db-seed_fu
<<: *use-mysql
<<: *except-docs
rake gitlab:assets:compile:
gitlab:assets:compile:
stage: test
<<: *dedicated-runner
<<: *except-docs
......@@ -383,7 +377,7 @@ rake gitlab:assets:compile:
paths:
- webpack-report/
rake karma:
karma:
cache:
paths:
- vendor/ruby
......@@ -402,16 +396,6 @@ rake karma:
paths:
- coverage-javascript/
docs:check:apilint:
image: "phusion/baseimage"
stage: test
<<: *dedicated-runner
cache: {}
dependencies: []
before_script: []
script:
- scripts/lint-doc.sh
docs:check:links:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:nanoc-bootstrap-ruby-2.4-alpine"
stage: test
......@@ -459,11 +443,11 @@ bundler:audit:
- . scripts/prepare_build.sh
- bundle exec rake db:migrate
migration pg paths:
migration path pg:
<<: *migration-paths
<<: *use-pg
migration mysql paths:
migration path mysql:
<<: *migration-paths
<<: *use-mysql
......@@ -485,14 +469,6 @@ coverage:
- coverage/index.html
- coverage/assets/
lint:javascript:
<<: *dedicated-runner
<<: *except-docs
stage: test
before_script: []
script:
- yarn run eslint
lint:javascript:report:
<<: *dedicated-runner
<<: *except-docs
......@@ -548,8 +524,8 @@ pages:
<<: *dedicated-runner
dependencies:
- coverage
- rake karma
- rake gitlab:assets:compile
- karma
- gitlab:assets:compile
- lint:javascript:report
script:
- mv public/ .public/
......
......@@ -21,4 +21,3 @@ fi
echo "✔ Linting passed"
exit 0
#!/usr/bin/env ruby
require ::File.expand_path('../lib/gitlab/popen', __dir__)
tasks = [
%w[bundle exec rake config_lint],
%w[bundle exec rake flay],
%w[bundle exec rake haml_lint],
%w[bundle exec rake scss_lint],
%w[bundle exec rake brakeman],
%w[bundle exec license_finder],
%w[scripts/lint-doc.sh],
%w[yarn run eslint],
%w[bundle exec rubocop --require rubocop-rspec]
]
failed_tasks = tasks.reduce({}) do |failures, task|
output, status = Gitlab::Popen.popen(task)
puts "Running: #{task.join(' ')}"
puts output
failures[task.join(' ')] = output unless status.zero?
failures
end
if failed_tasks.empty?
puts 'All static analyses passed successfully.'
else
puts "\n===================================================\n\n"
puts "Some static analyses failed:"
failed_tasks.each do |failed_task, output|
puts "\n**** #{failed_task} failed with the following error:\n\n"
puts output
end
exit 1
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment