2021-12-07 18:10:32 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-05-06 12:09:05 +00:00
|
|
|
# rubocop:disable Rails/RakeEnvironment
|
2021-12-07 18:10:32 +00:00
|
|
|
namespace :knapsack do
|
2022-04-30 00:09:38 +00:00
|
|
|
desc "Run tests with knapsack runner"
|
|
|
|
task :rspec, [:rspec_args] do |_, args|
|
2022-05-05 12:08:03 +00:00
|
|
|
rspec_args = args[:rspec_args]&.split(' ') || []
|
|
|
|
|
2022-05-04 18:08:35 +00:00
|
|
|
unless QA::Runtime::Env.knapsack?
|
|
|
|
QA::Runtime::Logger.info("This environment is not compatible with parallel knapsack execution!")
|
|
|
|
QA::Runtime::Logger.info("Falling back to standard execution")
|
|
|
|
|
2022-05-05 12:08:03 +00:00
|
|
|
exit RSpec::Core::Runner.run([*rspec_args, "qa/specs/features"])
|
2022-05-04 18:08:35 +00:00
|
|
|
end
|
2022-04-30 00:09:38 +00:00
|
|
|
|
2022-05-05 12:08:03 +00:00
|
|
|
exit QA::Specs::KnapsackRunner.run(rspec_args)
|
2022-04-30 00:09:38 +00:00
|
|
|
end
|
|
|
|
|
2021-12-07 18:10:32 +00:00
|
|
|
desc "Download latest knapsack report"
|
|
|
|
task :download do
|
2022-05-11 18:07:55 +00:00
|
|
|
QA::Support::KnapsackReport.download_report
|
2021-12-07 18:10:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Merge and upload knapsack report"
|
2021-12-28 21:16:11 +00:00
|
|
|
task :upload, [:glob] do |_task, args|
|
2022-04-30 00:09:38 +00:00
|
|
|
QA::Support::KnapsackReport.upload_report(args[:glob])
|
2021-12-07 18:10:32 +00:00
|
|
|
end
|
2022-01-15 00:15:15 +00:00
|
|
|
|
|
|
|
desc "Report long running spec files"
|
|
|
|
task :notify_long_running_specs do
|
2022-04-30 00:09:38 +00:00
|
|
|
QA::Support::LongRunningSpecReporter.execute
|
2022-01-15 00:15:15 +00:00
|
|
|
end
|
2021-12-07 18:10:32 +00:00
|
|
|
end
|
2022-05-06 12:09:05 +00:00
|
|
|
# rubocop:enable Rails/RakeEnvironment
|