-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
920 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
BUNDLE_JOBS: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/config/travis.yml | ||
/results | ||
tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
test_results: ./bin/receive_test_results | ||
web: script/server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require "bundler/setup" | ||
require "rake" | ||
|
||
$LOAD_PATH << File.expand_path("../lib", __FILE__) | ||
require "travis/test-results.rb" | ||
require "travis/support" | ||
require "travis/test-results/helpers/database" | ||
|
||
namespace :db do | ||
desc "Apply migrations" | ||
task :migrate, [:version] do |t, args| | ||
Sequel.extension(:migration) | ||
db = Travis::TestResults::Helpers::Database.create_sequel | ||
|
||
if args[:version] | ||
puts "Migrating to version #{args[:version]}" | ||
Sequel::Migrator.run(db, "db/migrations", target: args[:version].to_i) | ||
else | ||
puts "Migrating to latest" | ||
Sequel::Migrator.run(db, "db/migrations") | ||
end | ||
end | ||
|
||
desc "List status for migrations" | ||
task :status do | ||
Sequel.extension(:migration) | ||
db = Travis::TestResults::Helpers::Database.create_sequel | ||
applied = Sequel::TimestampMigrator.new(db, "db/migrations").applied_migrations | ||
all_migrations = Dir["db/migrations/*.rb"].map { |file| File.basename(file) }.sort | ||
all_migrations.each do |migration_file| | ||
if applied.include?(migration_file) | ||
puts " up #{migration_file}" | ||
else | ||
puts " down #{migration_file}" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
$: << 'lib' | ||
require 'bundler/setup' | ||
require 'travis/test-results/app' | ||
run Travis::TestResults::App.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Sequel.migration do | ||
up do | ||
create_table(:step_results) do | ||
primary_key :id | ||
integer :job_id | ||
text :data | ||
|
||
timestamp :created_at | ||
timestamp :updated_at | ||
|
||
index :job_id, name: "index_step_results_on_job_id" | ||
end | ||
|
||
run "ALTER TABLE step_results ALTER COLUMN data TYPE JSON USING data::JSON;" | ||
end | ||
|
||
down do | ||
drop_table(:step_results) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'connection_pool' | ||
require 'redis' | ||
require 'metriks' | ||
|
||
module Travis | ||
class RedisPool | ||
attr_reader :pool | ||
|
||
def initialize(options = {}) | ||
pool_options = options.delete(:pool) || {} | ||
pool_options[:size] ||= 10 | ||
pool_options[:timeout] ||= 10 | ||
@pool = ConnectionPool.new(pool_options) do | ||
::Redis.new(options) | ||
end | ||
end | ||
|
||
def method_missing(name, *args) | ||
timer = Metriks.timer('redis.pool.wait').time | ||
@pool.with do |redis| | ||
timer.stop | ||
if redis.respond_to?(name) | ||
Metriks.timer("redis.operations").time do | ||
redis.send(name, *args) | ||
end | ||
else | ||
super | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.