Skip to content

Commit

Permalink
Build using Travis CI, close #1464
Browse files Browse the repository at this point in the history
  • Loading branch information
pdalpra committed Feb 9, 2014
1 parent 1387222 commit 76ebba4
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .travis.yml
@@ -0,0 +1,23 @@
language: scala
before_script: ./make_credentials.sh
script: sbt test

env:
global:
- secure: "fLxDvisz+Rnqx4JZaKVdSdCobv6nBfPDGDWa7WS39wI6Heg+x9X9vPAJeX5QzE6DU2GNI/UcG3G4ihmM3hNamj77ZjTyP7JjuAtLItDWC7+m5yMlx/9GbHzwSUzgxZqDx+uZS4OENN1hCAfl5minCsPguVe+vsXB7gIuwd71pAI="
- secure: "j4K47vix/LdZmcjeI5XE/Z09WSw0Az5C8OKVHZTZA4ZvY4AE7quX2AfMPzpcZ6t9IBH2U8Mz+XvNQYftoQrKzru7hRQd7y+hEddxzfE0IWzYvPNE8EdijODoeKkO96H1LuOPCDbQ4Md0Ett0o+WSWhjzmtdfTslx98JHdt2nFT4="
- secure: "ucCjxVaGakcoFquE3vHeP3Bh8XXqjAZVyOUo68lQ8qrOUoTUz+QRas/+QwVlFbbd8pCxemOd0m2iG06V32A19PPOmSkDfPSTH4CRa45nS1KJ4Uz1Uoe+YALzkifsBJzY2ZS/G78YmEP7BPfeVu3/ayVBPgTSbFtCrctJApg+E5s="

# Publish to Sonatype if building master and trigger builds
after_success:
- "[[ $TRAVIS_BRANCH == \"master\" ]] && sbt publish"
- ./trigger_build.py excilys/gatling-highcharts
- ./trigger_build.py excilys/gatling-vtd
- ./trigger_build.py excilys/gatling-maven-plugin
- ./trigger_build.py excilys/gatling-highcharts-maven-archetype
- ./trigger_build.py gatling/gatling-sbt

# Blacklisting
branches:
except:
- 1.5.X
6 changes: 6 additions & 0 deletions make_credentials.sh
@@ -0,0 +1,6 @@
#!/bin/bash

echo "realm=Sonatype Nexus Repository Manager" >> ~/.sbt/.credentials
echo "host=oss.sonatype.org" >> ~/.sbt/.credentials
echo "user=$SONATYPE_USERNAME" >> ~/.sbt/.credentials
echo "password=$SONATYPE_PASSWORD" >> ~/.sbt/.credentials
19 changes: 19 additions & 0 deletions trigger_build.py
@@ -0,0 +1,19 @@
#!/usr/bin/env python
import json, urllib2, os, sys

def api_call(url, token=None, data=None):
if data:
data = json.dumps(data)
req = urllib2.Request(url, data)
if data:
req.add_header('Content-Type', 'application/json; charset=UTF-8')
if token:
req.add_header('Authorization', 'token ' + token)
p = urllib2.urlopen(req)
return json.loads(p.read())

def travis_ping(travis_token, repository):
last_build_id = api_call('https://api.travis-ci.org/repos/{}/builds'.format(repository), travis_token)[0]['id']
return api_call('https://api.travis-ci.org/requests', travis_token, { 'build_id': last_build_id })['result']

travis_ping(os.environ["API_TOKEN"], sys.argv[1])

0 comments on commit 76ebba4

Please sign in to comment.