forked from chanks/queue-shootout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbench.rb
More file actions
28 lines (21 loc) · 742 Bytes
/
bench.rb
File metadata and controls
28 lines (21 loc) · 742 Bytes
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
require 'uri'
require 'net/http'
require 'json'
class Bench
# BENCHES_URL = 'http://requestb.in/18tdza31'
BENCHES_URL = 'http://boiling-scrubland-5198.herokuapp.com/api/builds'
def self.press(results)
uri = URI.parse(BENCHES_URL)
request = Net::HTTP::Post.new(uri, initheader = {'Content-Type' =>'application/json'})
build = {
project: ENV['CIRCLE_PROJECT_USERNAME'] + '/' + ENV['CIRCLE_PROJECT_REPONAME'],
branch: ENV['CIRCLE_BRANCH'],
commit_sha: ENV['CIRCLE_SHA1'],
commit_timestamp: Time.now.strftime('%Y-%m-%d %H:%M:%S')
}
request.body = { build: build, metrics: results}.to_json
Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(request)
end
end
end