Skip to content

Instantly share code, notes, and snippets.

@rkh
Created October 1, 2013 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkh/6785596 to your computer and use it in GitHub Desktop.
Save rkh/6785596 to your computer and use it in GitHub Desktop.
language: c
script: ./build.sh
env:
global:
- "ARTIFACTS_AWS_REGION=us-east-1"
- "ARTIFACTS_S3_BUCKET=travis-rubies"
- secure: "..."
- secure: "..."
matrix:
- "RUBY=ruby-head"
- "RUBY=jruby-head"
- "RUBY=jruby-head-d20"
#!/bin/bash -ex
[[ $RUBY ]] || (echo 'please set $RUBY' && exit 1)
rvm get stable
rvm reload
echo -n > $rvm_path/user/md5
echo -n > $rvm_path/user/sha512
rvm remove $RUBY
rvm install $RUBY --movable --verify-downloads 1
rvm prepare $RUBY
gem install travis-artifacts
travis-artifacts upload --path $RUBY.* --target-path binary
require 'sinatra/base'
require 'travis/client'
app = Sinatra.new do
# Configuration
enable :logging
set :travis, uri: 'https://api.travis-ci.com/', access_token: '...'
set :signatures, [
"...", # ruby/ruby
"..." # jruby/jruby
]
# Travis client
helpers Travis::Client::Methods
before { @session = Travis::Client::Session.new(settings.travis) }
attr_reader :session
# Check authenticity
before do
next if settings.signatures.include? env['HTTP_AUTHORIZATION']
halt 403, "requests need to come from Travis CI"
end
post '/rebuild/:ruby' do
repo('travis-pro/travis-rubies').last_build.jobs.each do |job|
next unless job.config['env'].include? "RUBY=#{params[:ruby]}"
logger.info "restarting #%s" % job.number
restart job
end
"ok"
end
end
run app
source 'https://rubygems.org'
gem 'sinatra'
gem 'travis'
gem 'puma'
web: bundle exec rackup -s puma -p $PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment