forked from mame/quine-relay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot.travis.yml.gen.rb
44 lines (40 loc) · 1.49 KB
/
dot.travis.yml.gen.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require "yaml"
require_relative "code-gen"
apts = RunSteps.flat_map {|s| s.apt }
apts = apts.flatten.map {|apt| apt }.compact
apts.delete("ruby2.1")
srcs = RunSteps.flat_map {|s| s.src }
yaml = {}
yaml["sudo"] = "required"
yaml["services"] = ["docker"]
yaml["language"] = "ruby"
yaml["before_install"] = ["sudo docker build -t quine-relay ."]
yaml["script"] = ["sudo docker run --privileged --name qr -e CI=$TRAVIS -t quine-relay"]
yaml["after_success"] = [
'test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && sh .travis.yml'
]
yaml["env"] = {
"global" => {
"secure" => "NGDakAqRZgGJwEJTlXenhoXcq9ulf0X0fjnC+oF+ktTXCRpdbQd8+faxIW5DR26qF5OMWPqsLtUv8HtQyv5P5gVNs41hXygmNU1R9TOMpw64FjXtkD1HNf0D4jE2STuUU2xB+sCifeb9z6SvMpcy6ZswBlhAVnV+5dboNZL0Ww0="
}
}
s = [
'echo : dummy"',
# XXX: find a method to dump yaml without document marker
*Psych.dump(yaml).lines.map {|l| l.chomp }.drop(1),
'dummy: |',
' dummy" > /dev/null',
- " mkdir spoiler",
*srcs.map do |s|
" sudo docker cp qr:/usr/local/share/quine-relay/#{ s } spoiler/"
end,
" cd spoiler",
" git init --quiet",
" git config user.name 'Yusuke Endoh'",
" git config user.email '[email protected]'",
" git add .",
" git commit -m spoiler --quiet",
" git push --force --quiet \"https://${GH_TOKEN}@github.com/mame/quine-relay\" master:spoiler",
" echo The intermediate sources are available: https://github.com/mame/quine-relay/tree/spoiler"
]
File.write("../.travis.yml", s.join("\n") + "\n")