autoproj-ci 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +21 -0
- data/README.md +62 -0
- data/Rakefile +10 -0
- data/autoproj-ci.gemspec +37 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/autoproj-ci.rb +6 -0
- data/lib/autoproj/ci/version.rb +7 -0
- data/lib/autoproj/cli/ci.rb +179 -0
- data/lib/autoproj/cli/main_ci.rb +95 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 807429c3a708c91b9d1f061bd3138d6ce7f6bfa63b60cb56505b8c817dc0ea9a
|
4
|
+
data.tar.gz: 0cc4aa3955d61d2b30d5aad85a49c888b4312dd12c9685ca17e8f5fc261d8fde
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dfd1ed123ab40e60b71f41925940dbb947b16d91abb5e6c8e68f66ef18283ebb97e9953c4a4f1151776d0cfe09f25d807ee884dbfcc314cee56852e5f9ccfdb2
|
7
|
+
data.tar.gz: 3824b52d7b226df53b6304d2a751357081052e50478fcd8cab4d844a5384b4d1b6b79b98fd61060f96557b8286b9eb16626836094c86768c37552b901af6f608
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at sylvain.joyeux@13robotics.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem 'autoproj', git: 'https://github.com/rock-core/autoproj'
|
4
|
+
group :vscode do
|
5
|
+
gem 'pry'
|
6
|
+
gem 'pry-byebug'
|
7
|
+
gem 'rubocop', '>= 0.6.0'
|
8
|
+
gem 'ruby-debug-ide', '>= 0.6.0'
|
9
|
+
gem 'debase', '>= 0.2.2.beta10'
|
10
|
+
gem 'solargraph'
|
11
|
+
end
|
12
|
+
|
13
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
14
|
+
|
15
|
+
# Specify your gem's dependencies in autoproj-ci.gemspec
|
16
|
+
gemspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Sylvain Joyeux
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Autoproj::CI
|
2
|
+
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Run
|
7
|
+
|
8
|
+
~~~
|
9
|
+
autoproj plugin install autoproj-ci
|
10
|
+
~~~
|
11
|
+
|
12
|
+
From within an autoproj workspace
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
### Build cache
|
17
|
+
|
18
|
+
The `autoproj ci cache-push`, `autoproj ci build` and `autoproj ci
|
19
|
+
cache-pull` subcommands allow you to save build artifacts (push) or get them
|
20
|
+
from the cache (pull and build) to avoid re-building things that are not
|
21
|
+
needed. The pull may be used to unarchive the relevant artifacts from the
|
22
|
+
archive dir into the workspace's prefix. `build` does `cache-pull` and
|
23
|
+
triggers a build that will ignore the cached packages. `cache-push` updates
|
24
|
+
the cache using the packages successfully build by the last build command.
|
25
|
+
|
26
|
+
`cache-pull` generates a JSON file that can be used to determine what has been
|
27
|
+
pulled from the cache. Cached packages can then be provided to the `--not` option
|
28
|
+
of `autoproj build`, as e.g.
|
29
|
+
|
30
|
+
~~~
|
31
|
+
autoproj build --not this_package that_package
|
32
|
+
~~~
|
33
|
+
|
34
|
+
Passing the options must be done by your build environment. It's not automatically
|
35
|
+
handled by the tools
|
36
|
+
|
37
|
+
## Development
|
38
|
+
|
39
|
+
Install the plugin with a `--path` option to use your working checkout
|
40
|
+
|
41
|
+
~~~
|
42
|
+
autoproj plugin install autoproj-ci --path /path/to/checkout
|
43
|
+
~~~
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at
|
48
|
+
https://github.com/rock-core/autoproj-ci. This project is intended to be a
|
49
|
+
safe, welcoming space for collaboration, and contributors are expected to
|
50
|
+
adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
51
|
+
conduct.
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
The gem is available as open source under the terms of the [MIT
|
56
|
+
License](https://opensource.org/licenses/MIT).
|
57
|
+
|
58
|
+
## Code of Conduct
|
59
|
+
|
60
|
+
Everyone interacting in the Autoproj::Ci project’s codebases, issue trackers,
|
61
|
+
chat rooms and mailing lists is expected to follow the [code of
|
62
|
+
conduct](https://github.com/[USERNAME]/autoproj-ci/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/autoproj-ci.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "autoproj/ci/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "autoproj-ci"
|
8
|
+
spec.version = Autoproj::CI::VERSION
|
9
|
+
spec.authors = ["Sylvain Joyeux"]
|
10
|
+
spec.email = ["sylvain.joyeux@13robotics.com"]
|
11
|
+
|
12
|
+
spec.homepage = "https://github.com/rock-core/autoproj-ci"
|
13
|
+
spec.summary = %q{plugin that provide subcommand useful in CI environments}
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
19
|
+
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
+
spec.metadata["source_code_uri"] = "https://github.com/rock-core/autoproj-ci"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_dependency 'autoproj'
|
33
|
+
spec.add_development_dependency "flexmock"
|
34
|
+
spec.add_development_dependency "bundler"
|
35
|
+
spec.add_development_dependency "rake"
|
36
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
37
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "autoproj/ci"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/autoproj-ci.rb
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
require 'autoproj/cli/inspection_tool'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
module Autoproj
|
5
|
+
module CLI
|
6
|
+
# Actual implementation of the functionality for the `autoproj ci` subcommand
|
7
|
+
#
|
8
|
+
# Autoproj internally splits the CLI definition (Thor subclass) and the
|
9
|
+
# underlying functionality of each CLI subcommand. `autoproj-ci` follows the
|
10
|
+
# same pattern, and registers its subcommand in {MainCI} while implementing
|
11
|
+
# the functionality in this class
|
12
|
+
class CI < InspectionTool
|
13
|
+
def resolve_packages
|
14
|
+
initialize_and_load
|
15
|
+
source_packages, * = finalize_setup(
|
16
|
+
[], non_imported_packages: :ignore)
|
17
|
+
source_packages.map do |pkg_name|
|
18
|
+
ws.manifest.find_autobuild_package(pkg_name)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def cache_pull(dir, silent: true)
|
23
|
+
packages = resolve_packages
|
24
|
+
|
25
|
+
memo = Hash.new
|
26
|
+
results = packages.each_with_object({}) do |pkg, h|
|
27
|
+
state, fingerprint = pull_package_from_cache(dir, pkg, memo: memo)
|
28
|
+
puts "pulled #{pkg.name} (#{fingerprint})" if state && !silent
|
29
|
+
|
30
|
+
h[pkg.name] = {
|
31
|
+
'cached' => state,
|
32
|
+
'fingerprint' => fingerprint
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
unless silent
|
37
|
+
hit = results.count { |_, info| info['cached'] }
|
38
|
+
puts "#{hit} hits, #{results.size - hit} misses"
|
39
|
+
end
|
40
|
+
|
41
|
+
results
|
42
|
+
end
|
43
|
+
|
44
|
+
def cache_push(dir, silent: true)
|
45
|
+
packages = resolve_packages
|
46
|
+
|
47
|
+
built = load_built_flags
|
48
|
+
|
49
|
+
memo = Hash.new
|
50
|
+
results = packages.each_with_object({}) do |pkg, h|
|
51
|
+
unless built[pkg.name]
|
52
|
+
next
|
53
|
+
end
|
54
|
+
|
55
|
+
state, fingerprint = push_package_to_cache(dir, pkg, memo: memo)
|
56
|
+
puts "pushed #{pkg.name} (#{fingerprint})" if state && !silent
|
57
|
+
|
58
|
+
|
59
|
+
h[pkg.name] = {
|
60
|
+
'updated' => state,
|
61
|
+
'fingerprint' => fingerprint
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
unless silent
|
66
|
+
hit = results.count { |_, info| info['updated'] }
|
67
|
+
puts "#{hit} updated packages, #{results.size - hit} reused entries"
|
68
|
+
end
|
69
|
+
|
70
|
+
results
|
71
|
+
end
|
72
|
+
|
73
|
+
# Build a report in a given directory
|
74
|
+
#
|
75
|
+
# The method itself will not archive the directory, only gather the
|
76
|
+
# information in a consistent way
|
77
|
+
def build_report(dir)
|
78
|
+
initialize_and_load
|
79
|
+
finalize_setup([], non_imported_packages: :ignore)
|
80
|
+
|
81
|
+
report = consolidated_report
|
82
|
+
FileUtils.mkdir_p dir
|
83
|
+
File.open(File.join(dir, 'report.json'), 'w') do |io|
|
84
|
+
JSON.dump(report, io)
|
85
|
+
end
|
86
|
+
|
87
|
+
installation_manifest = InstallationManifest.
|
88
|
+
from_workspace_root(@ws.root_dir)
|
89
|
+
logs = File.join(dir, 'logs')
|
90
|
+
# Pre-create the logs, or cp_r will have a different behavior
|
91
|
+
# if the directory exists or not
|
92
|
+
FileUtils.mkdir_p logs
|
93
|
+
installation_manifest.each_package do |pkg|
|
94
|
+
glob = Dir.glob(File.join(pkg.logdir, '*'))
|
95
|
+
FileUtils.cp_r(glob, logs) if File.directory?(pkg.logdir)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def package_cache_path(dir, pkg, fingerprint: nil, memo: {})
|
100
|
+
fingerprint ||= pkg.fingerprint(memo: memo)
|
101
|
+
File.join(dir, pkg.name, fingerprint)
|
102
|
+
end
|
103
|
+
|
104
|
+
def pull_package_from_cache(dir, pkg, memo: {})
|
105
|
+
fingerprint = pkg.fingerprint(memo: memo)
|
106
|
+
path = package_cache_path(dir, pkg, fingerprint: fingerprint, memo: memo)
|
107
|
+
unless File.file?(path)
|
108
|
+
return [false, fingerprint]
|
109
|
+
end
|
110
|
+
|
111
|
+
FileUtils.mkdir_p pkg.prefix
|
112
|
+
result = system("tar", "xzf", path, chdir: pkg.prefix, out: '/dev/null')
|
113
|
+
unless result
|
114
|
+
raise "tar failed when pulling cache file for #{pkg.name}"
|
115
|
+
end
|
116
|
+
[true, pkg.fingerprint(memo: memo)]
|
117
|
+
end
|
118
|
+
|
119
|
+
def push_package_to_cache(dir, pkg, memo: {})
|
120
|
+
fingerprint = pkg.fingerprint(memo: memo)
|
121
|
+
path = package_cache_path(dir, pkg, fingerprint: fingerprint, memo: memo)
|
122
|
+
if File.file?(path)
|
123
|
+
return [false, fingerprint]
|
124
|
+
end
|
125
|
+
|
126
|
+
temppath = "#{path}.#{Process.pid}.#{rand(256)}"
|
127
|
+
FileUtils.mkdir_p File.dirname(path)
|
128
|
+
result = system("tar", "czf", temppath, ".",
|
129
|
+
chdir: pkg.prefix, out: '/dev/null')
|
130
|
+
unless result
|
131
|
+
raise "tar failed when pushing cache file for #{pkg.name}"
|
132
|
+
end
|
133
|
+
|
134
|
+
FileUtils.mv temppath, path
|
135
|
+
[true, fingerprint]
|
136
|
+
end
|
137
|
+
|
138
|
+
def load_built_flags
|
139
|
+
path = @ws.build_report_path
|
140
|
+
return {} unless File.file?(path)
|
141
|
+
|
142
|
+
report = JSON.load(File.read(path))
|
143
|
+
report['build_report']['packages'].
|
144
|
+
each_with_object({}) do |pkg_report, h|
|
145
|
+
h[pkg_report['name']] = pkg_report['built']
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def consolidated_report
|
150
|
+
cache_pull = File.join(@ws.root_dir, 'cache-pull.json')
|
151
|
+
cache_report = if File.file?(cache_pull)
|
152
|
+
JSON.load(File.read(cache_pull))
|
153
|
+
else
|
154
|
+
{}
|
155
|
+
end
|
156
|
+
|
157
|
+
packages =
|
158
|
+
if File.file?(@ws.build_report_path)
|
159
|
+
path = @ws.build_report_path
|
160
|
+
report = JSON.load(File.read(path))
|
161
|
+
report['build_report']['packages']
|
162
|
+
elsif File.file?(@ws.import_report_path)
|
163
|
+
path = @ws.import_report_path
|
164
|
+
report = JSON.load(File.read(path))
|
165
|
+
report['import_report']['packages']
|
166
|
+
end
|
167
|
+
return unless packages
|
168
|
+
|
169
|
+
packages = packages.each_with_object({}) do |pkg_info, h|
|
170
|
+
name = pkg_info.delete('name')
|
171
|
+
h[name] = cache_report[name] || { 'cached' => false }
|
172
|
+
h[name].merge!(pkg_info)
|
173
|
+
end
|
174
|
+
{ 'packages' => packages }
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'autoproj'
|
2
|
+
|
3
|
+
module Autoproj
|
4
|
+
module CLI
|
5
|
+
# CLI interface for autoproj-ci
|
6
|
+
class MainCI < Thor
|
7
|
+
desc 'build [ARGS]', "Just like autoproj build, but can use a build cache"
|
8
|
+
option :cache, type: 'string',
|
9
|
+
desc: 'path to the build cache'
|
10
|
+
option :report, type: 'string', default: 'cache-pull.json',
|
11
|
+
desc: 'a file which describes what has been pulled'
|
12
|
+
def build(*args)
|
13
|
+
if (cache = options.delete(:cache))
|
14
|
+
cache = File.expand_path(cache)
|
15
|
+
results = cache_pull(cache)
|
16
|
+
pulled_packages = results.
|
17
|
+
map { |name, pkg| name if pkg['cached'] }.
|
18
|
+
compact
|
19
|
+
not_args = ['--not', *pulled_packages] unless pulled_packages.empty?
|
20
|
+
end
|
21
|
+
|
22
|
+
Process.exec(Gem.ruby, $PROGRAM_NAME, 'build', "--interactive=f", *args, *not_args)
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'cache-pull CACHE_DIR',
|
26
|
+
"This command gets relevant artifacts from a build cache and "\
|
27
|
+
"populates the current workspace's prefix with them. It is meant "\
|
28
|
+
"to be executed after a full checkout of the workspace"
|
29
|
+
option :report, type: 'string', default: 'cache-pull.json',
|
30
|
+
desc: 'a file which describes what has been done'
|
31
|
+
def cache_pull(dir)
|
32
|
+
dir = File.expand_path(dir)
|
33
|
+
|
34
|
+
require 'autoproj/cli/ci'
|
35
|
+
results = nil
|
36
|
+
Autoproj.report(silent: true) do
|
37
|
+
cli = CI.new
|
38
|
+
args, options = cli.validate_options(dir, self.options)
|
39
|
+
report = options.delete(:report)
|
40
|
+
|
41
|
+
results = cli.cache_pull(*dir, silent: false, **options)
|
42
|
+
|
43
|
+
if report && !report.empty?
|
44
|
+
File.open(report, 'w') do |io|
|
45
|
+
JSON.dump(results, io)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
results
|
50
|
+
end
|
51
|
+
|
52
|
+
desc 'cache-push CACHE_DIR',
|
53
|
+
"This command writes the packages successfully built in the last "\
|
54
|
+
"build to the given build cache, so that they can be reused with "\
|
55
|
+
"cache-pull"
|
56
|
+
option :report, type: 'string', default: 'cache-push.json',
|
57
|
+
desc: 'a file which describes what has been done'
|
58
|
+
def cache_push(dir)
|
59
|
+
dir = File.expand_path(dir)
|
60
|
+
|
61
|
+
require 'autoproj/cli/ci'
|
62
|
+
Autoproj.report(silent: true) do
|
63
|
+
cli = CI.new
|
64
|
+
|
65
|
+
args, options = cli.validate_options(dir, self.options)
|
66
|
+
report = options.delete(:report)
|
67
|
+
|
68
|
+
results = cli.cache_push(*dir, silent: false, **options)
|
69
|
+
|
70
|
+
if report && !report.empty?
|
71
|
+
File.open(report, 'w') do |io|
|
72
|
+
JSON.dump(results, io)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
desc "build-report PATH",
|
79
|
+
"Create a tarball containing all the information about this "\
|
80
|
+
"build, such as cache information (from cache-pull), Autoproj\'s "\
|
81
|
+
"build report and installation manifest, and the package\'s logfiles"
|
82
|
+
def build_report(path)
|
83
|
+
path = File.expand_path(path)
|
84
|
+
|
85
|
+
require 'autoproj/cli/ci'
|
86
|
+
Autoproj.report(silent: true) do
|
87
|
+
cli = CI.new
|
88
|
+
args, options = cli.validate_options(path, self.options)
|
89
|
+
cli.build_report(*args, **options)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: autoproj-ci
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sylvain Joyeux
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-08-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: autoproj
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: flexmock
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- sylvain.joyeux@13robotics.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rubocop.yml"
|
92
|
+
- ".travis.yml"
|
93
|
+
- CODE_OF_CONDUCT.md
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- autoproj-ci.gemspec
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- lib/autoproj-ci.rb
|
102
|
+
- lib/autoproj/ci/version.rb
|
103
|
+
- lib/autoproj/cli/ci.rb
|
104
|
+
- lib/autoproj/cli/main_ci.rb
|
105
|
+
homepage: https://github.com/rock-core/autoproj-ci
|
106
|
+
licenses:
|
107
|
+
- MIT
|
108
|
+
metadata:
|
109
|
+
allowed_push_host: https://rubygems.org
|
110
|
+
homepage_uri: https://github.com/rock-core/autoproj-ci
|
111
|
+
source_code_uri: https://github.com/rock-core/autoproj-ci
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 2.7.6.2
|
129
|
+
signing_key:
|
130
|
+
specification_version: 4
|
131
|
+
summary: plugin that provide subcommand useful in CI environments
|
132
|
+
test_files: []
|