Created
April 6, 2016 19:03
-
-
Save DanPurdy/240f4c9d755778d031e3763e9af666c7 to your computer and use it in GitHub Desktop.
Checks your Karma output (karma-mocha-reporter format) for errors and reports the status back to github via the status API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Check for Karma errors | |
if [ -e "test-reports/karma.mocha.json" ]; then | |
if (grep -c '\"failures\": 0,' "./test-reports/karma.mocha.json" 1> /dev/null 2>&1); then | |
curl -H "Authorization: token <YOUR-GITHUB-TOKEN-HERE>" \ | |
--request POST \ | |
--data \ | |
'{ | |
"state": "success", | |
"context": "Karma - Unit tests", | |
"description": "The unit tests were successful", | |
"target_url": "${bamboo.buildResultsUrl}" | |
}' \ | |
https://GITHUB-URL/api/v3/repos/GITHUB-USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null | |
else | |
curl -H "Authorization: token <YOUR-GITHUB-TOKEN-HERE>" \ | |
--request POST \ | |
--data \ | |
'{ | |
"state": "failure", | |
"context": "Karma - Unit tests", | |
"description": "The unit tests failed", | |
"target_url": "${bamboo.buildResultsUrl}" | |
}' \ | |
https://GITHUB-URL/api/v3/repos/GITHUB-USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment