-
Notifications
You must be signed in to change notification settings - Fork 29
/
heroku_ci.sh
executable file
·39 lines (32 loc) · 1.18 KB
/
heroku_ci.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# This script runs the tests on Heroku CI
set -x
# Pretend this is a git repo so that coveralls can find git info
git clone -b "$HEROKU_TEST_RUN_BRANCH" --single-branch https://github.com/SFDO-Tooling/MetaCI MetaCI_checkout
cd MetaCI_checkout
git reset --hard $HEROKU_TEST_RUN_COMMIT_VERSION
cd ..
mv MetaCI_checkout/.git ./
rm -rf MetaCI_checkout
export DJANGO_SETTINGS_MODULE=config.settings.test
# Enable coveralls parallel mode so we can report for both Python & JS
export COVERALLS_PARALLEL=true
# Coveralls doesn't recognize the Heroku CI environment automatically.
# So let's pretend we're CircleCI.
export CIRCLECI=true
export CIRCLE_BUILD_NUM=$HEROKU_TEST_RUN_ID
# Check for missing Django db migrations
DATABASE_URL=sqlite://:memory: ./manage.py makemigrations --check --dry-run || exit 1
# Run Python tests
coverage run $(which pytest) metaci --tap-stream
exit_status=$?
if [ $exit_status -eq 0 ]
then
$(which pytest) integration-tests
exit_status=$?
fi
coveralls
curl -k "https://coveralls.io/webhook?repo_token=${COVERALLS_REPO_TOKEN}" -d "payload[build_num]=${HEROKU_TEST_RUN_ID}&payload[status]=done"
if [ "$exit_status" != "0" ]; then
exit $exit_status
fi