diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..24be5fa021 --- /dev/null +++ b/.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 \ No newline at end of file diff --git a/make_credentials.sh b/make_credentials.sh new file mode 100755 index 0000000000..fffdb52fea --- /dev/null +++ b/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 \ No newline at end of file diff --git a/trigger_build.py b/trigger_build.py new file mode 100755 index 0000000000..af8df76624 --- /dev/null +++ b/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]) \ No newline at end of file