diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4a9574be0535383cd238cd976e57276ba6980c23..5524c9a7fcbc436bb6f334f5f4223b45fc81640f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,35 +9,57 @@ before_script: - touch log/test.log - bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}" - bundle exec rake db:create RAILS_ENV=test -Rspec: + +spec:feature: + script: + - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:feature + tags: + - ruby + - mysql + +spec:api: + script: + - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:api + tags: + - ruby + - mysql + +spec:other: + script: + - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:other + tags: + - ruby + - mysql + +spinach:project: script: - - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec + - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project tags: - ruby - mysql -Spinach: +spinach:other: script: - - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach + - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:other tags: - ruby - mysql -Jasmine: +jasmine:ci: script: - RAILS_ENV=test SIMPLECOV=true bundle exec rake jasmine:ci tags: - ruby - mysql -Rubocop: +rubocop: script: - bundle exec rubocop tags: - ruby - mysql -Brakeman: +brakeman: script: - bundle exec rake brakeman tags: diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature index 90b966dd6455a54115c85f82f644eb0a829420c5..af68cb96ed9e259ce922606531998ac1a7607ea8 100644 --- a/features/project/source/browse_files.feature +++ b/features/project/source/browse_files.feature @@ -45,7 +45,7 @@ Feature: Project Source Browse Files Then I am redirected to the new file on new branch And I should see its new content - @javascript @tricky + @javascript Scenario: I can create file in empty repo Given I own an empty project And I visit my empty project page diff --git a/lib/tasks/cache.rake b/lib/tasks/cache.rake index 753a5a11070b9f9565b5d552c96d2119437df4b0..1728dda72cf3e7657e66ba7dbe016666d3d3dae2 100644 --- a/lib/tasks/cache.rake +++ b/lib/tasks/cache.rake @@ -1,5 +1,5 @@ namespace :cache do - desc "GITLAB | Clear redis cache" + desc "GitLab | Clear redis cache" task :clear => :environment do # Hack into Rails.cache until https://github.com/redis-store/redis-store/pull/225 # is accepted (I hope) and we can update the redis-store gem. diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index b22c631c8ba89bac18a4e549839e5b4c3fe495a6..6f27972c4e4667c9d1c7db33c73ec5777acfd6fb 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -1,14 +1,14 @@ task dev: ["dev:setup"] namespace :dev do - desc "GITLAB | Setup developer environment (db, fixtures)" + desc "GitLab | Setup developer environment (db, fixtures)" task :setup => :environment do ENV['force'] = 'yes' Rake::Task["gitlab:setup"].invoke Rake::Task["gitlab:shell:setup"].invoke end - desc 'GITLAB | Start/restart foreman and watch for changes' + desc 'GitLab | Start/restart foreman and watch for changes' task :foreman => :environment do sh 'rerun --dir app,config,lib -- foreman start' end diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index 84445b3bf2fc7ee529f20c24ac70a6abccf471f8..4c73f90bbf25a14ad8e3dfd4196538bc08846000 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -3,7 +3,7 @@ require 'active_record/fixtures' namespace :gitlab do namespace :backup do # Create backup of GitLab system - desc "GITLAB | Create a backup of the GitLab system" + desc "GitLab | Create a backup of the GitLab system" task create: :environment do warn_user_is_not_gitlab configure_cron_mode @@ -19,7 +19,7 @@ namespace :gitlab do end # Restore backup of GitLab system - desc "GITLAB | Restore a previously created backup" + desc "GitLab | Restore a previously created backup" task restore: :environment do warn_user_is_not_gitlab configure_cron_mode diff --git a/lib/tasks/gitlab/bulk_add_permission.rake b/lib/tasks/gitlab/bulk_add_permission.rake index 3d8c171dfa3f1368cd38f0880cb1390d403a6896..5dbf7d61e0662387a6c1ef14929eaf544bac3e40 100644 --- a/lib/tasks/gitlab/bulk_add_permission.rake +++ b/lib/tasks/gitlab/bulk_add_permission.rake @@ -1,6 +1,6 @@ namespace :gitlab do namespace :import do - desc "GITLAB | Add all users to all projects (admin users are added as masters)" + desc "GitLab | Add all users to all projects (admin users are added as masters)" task all_users_to_all_projects: :environment do |t, args| user_ids = User.where(admin: false).pluck(:id) admin_ids = User.where(admin: true).pluck(:id) @@ -13,7 +13,7 @@ namespace :gitlab do ProjectMember.add_users_into_projects(projects_ids, admin_ids, ProjectMember::MASTER) end - desc "GITLAB | Add a specific user to all projects (as a developer)" + desc "GitLab | Add a specific user to all projects (as a developer)" task :user_to_projects, [:email] => :environment do |t, args| user = User.find_by(email: args.email) project_ids = Project.pluck(:id) @@ -21,7 +21,7 @@ namespace :gitlab do ProjectMember.add_users_into_projects(project_ids, Array.wrap(user.id), ProjectMember::DEVELOPER) end - desc "GITLAB | Add all users to all groups (admin users are added as owners)" + desc "GitLab | Add all users to all groups (admin users are added as owners)" task all_users_to_all_groups: :environment do |t, args| user_ids = User.where(admin: false).pluck(:id) admin_ids = User.where(admin: true).pluck(:id) @@ -35,7 +35,7 @@ namespace :gitlab do end end - desc "GITLAB | Add a specific user to all groups (as a developer)" + desc "GitLab | Add a specific user to all groups (as a developer)" task :user_to_groups, [:email] => :environment do |t, args| user = User.find_by_email args.email groups = Group.all diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 75bd41f2838cc3878df0c28756cc5b1b4d9e1882..aed84226a2f39dd59f5e75d9166c33f73ae1da8c 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -1,5 +1,5 @@ namespace :gitlab do - desc "GITLAB | Check the configuration of GitLab and its environment" + desc "GitLab | Check the configuration of GitLab and its environment" task check: %w{gitlab:gitlab_shell:check gitlab:sidekiq:check gitlab:ldap:check @@ -8,7 +8,7 @@ namespace :gitlab do namespace :app do - desc "GITLAB | Check the configuration of the GitLab Rails app" + desc "GitLab | Check the configuration of the GitLab Rails app" task check: :environment do warn_user_is_not_gitlab start_checking "GitLab" @@ -329,7 +329,7 @@ namespace :gitlab do end namespace :gitlab_shell do - desc "GITLAB | Check the configuration of GitLab Shell" + desc "GitLab | Check the configuration of GitLab Shell" task check: :environment do warn_user_is_not_gitlab start_checking "GitLab Shell" @@ -574,7 +574,7 @@ namespace :gitlab do namespace :sidekiq do - desc "GITLAB | Check the configuration of Sidekiq" + desc "GitLab | Check the configuration of Sidekiq" task check: :environment do warn_user_is_not_gitlab start_checking "Sidekiq" @@ -667,7 +667,7 @@ namespace :gitlab do end namespace :repo do - desc "GITLAB | Check the integrity of the repositories managed by GitLab" + desc "GitLab | Check the integrity of the repositories managed by GitLab" task check: :environment do namespace_dirs = Dir.glob( File.join(Gitlab.config.gitlab_shell.repos_path, '*') diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake index d49cb6778f1f61bbdae0a9dba303f90afb684056..6b1e371614706036a5aff815c2d4239037dd89a1 100644 --- a/lib/tasks/gitlab/cleanup.rake +++ b/lib/tasks/gitlab/cleanup.rake @@ -1,6 +1,6 @@ namespace :gitlab do namespace :cleanup do - desc "GITLAB | Cleanup | Clean namespaces" + desc "GitLab | Cleanup | Clean namespaces" task dirs: :environment do warn_user_is_not_gitlab remove_flag = ENV['REMOVE'] @@ -43,7 +43,7 @@ namespace :gitlab do end end - desc "GITLAB | Cleanup | Clean repositories" + desc "GitLab | Cleanup | Clean repositories" task repos: :environment do warn_user_is_not_gitlab remove_flag = ENV['REMOVE'] @@ -85,7 +85,7 @@ namespace :gitlab do end end - desc "GITLAB | Cleanup | Block users that have been removed in LDAP" + desc "GitLab | Cleanup | Block users that have been removed in LDAP" task block_removed_ldap_users: :environment do warn_user_is_not_gitlab block_flag = ENV['BLOCK'] diff --git a/lib/tasks/gitlab/enable_automerge.rake b/lib/tasks/gitlab/enable_automerge.rake index aa9869daf2f9e3afef4f19179e3c9e8cb6512ad3..3dade9d75b8b9b0905aef24a94eb87c03fe1a58d 100644 --- a/lib/tasks/gitlab/enable_automerge.rake +++ b/lib/tasks/gitlab/enable_automerge.rake @@ -1,6 +1,6 @@ namespace :gitlab do namespace :satellites do - desc "GITLAB | Create satellite repos" + desc "GitLab | Create satellite repos" task create: :environment do create_satellites end diff --git a/lib/tasks/gitlab/generate_docs.rake b/lib/tasks/gitlab/generate_docs.rake index 332cd61f84c29f0fba46b6f0151534ec842bb366..f6448c38e1006b2d7c3c320070d579e68ee59259 100644 --- a/lib/tasks/gitlab/generate_docs.rake +++ b/lib/tasks/gitlab/generate_docs.rake @@ -1,5 +1,5 @@ namespace :gitlab do - desc "GITLAB | Generate sdocs for project" + desc "GitLab | Generate sdocs for project" task generate_docs: :environment do system(*%W(bundle exec sdoc -o doc/code app lib)) end diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake index 7c98ad3144f6dda5e0e55c8dba5260dbca1f6f1c..5f83e5e8e7ff29f23dd1f2bbd09ee966edb0fb59 100644 --- a/lib/tasks/gitlab/import.rake +++ b/lib/tasks/gitlab/import.rake @@ -9,7 +9,7 @@ namespace :gitlab do # * The project owner will set to the first administator of the system # * Existing projects will be skipped # - desc "GITLAB | Import bare repositories from gitlab_shell -> repos_path into GitLab project instance" + desc "GitLab | Import bare repositories from gitlab_shell -> repos_path into GitLab project instance" task repos: :environment do git_base_path = Gitlab.config.gitlab_shell.repos_path diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake index 72452e1d8eab2b30e6629eb80c464a67af24a987..bf221f06d3bff2ec6e2f239db9274b31c4e744f2 100644 --- a/lib/tasks/gitlab/info.rake +++ b/lib/tasks/gitlab/info.rake @@ -1,6 +1,6 @@ namespace :gitlab do namespace :env do - desc "GITLAB | Show information about GitLab and its environment" + desc "GitLab | Show information about GitLab and its environment" task info: :environment do # check if there is an RVM environment diff --git a/lib/tasks/gitlab/setup.rake b/lib/tasks/gitlab/setup.rake index 8b4ccdfc3fe01eb0b7ad8308746024c02bec7875..0ac4b0fa8a36d6cc25bb8ddee696a6a4a747381e 100644 --- a/lib/tasks/gitlab/setup.rake +++ b/lib/tasks/gitlab/setup.rake @@ -1,5 +1,5 @@ namespace :gitlab do - desc "GITLAB | Setup production application" + desc "GitLab | Setup production application" task setup: :environment do setup_db end diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index afdaba11cb056836f48b46278d18764e00cd45b0..3c0cc763d171dc0c8e0999169af09ae8f99ef0eb 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -1,6 +1,6 @@ namespace :gitlab do namespace :shell do - desc "GITLAB | Install or upgrade gitlab-shell" + desc "GitLab | Install or upgrade gitlab-shell" task :install, [:tag, :repo] => :environment do |t, args| warn_user_is_not_gitlab @@ -75,12 +75,12 @@ namespace :gitlab do end end - desc "GITLAB | Setup gitlab-shell" + desc "GitLab | Setup gitlab-shell" task setup: :environment do setup end - desc "GITLAB | Build missing projects" + desc "GitLab | Build missing projects" task build_missing_projects: :environment do Project.find_each(batch_size: 1000) do |project| path_to_repo = project.repository.path_to_repo diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake index b4c0ae3ff79a5c21de9a39815c319670b234d944..cbb3d61af044d286ef21d97eb7093f16fdadd700 100644 --- a/lib/tasks/gitlab/test.rake +++ b/lib/tasks/gitlab/test.rake @@ -1,5 +1,5 @@ namespace :gitlab do - desc "GITLAB | Run all tests" + desc "GitLab | Run all tests" task :test do cmds = [ %W(rake brakeman), diff --git a/lib/tasks/gitlab/web_hook.rake b/lib/tasks/gitlab/web_hook.rake index 412bcad12293461389afa8b6dcce6cc9c9fa0832..76e443e55ee2564198f1f1658b503c75aec21764 100644 --- a/lib/tasks/gitlab/web_hook.rake +++ b/lib/tasks/gitlab/web_hook.rake @@ -1,6 +1,6 @@ namespace :gitlab do namespace :web_hook do - desc "GITLAB | Adds a web hook to the projects" + desc "GitLab | Adds a web hook to the projects" task :add => :environment do web_hook_url = ENV['URL'] namespace_path = ENV['NAMESPACE'] @@ -20,7 +20,7 @@ namespace :gitlab do end end - desc "GITLAB | Remove a web hook from the projects" + desc "GitLab | Remove a web hook from the projects" task :rm => :environment do web_hook_url = ENV['URL'] namespace_path = ENV['NAMESPACE'] @@ -33,7 +33,7 @@ namespace :gitlab do puts "#{count} web hooks were removed." end - desc "GITLAB | List web hooks" + desc "GitLab | List web hooks" task :list => :environment do namespace_path = ENV['NAMESPACE'] diff --git a/lib/tasks/migrate/add_limits_mysql.rake b/lib/tasks/migrate/add_limits_mysql.rake index a1972a682d8512766e8dd6b6c6d24ab44c812461..6ded519aff269c6f4e3a5df2964882bec670c400 100644 --- a/lib/tasks/migrate/add_limits_mysql.rake +++ b/lib/tasks/migrate/add_limits_mysql.rake @@ -1,6 +1,6 @@ require Rails.root.join('db/migrate/limits_to_mysql') -desc "GITLAB | Add limits to strings in mysql database" +desc "GitLab | Add limits to strings in mysql database" task add_limits_mysql: :environment do puts "Adding limits to schema.rb for mysql" LimitsToMysql.new.up diff --git a/lib/tasks/migrate/migrate_iids.rake b/lib/tasks/migrate/migrate_iids.rake index 33271e1a2bbf55baa14ad703a7a98a86d46061f8..d258c6fd08dc4dc33d07b9aede6972c39a76855f 100644 --- a/lib/tasks/migrate/migrate_iids.rake +++ b/lib/tasks/migrate/migrate_iids.rake @@ -1,4 +1,4 @@ -desc "GITLAB | Build internal ids for issues and merge requests" +desc "GitLab | Build internal ids for issues and merge requests" task migrate_iids: :environment do puts 'Issues'.yellow Issue.where(iid: nil).find_each(batch_size: 100) do |issue| diff --git a/lib/tasks/setup.rake b/lib/tasks/setup.rake index 93701de8f6309ff9643fcdde9bfa9c653c113b6b..4c79ffbfa6b93c0377070b907e88a329a04b2876 100644 --- a/lib/tasks/setup.rake +++ b/lib/tasks/setup.rake @@ -1,4 +1,4 @@ -desc "GITLAB | Setup gitlab db" +desc "GitLab | Setup gitlab db" task :setup do Rake::Task["gitlab:setup"].invoke end diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake index e4bd6545755f27cce8f190e6c1dfa0564399bccd..d1f6ed87704f465fa2e427ec49482068bff0fb56 100644 --- a/lib/tasks/sidekiq.rake +++ b/lib/tasks/sidekiq.rake @@ -1,10 +1,10 @@ namespace :sidekiq do - desc "GITLAB | Stop sidekiq" + desc "GitLab | Stop sidekiq" task :stop do system *%W(bin/background_jobs stop) end - desc "GITLAB | Start sidekiq" + desc "GitLab | Start sidekiq" task :start do system *%W(bin/background_jobs start) end @@ -14,7 +14,7 @@ namespace :sidekiq do system *%W(bin/background_jobs restart) end - desc "GITLAB | Start sidekiq with launchd on Mac OS X" + desc "GitLab | Start sidekiq with launchd on Mac OS X" task :launchd do system *%W(bin/background_jobs start_no_deamonize) end diff --git a/lib/tasks/spec.rake b/lib/tasks/spec.rake index bee22300298156266b6797a5988b5bce47da3abe..831746815d7acdd9f144e585cfc82fc80aafc62f 100644 --- a/lib/tasks/spec.rake +++ b/lib/tasks/spec.rake @@ -1,7 +1,7 @@ Rake::Task["spec"].clear if Rake::Task.task_defined?('spec') namespace :spec do - desc 'GITLAB | Run request specs' + desc 'GitLab | Rspec | Run request specs' task :api do cmds = [ %W(rake gitlab:setup), @@ -10,7 +10,7 @@ namespace :spec do run_commands(cmds) end - desc 'GITLAB | Run feature specs' + desc 'GitLab | Rspec | Run feature specs' task :feature do cmds = [ %W(rake gitlab:setup), @@ -19,7 +19,7 @@ namespace :spec do run_commands(cmds) end - desc 'GITLAB | Run other specs' + desc 'GitLab | Rspec | Run other specs' task :other do cmds = [ %W(rake gitlab:setup), @@ -29,7 +29,7 @@ namespace :spec do end end -desc "GITLAB | Run specs" +desc "GitLab | Run specs" task :spec do cmds = [ %W(rake gitlab:setup), diff --git a/lib/tasks/spinach.rake b/lib/tasks/spinach.rake index 4aefc18ce1481b9c98754a17239ac5e16d226d57..c8881be0954cefb61356af6adff0b830976807b2 100644 --- a/lib/tasks/spinach.rake +++ b/lib/tasks/spinach.rake @@ -1,34 +1,30 @@ Rake::Task["spinach"].clear if Rake::Task.task_defined?('spinach') -desc "GITLAB | Run spinach" -task :spinach do - tags = if ENV['SEMAPHORE'] - '~@tricky' - else - '~@semaphore' - end - - cmds = [ - %W(rake gitlab:setup), - %W(spinach --tags #{tags}), - ] - run_commands(cmds) -end +namespace :spinach do + desc "GitLab | Spinach | Run project spinach features" + task :project do + cmds = [ + %W(rake gitlab:setup), + %W(spinach --tags ~@admin,~@dashboard,~@profile,~@public,~@snippets), + ] + run_commands(cmds) + end -desc "GITLAB | Run project spinach features" -task :spinach_project do - cmds = [ - %W(rake gitlab:setup), - %W(spinach --tags ~@admin,~@dashboard,~@profile,~@public,~@snippets), - ] - run_commands(cmds) + desc "GitLab | Spinach | Run other spinach features" + task :other do + cmds = [ + %W(rake gitlab:setup), + %W(spinach --tags @admin,@dashboard,@profile,@public,@snippets), + ] + run_commands(cmds) + end end -desc "GITLAB | Run other spinach features" -task :spinach_other do +desc "GitLab | Run spinach" +task :spinach do cmds = [ %W(rake gitlab:setup), - %W(spinach --tags @admin,@dashboard,@profile,@public,@snippets), + %W(spinach), ] run_commands(cmds) end diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake index a39d96498761113bae71077a64a7e02510dbe35f..b9f9c72c91ff6ce1d5d0a55f58e6f29da53bd917 100644 --- a/lib/tasks/test.rake +++ b/lib/tasks/test.rake @@ -1,6 +1,6 @@ Rake::Task["test"].clear -desc "GITLAB | Run all tests" +desc "GitLab | Run all tests" task :test do Rake::Task["gitlab:test"].invoke end @@ -8,6 +8,6 @@ end unless Rails.env.production? require 'coveralls/rake/task' Coveralls::RakeTask.new - desc "GITLAB | Run all tests on CI with simplecov" + desc "GitLab | Run all tests on CI with simplecov" task :test_ci => [:rubocop, :brakeman, 'jasmine:ci', :spinach, :spec, 'coveralls:push'] end