2022-01-26 12:08:38 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-16 23:28:13 +05:30
|
|
|
# rubocop:disable Rails/RakeEnvironment
|
2022-01-26 12:08:38 +05:30
|
|
|
namespace :knapsack do
|
2022-07-16 23:28:13 +05:30
|
|
|
desc "Run tests with knapsack runner"
|
|
|
|
task :rspec, [:rspec_args] do |_, args|
|
|
|
|
rspec_args = args[:rspec_args]&.split(' ') || []
|
|
|
|
|
|
|
|
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")
|
|
|
|
|
|
|
|
exit RSpec::Core::Runner.run([*rspec_args, "qa/specs/features"])
|
|
|
|
end
|
|
|
|
|
|
|
|
exit QA::Specs::KnapsackRunner.run(rspec_args)
|
|
|
|
end
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
desc "Download latest knapsack report or multiple reports passed via QA_KNAPSACK_REPORTS env variable"
|
2022-01-26 12:08:38 +05:30
|
|
|
task :download do
|
2022-07-23 23:45:48 +05:30
|
|
|
next QA::Support::KnapsackReport.download_report unless ENV["QA_KNAPSACK_REPORTS"]
|
|
|
|
|
|
|
|
ENV["QA_KNAPSACK_REPORTS"].split(",").each do |report_name|
|
|
|
|
QA::Support::KnapsackReport.new(report_name).download_report
|
|
|
|
rescue StandardError => e
|
|
|
|
QA::Runtime::Logger.error(e)
|
|
|
|
end
|
2022-01-26 12:08:38 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
desc "Merge and upload knapsack report"
|
2022-03-02 08:16:31 +05:30
|
|
|
task :upload, [:glob] do |_task, args|
|
2022-07-16 23:28:13 +05:30
|
|
|
QA::Support::KnapsackReport.upload_report(args[:glob])
|
2022-03-02 08:16:31 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
desc "Report long running spec files"
|
|
|
|
task :notify_long_running_specs do
|
2022-07-23 23:45:48 +05:30
|
|
|
QA::Tools::LongRunningSpecReporter.execute
|
2022-01-26 12:08:38 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
# rubocop:enable Rails/RakeEnvironment
|