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 Github status to PR for c2go tests and warnings #338

Merged
merged 5 commits into from
Nov 9, 2017
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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ os:
- osx

env:
- SCRIPT=test CLANG=3.9
global:
secure: "p/4P6/KQKnkUmTQPUkkuu/Q9n4KR9tno5i6gBf9yJ/SbBRg1YTM5G5QvvZUasOAOeb8sxQaoJqd+H6Jmnj3sgB/zBFrAId+S8IMckuUMPLGvt928MXA+R1DdRDr9arHGKodyaF6VUJkQU78IQusv71FDvV2bdesMJPNc27l3WbEJPEoPGpQMiM6pgZgYFEnpRHTgi3Fmp5FN9jR+evQpPOwvsAVfNuLH2kZ3prk7XDpP2Nx0SmdwVzSKiKFW8XyiM6aHmjWLOOIDbmIynD1Hl2iUTEhbzubIPgBmYt3AbgYL4WzmnnZEfKMFmVGjHmdNIiW1EndI4iLjCpqdTWqOLY7kge8DW+/eURb0WsIAJJsllc/D6P9l2SU1v9PJROdY2dLI5oO06PSvFgXgpyCz0IG1ARYw2JF9JxG1kkNtdcPindn3mlPTcfwHUh41y7mZEYBD22NMl9AyWE1Igqgx2TEYZf+TcyUpV2pLxY7QwcCrga77iCiSrzylKLvrgABaU/zgQXEUe2Oymv4LvgtiwMBJl6x+80yVEMdIMHb10IShThzEgcmMDd1rNDt8k48A3GUVaFi4xu4i3Zoiq2OGQLNOKmejWpNYYHP7iD6gTqRwV5h9t+iTobbxs1WkJfh5VMHKaLN1qQmEz3Nzr08zZ8rkAJ9X3Xf588HhZKVvVsQ="
matrix:
- SCRIPT=test CLANG=3.9

matrix:
include:
Expand Down
16 changes: 14 additions & 2 deletions travis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ if [ $COVERAGE_FILES != 0 ]; then
fi

# Print stats
echo "Unit tests: " $(grep "=== RUN" $OUTFILE | wc -l)
echo "Integration tests: " $(grep "# Total tests" $OUTFILE | cut -c21-)
UNIT_TESTS=$(grep "=== RUN" $OUTFILE | wc -l | tr -d '[:space:]')
INT_TESTS=$(grep "# Total tests" $OUTFILE | cut -c21- | tr -d '[:space:]')

echo "Unit tests: ${UNIT_TESTS}"
echo "Integration tests: ${INT_TESTS}"

# These steps are from the README to verify it can be installed and run as
# documented.
Expand Down Expand Up @@ -94,3 +97,12 @@ echo "In file sqlite3.go : $SQLITE_WARNING_SQLITE3 warnings."

SQLITE_WARNING_SHELL=`cat $SQLITE_TEMP_FOLDER/shell.go | grep "// Warning" | wc -l`
echo "In file shell.go : $SQLITE_WARNING_SHELL warnings."

# Update Github PR statuses. These two statuses will always pass but will show
# information about the number of tests run and how many warnings are generated
# in the SQLite3 transpile.
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
curl -H "Authorization: token ${GITHUB_API_TOKEN}" -H "Content-Type: application/json" https://api.github.com/repos/elliotchance/c2go/statuses/${TRAVIS_COMMIT} -d "{\"state\": \"success\",\"target_url\": \"https://travis-ci.org/elliotchance/c2go/builds/${TRAVIS_JOB_ID}\", \"description\": \"$(($UNIT_TESTS + $INT_TESTS)) tests passed (${UNIT_TESTS} unit + ${INT_TESTS} integration)\", \"context\": \"c2go/tests\"}"

curl -H "Authorization: token ${GITHUB_API_TOKEN}" -H "Content-Type: application/json" https://api.github.com/repos/elliotchance/c2go/statuses/${TRAVIS_COMMIT} -d "{\"state\": \"success\",\"target_url\": \"https://travis-ci.org/elliotchance/c2go/builds/${TRAVIS_JOB_ID}\", \"description\": \"$(($SQLITE_WARNING_SQLITE3 + $SQLITE_WARNING_SHELL)) warnings\", \"context\": \"c2go/sqlite3\"}"
fi