Skip to content

Commit

Permalink
CM-89 Add Integration test triggers (#90)
Browse files Browse the repository at this point in the history
* Add Integration test triggers

* Fix github token in travis config

* Remove travis token for login

* Split bash if statement

* Fix syntax for if statement

* Fix script syntax in travis config

* Change travis script to block operator

Co-authored-by: Ed Bruck <ed.bruck1@gmail.com>
  • Loading branch information
matteyu and ebruck committed Mar 17, 2020
1 parent 574eb5c commit c4d8b8c
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 6 deletions.
28 changes: 22 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ language: go
go: stable

env:
- GO111MODULE=on
global:
- GO111MODULE=on
- secure: "LBPuPqFb4PYq9n0d6vQ+TwFWwepAsl3X3ZoRyWU+4/kv3S50PRzre60B5xVP+Y3eyG5RbsWh1Z4unp2nVOGN9O3H4VjqgAXQYnyTMIzg+AceUnjVmlbzPL01A0tTY5MswbZP3ncQFphBNreRrIWgLZKV9btfiYjuOO85+ZC+biw3jNuyeGkHSdfibAsuKug0Mr11FkYccAry3zOUHwNzn2dMnfDVImPmjxucZxXOqIeqXaPQ9W8OVn+ZiYYoW51+s/G1ll00C290c6TKbnVnFVqK6cAR9VQnpI00IDLuRNGQJWiosHCxoYkr/p9nSZgN04nVRYvkLXo8CxSsthcYf23Z1R0H5NeFuCVfLSzAgFOff23VK2jOhINPgCfBtENMyR4jVdUSCv0XJ/VrjHHMJXzpILXSy/M38RnZzeN2brM6H7nbvk58Kdv+6Dn7A1E2ZLCslFtlP4m6qrP17bDViibfVgYNcRytDATnKXjbJURAJ3ja+ZUULLPMhAO5BDHuJDzIWXq2wzZWk4OMk49PIaVwkSvaJ8+KFg9x7mNXGhql5TAS+d+OArkJyzR1ODQnfZ0JA1rzvJ9T321lOT8YzWy8nEPfRcpAbrIuud1Rrj4r4luOaZ6iRmGvOtrnKCDjciQCY+J1ftJj5U+uDeZt0A9Bxo1DFy/tW96KX0QxvwI="
- secure: "LmvYG98cHXvtysWaHKHb8fLt1y2UHIVZ7g0w9AUkCnyR7BsbiLvyCIV5Xhg0SPGpcIPIEyTnCgAzEV0Q489Phr+W4eBq7wKfP63SIojgM3Ne4z/utoY/FOjvo3ZlOjwYrup3QIuU8JpDKy/0a+silGDl9q0Q/JdL0qStvgz9eSEmk5R6Ov0iNcQu7z3lZSgHaw7Y/TjJ7G8AbibZ6L0/Z4ncof6GORjZzo0mZwlPEmbjJnfUkqNKCcwI3IrPLP5I9qXTChuiV5wRfdibjD0Y0Lmddz/VAxNw6rcvEJEzM+GB42TXQZwl6ekXVqi0b1hC95Mz4dFt5idsN2Xf46EJeyUjNNZh5Bk3vfOAmyhnhc0/HEe97YxhZCTLUaVsNntNH3djFus6hE/yEE7hqbUo7eZmnhXGmg/tOd9rwUDCarT+K3oCdiJBg48htTe3vXn/Vm+ffI1QCY/RttitCkXLGg8G88d7cAD7RAM8F9nxyObkDEenj0n290DzRLwVE+i0N1ROLNerEdTWtCbuoWEgEl6SFRpw49elcgehHMq7X/Bg8gL9xrhzDs8psxN62dSjiSz/OXhDW6E7vvVJNKmMS+8/MLD0bCbrbsjhASpgeF8YGRchFVEw8/33Hmybnpo97+R5FObS8pVGu0yzcTNQzAe5eM0GZtihftxo3ApwEaA="

git:
depth: 1
Expand All @@ -16,9 +19,22 @@ before_install:

install: true

before_script:
- sudo apt-get install ruby-dev && sudo gem install travis
- npm install -g travis-status
- npm install -g child_process
script:
- make mainnet
- gotest -v -covermode=count -coverprofile=coverage.out ./x/...
- $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci
- ls -l $GOPATH/bin

- |
ls -a
echo ${TRAVIS_PULL_REQUEST}
echo ${TRAV_API_TOKEN}
if [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then
make install;
gotest -v -covermode=count -coverprofile=coverage.out ./x/...;
$GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci;
ls -l $GOPATH/bin;
else
echo "y" | travis restart -r bluzelle/curium-test;
npm install travis-status;
node travisStatus.js $TRAV_API_TOKEN;
fi
50 changes: 50 additions & 0 deletions travisStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
var travisArgs = process.argv.slice(2);
const { exec } = require("child_process");

function runTravisCommand(comm, cb){
exec(comm, (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return -1;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return -1;
}

resp = `${stdout}`

if(resp.includes("passed")){
cb("passed")
}
else if (resp.includes("failed")){
cb("failed")
}
else{
cb("pending")
}
});
}

function runIntegrationTest(){
runTravisCommand("travis-status --pro --token " + travisArgs[0] + " --repo bluzelle/curium-test --branch devel"
, function (result) {
if(result == "passed"){
console.log("INTEGRATION TESTS PASSED")
process.exit(0)
}
else if(result == "failed"){
console.log("INTEGRATION TESTS FAILED")
process.exit(1)
}
else{
setTimeout(function(resp){
console.log("status: " + resp)
console.log("INTEGRATION TESTS STILL RUNNING...")
runIntegrationTest()
}, 10000, result)
}
} );
}

runIntegrationTest()

0 comments on commit c4d8b8c

Please sign in to comment.