aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-08-22 13:08:16 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-08-22 13:10:25 +0900
commit1f7395dbea4c721a64bbeb1b8f5e3355bf4758b5 (patch)
treec9f0768611575afe0834118568134905045c1117
parent14f517947a90146549947e49378bf44c6ab9c921 (diff)
downloadnyaci-1f7395dbea4c721a64bbeb1b8f5e3355bf4758b5.tar.gz
Change how build matrix is specified
-rw-r--r--config.rb.example23
-rw-r--r--nyabuild.rb14
-rw-r--r--nyacommon.rb5
3 files changed, 18 insertions, 24 deletions
diff --git a/config.rb.example b/config.rb.example
index 1c24ae3..d218121 100644
--- a/config.rb.example
+++ b/config.rb.example
@@ -43,20 +43,15 @@ NyaConfig.configure(
projects: {
"ruby-openssl": {
git: "git://git.intra.rhe.jp/ruby-openssl.git",
- matrix: {
- ruby: [
- "2.3",
- "trunk",
- ],
- openssl: [
- "openssl-1.1.0",
- "openssl-1.0.2",
- "openssl-1.0.1",
- "openssl-1.1.0-no-ec",
- "openssl-1.1.0-no-engine",
- ]
- },
- build_proc: -> (t, ruby, openssl) {
+ matrix: [
+ { ruby: "trunk", openssl: "openssl-1.1.0" },
+ { ruby: "trunk", openssl: "openssl-1.0.2" },
+ { ruby: "trunk", openssl: "openssl-1.0.1" },
+ { ruby: "trunk", openssl: "openssl-1.1.0-no-ec" },
+ { ruby: "trunk", openssl: "openssl-1.1.0-no-engine" },
+ { ruby: "2.3", openssl: "openssl-1.0.2" },
+ ],
+ build_proc: -> (t, ruby:, openssl:) {
ENV["GEM_HOME"] = File.expand_path("tmp/gems")
ENV["PATH"] = [
File.expand_path("tmp/gems/bin"),
diff --git a/nyabuild.rb b/nyabuild.rb
index 436976b..34b668d 100644
--- a/nyabuild.rb
+++ b/nyabuild.rb
@@ -100,7 +100,7 @@ class NyaBuildTarget
t = new(build, path, logger)
t.git(t.project.git, build.project_id, branch: build.branch)
FileUtils.cd(build.project_id) {
- t.project.build_proc.call(t, *confs)
+ t.project.build_proc.call(t, **confs)
}
}
}
@@ -123,13 +123,13 @@ class NyaBuild
end
def run
- patterns = @project.matrix.dup
+ matrix = @project.matrix.reverse
beg = Time.now
NyaConfig.parallelism.times.map { |x|
Thread.start {
- while ary = patterns.pop
- do_pattern(ary)
+ while params = matrix.pop
+ do_pattern(params)
end
}
}.map(&:join)
@@ -138,11 +138,11 @@ class NyaBuild
NyaConfig.notification.publish(@project_id, @jobid, @results, elapsed)
end
- def do_pattern(ary)
- pattern_tag = ary.join("_")
+ def do_pattern(params)
+ pattern_tag = params.values.join("_")
logger = newlogger(pattern_tag)
- pid = fork { NyaBuildTarget.start(self, ary, logger) }
+ pid = fork { NyaBuildTarget.start(self, params, logger) }
_, status = Process.wait2 pid
logger.finish(status.success?)
diff --git a/nyacommon.rb b/nyacommon.rb
index 04b2ac8..957670b 100644
--- a/nyacommon.rb
+++ b/nyacommon.rb
@@ -40,10 +40,9 @@ module NyaConfig
def initialize(git:, matrix:, build_proc:)
@git = git
- deps = matrix.map { |name, vars|
- vars.map { |v| NyaConfig.module(name, v.intern) }
+ @matrix = matrix.map { |params|
+ params.map { |k, v| [k, NyaConfig.module(k, v.intern)] }.to_h
}
- @matrix = deps[0].product(*deps[1..-1])
@build_proc = build_proc
end
end