-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
47 lines (38 loc) · 1.39 KB
/
Rakefile
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
45
46
47
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'fileutils'
require File.expand_path '../test/support/create_certs', __FILE__
task default: :test
Rake::TestTask.new :test do |t|
t.test_files = FileList['test/**/*_test.rb']
end
namespace :test do
desc 'run tests via official ruby docker image'
task :docker, [:tag] do |_,args|
tag = args.fetch :tag, 'ruby:2.5'
FileUtils.mkdir_p 'tmp/docker'
system "docker pull #{tag}"
system "docker run --rm -v `pwd`:/opt/src/h2 -it #{tag} /bin/sh -c '" +
"cd /opt/src/h2 && " +
"bundle install --path tmp/docker && " +
"bundle exec rake test'"
end
desc 'send TTIN signal to test process'
task :ttin do
pid = `ps -ef | grep -v grep | grep -e 'ruby.*_test\.rb' | awk '{print $2}'`.strip
if !pid.empty?
puts "TTIN -> #{pid}"
Process.kill 'TTIN', Integer(pid)
end
end
task :nginx, [:tag, :ctx] do |_,args|
tag = args.fetch :tag, 'h2_nginx_http2'
ctx = args.fetch :ctx, 'test/support/nginx'
system "docker build -t #{tag} #{ctx}"
puts "\nstarting nginx with http/2 support"
puts "using docker context/document root: #{ctx}"
puts "using TLS certs: tmp/certs/server.*"
puts "listening at https://localhost:4430/"
system "docker run --rm -v `pwd`/tmp/certs:/usr/local/nginx/certs -v `pwd`/#{ctx}:/usr/local/nginx/html -p 4430:443 -it #{tag}"
end
end