-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
service_name: codeship | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,64 @@ | ||
#!/usr/bin/env bash | ||
|
||
# this script expects to run from the moldesign/_tests directory | ||
|
||
function check_if_tests_should_run(){ | ||
echo "Should I run the tests in this environment?" | ||
|
||
function shouldruntests(){ | ||
if [ "${TESTENV}" == "complete" ]; then | ||
echo true | ||
runthem=true | ||
echo "YES: always run in 'complete' environment" | ||
fi | ||
|
||
case "${CI_BRANCH}" in | ||
master|deploy|dev) | ||
echo true | ||
runthem=true | ||
echo "YES: always run in branch \"${CI_BRANCH}\"" | ||
;; | ||
esac | ||
|
||
if [[ "${CI_COMMIT_MESSAGE}" == *" --testall "* ]]; then | ||
echo true | ||
if [[ "${CI_COMMIT_MESSAGE}" == *"--testall"* ]]; then | ||
runthem=true | ||
echo "YES: found \"--testall\" flag in commit message" | ||
fi | ||
|
||
echo false | ||
if [ "${runthem}" != "true" ]; then | ||
echo "SKIPPING tests in this environment." | ||
echo "To run these tests, add \"--testall\" to your commit message" | ||
echo "(or work in the dev or deploy branches)" | ||
python ../../deployment/send_test_status.py 0 "Skipped (dev/deploy branches only)" | ||
exit 0 | ||
fi | ||
} | ||
|
||
if [ $(shouldruntests) == false ]; then | ||
echo "SKIPPING minimal environment tests for this commit." | ||
echo "To run these tests, add \"--testall\" to your commit message" | ||
echo "(or work in the dev or deploy branches)" | ||
python ../../deployment/send_test_status.py 0 "Skipped (dev/deploy branches only)" | ||
exit 0 | ||
else | ||
py.test -n 4 --junit-xml=/opt/reports/junit.${TESTENV}.xml | tee /opt/reports/pytest.${TESTENV}.log | ||
exitstat=${PIPESTATUS[0]} | ||
|
||
statline="$(tail -n1 /opt/reports/pytest.${TESTENV}.log)" | ||
function run_tests(){ | ||
if [ "${TESTENV}" == "complete" ]; then | ||
coverageflags="--cov .. --cov-report=term-missing:/opt/reports/coverage --cov-report=" | ||
fi | ||
|
||
py.test -n 4 --junit-xml=/opt/reports/junit.${TESTENV}.xml $coverageflags | tee /opt/reports/pytest.${TESTENV}.log | ||
exitstat=${PIPESTATUS[0]} | ||
|
||
statline="$(tail -n1 /opt/reports/pytest.${TESTENV}.log)" | ||
|
||
echo 'Test status:' | ||
echo ${statline} | ||
echo 'Test status:' | ||
echo ${statline} | ||
|
||
python ../../deployment/send_test_status.py ${exitstat} "${statline}" | ||
|
||
if [ "${TESTENV}" == "complete" ]; then | ||
if [ ${exitstat} -eq 0 ]; then | ||
coveralls || echo "Failed to upload code coverage stats" | ||
else | ||
echo "Skipping coveralls upload: tests not passing." | ||
coverage report | ||
fi | ||
fi | ||
|
||
exit ${exitstat} | ||
} | ||
|
||
python ../../deployment/send_test_status.py ${exitstat} "${statline}" | ||
|
||
exit ${exitstat} | ||
fi | ||
check_if_tests_should_run | ||
run_tests |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[run] | ||
omit = | ||
../_notebooks/ | ||
../_static_data/ | ||
../_tests/ |