Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add runtime sync script #975

Merged
merged 6 commits into from
Jul 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
language: java
sudo: false

jdk:
- oraclejdk8

- oraclejdk8
script:
- mvn install -DskipTests=true
- mvn -pl !azure-batch,!azure-mgmt-website checkstyle:check
- mvn package javadoc:aggregate -DskipTests=true
- bash ./tools/sync_runtimes.sh
- mvn install -DskipTests=true
- mvn -pl !azure-batch,!azure-mgmt-website checkstyle:check
- mvn package javadoc:aggregate -DskipTests=true
env:
global:
- secure: w5X4c2Zts4PygmbNZ+E1ttYvwpMgvALj5ae/I8vTpygtePaF4avp7GYLgadnNS7z0Sh2Gn+xd8IajWeyT4cFn/Cxq8RxsHqEnJUM1hamCE/IfZnxgMNC3xkFkZ7MuyL4E0V9mKYiRRvHU+C8ed2e4UeKcyWu+7MoviiKpyS37Pw=
21 changes: 12 additions & 9 deletions runtimes/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
language: android
android:
components:
- build-tools-23.0.1
- android-23
- platform-tools
- extra-android-support
- extra-google-m2repository
- extra-android-m2repository
- build-tools-23.0.1
- android-23
- platform-tools
- extra-android-support
- extra-google-m2repository
- extra-android-m2repository
sudo: false
script:
- mvn clean install
- mvn checkstyle:check
- cd ./azure-android-client-authentication && ./gradlew check
- mvn clean install
- mvn checkstyle:check
- cd ./azure-android-client-authentication && ./gradlew check
env:
global:
secure: RnU4qnuCJRzSvAAXApk9yVhIH+gtl5RNmoVva/hzuSF0WcSaRh2CBe37KUNnbBDJaHd53L5AvHBpbcmaylbOYaRQ/vxUG1gAEHuyrX3ANvGLKYKjtg1F8i853h1Y/y/TZ9MNfzLOqlo/DtD/jAl6pOAMyxNxSEwwFjHY+zbzTOA4kXjTDPGtNwB253v46j5vzSUcEKHpAXER2RjTeurVFeMFDT78Ou+4DCFBqpenObwr1CH+YPTwIoRBvzzPFDKy8+3rdWXOCB2QloaeFntxH1NDbkhReBe4KL3Ue03ksxrAqcmoJR6qFCQebvHYQYSXTk7kmoOxRFTowGqJ0SErUQwT85MA+3JYDmWDKvI3Zq1lQvhmv7dhsbgJASTxpwW+cqStCzKhAYADB6nB8Nv5AUE/5wQDWXEANUQ2t/eWooip0IcIHeJfBj0qDk+WvjAKGSGu0tIAD71Z1h36WHxf0U/fTi673tguwrhWpnUCbQaQCiDqMm7sSWOlyIdAoxy3JwLGaJq3bRGAjgwbfY32VQ/GN00ttSYu63SFDkxYATC4/FtYheNB0Yi4bDU//me9WcB/mt4bi98nC1CBK1tVS1Rn6ATkXu5K9oMvfCX7UlKe6rGmW7tVdXqtwMEFBpH3Z94tXxQEkZ+AITociIBV85+Oy/BOYvMCwysNv/PEqx0=
27 changes: 27 additions & 0 deletions tools/sync_runtimes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# Exit on error
set -e

# A previous commit may have created the branch, use that
branch=master
if [[ `curl https://api.github.com/repos/Azure/autorest-clientruntime-for-java/branches | jq '.[]["name"]'` == *"sdk_${TRAVIS_PULL_REQUEST}"* ]]; then
branch=sdk_${TRAVIS_PULL_REQUEST}
fi

# Pull and push the subtree
pull_subtree=`git subtree pull --squash --prefix runtimes https://${GH_TOKEN}@github.com/Azure/autorest-clientruntime-for-java.git $branch 2>&1`
echo $pull_subtree
git subtree push --prefix runtimes https://${GH_TOKEN}@github.com/Azure/autorest-clientruntime-for-java.git sdk_${TRAVIS_PULL_REQUEST} > /dev/null 2>&1

# Create a pull request. This only applies when first time creating the branch
if [[ $branch == "master" ]]; then
open_pull_request=`curl -H "Authorization: token ${GH_TOKEN}" https://api.github.com/repos/Azure/autorest-clientruntime-for-java/pulls --data "{\"title\":\"[Automatic PR] SDK changes from pull request #${TRAVIS_PULL_REQUEST}\",\"head\":\"sdk_${TRAVIS_PULL_REQUEST}\",\"base\":\"master\",\"body\":\"Azure/azure-sdk-for-java#${TRAVIS_PULL_REQUEST}\"}"`
echo $open_pull_request
# Successfully opened a pull request
if [[ `echo $open_pull_request | jq '.errors | length'` == 0 ]]; then
curl -H "Authorization: token ${GH_TOKEN}" https://api.github.com/repos/Azure/azure-sdk-for-java/issues/${TRAVIS_PULL_REQUEST}/comments --data "{\"body\":\"Runtime changes detected. pull request created. CI running: [![Build Status](https://travis-ci.org/Azure/autorest-clientruntime-for-java.svg?branch=sdk_${TRAVIS_PULL_REQUEST})](https://travis-ci.org/Azure/autorest-clientruntime-for-java)\"}"
else
error_msg=`echo $open_pull_request | jq '.'`
curl -H "Authorization: token ${GH_TOKEN}" https://api.github.com/repos/Azure/azure-sdk-for-java/issues/${TRAVIS_PULL_REQUEST}/comments --data "{\"body\":\"Runtime changes detected but failed to create a pull request. Error: \\n```json\\n$error_msg\\n```\"}"
fi
fi