class Autoproj::CLI::MainCI
CLI
interface for autoproj-ci
Public Instance Methods
build(*args)
click to toggle source
# File lib/autoproj/cli/main_ci.rb, line 17 def build(*args) if (cache = options.delete(:cache)) cache = File.expand_path(cache) require 'autoproj/cli/base' Autoproj::CLI::Base.validate_options(args, options) results = cache_pull(cache, ignore: options.delete(:cache_ignore)) pulled_packages = results .map { |name, pkg| name if pkg['cached'] } .compact not_args = ['--not', *pulled_packages] unless pulled_packages.empty? end args << "--progress=#{options[:progress] ? 't' : 'f'}" args << "--color=#{options[:color] ? 't' : 'f'}" Process.exec(Gem.ruby, $PROGRAM_NAME, 'build', '--interactive=f', *args, *not_args) end
build_cache_cleanup(dir)
click to toggle source
# File lib/autoproj/cli/main_ci.rb, line 161 def build_cache_cleanup(dir) dir = File.expand_path(dir) require 'autoproj/cli/ci' cli = CI.new _, options = cli.validate_options(dir, self.options) cli.cleanup_build_cache(dir, options[:max_size] * 1_000_000_000) end
cache_pull(dir, ignore: [])
click to toggle source
# File lib/autoproj/cli/main_ci.rb, line 98 def cache_pull(dir, ignore: []) dir = File.expand_path(dir) require 'autoproj/cli/ci' results = nil cli = CI.new _, options = cli.validate_options(dir, self.options) report = options.delete(:report) # options[:ignore] is not set if we call from another # command, e.g. build ignore += (options.delete(:ignore) || []) results = cli.cache_pull(*dir, ignore: ignore, **options) if report && !report.empty? File.open(report, 'w') do |io| JSON.dump( { 'cache_pull_report' => { 'packages' => results } }, io ) end end results end
cache_push(dir)
click to toggle source
# File lib/autoproj/cli/main_ci.rb, line 133 def cache_push(dir) dir = File.expand_path(dir) require 'autoproj/cli/ci' cli = CI.new _, options = cli.validate_options(dir, self.options) report = options.delete(:report) results = cli.cache_push(dir, **options) if report && !report.empty? File.open(report, 'w') do |io| JSON.dump( { 'cache_push_report' => { 'packages' => results } }, io ) end end end
create_report(path)
click to toggle source
# File lib/autoproj/cli/main_ci.rb, line 175 def create_report(path) path = File.expand_path(path) require 'autoproj/cli/ci' cli = CI.new args, options = cli.validate_options(path, self.options) cli.create_report(*args, **options) end
process_test_results()
click to toggle source
# File lib/autoproj/cli/main_ci.rb, line 57 def process_test_results require 'autoproj/cli/ci' cli = CI.new cli.validate_options([], options.dup) cli.process_test_results( force: options[:force], xunit_viewer: options[:xunit_viewer] ) end
status(dir)
click to toggle source
# File lib/autoproj/cli/main_ci.rb, line 70 def status(dir) cache = File.expand_path(dir) require 'autoproj/cli/ci' cli = CI.new cli.validate_options(dir, options) results = cli.cache_state(cache) results.keys.sort.each do |name| status = results[name] fields = [] fields << if status['cached'] Autoproj.color('cache hit', :green) else Autoproj.color('cache miss', :red) end fields << "fingerprint=#{status['fingerprint']}" puts "#{name}: #{fields.join(', ')}" end end
test(*args)
click to toggle source
# File lib/autoproj/cli/main_ci.rb, line 37 def test(*args) require 'autoproj/cli/ci' cli = CI.new cli.validate_options([], options.dup) report = cli.consolidated_report built_packages = report['packages'].find_all do |_name, info| info['build'] && !info['build']['cached'] && info['build']['success'] end return if built_packages.empty? built_package_names = built_packages.map(&:first) Process.exec(Gem.ruby, $PROGRAM_NAME, 'test', 'exec', '--interactive=f', *args, *built_package_names) end