forked from SFDO-Tooling/CumulusCI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheroku_ci.sh
executable file
·96 lines (82 loc) · 3.37 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
# This script runs the tests on Heroku CI
# Clone the Github repo to the right branch/commit to generate a .git folder for use in /app
git clone -b "$HEROKU_TEST_RUN_BRANCH" --single-branch https://github.com/SalesforceFoundation/CumulusCI
cd CumulusCI
git reset --hard $HEROKU_TEST_RUN_COMMIT_VERSION
cd /app
mv CumulusCI/.git .
# Run the CumulusCI Unit Tests
nosetests --with-tap --tap-stream --with-coverage --cover-package=cumulusci
# If the last commit message contains [skip CumulusCI-Test], skip running any test flows
git log -n 1 | grep '\[skip CumulusCI-Test\]' > /dev/null
exit_status=$?
if [ "$exit_status" == "0" ]; then
echo "Found [skip CumulusCI-Test] in the commit message, skipping cci flow test runs"
coveralls
exit
fi
# For feature branches, skip running the CumulusCI-Test flows if there is not an open PR unless the last commit message contains [run CumulusCI-Test]
if [ "$HEROKU_TEST_RUN_BRANCH" != "master" ] &&\
[[ "$HEROKU_TEST_RUN_BRANCH" == feature/* ]]; then
echo "Checking for open pull request to determine next testing steps"
pr=`python scripts/has_open_pr.py "$HEROKU_TEST_RUN_BRANCH"`
git log -n 1 | grep '\[run CumulusCI-Test\]' > /dev/null
exit_status=$?
if [ "$pr" == ""] && [ "$exit_status" != "0"]; then
# If there is not an open PR, don't run the CumulusCI-Test flows
coveralls
exit
fi
fi
# Clone the CumulusCI-Test repo to run test builds against it with cci
echo "------------------------------------------"
echo "Running test builds against CumulusCI-Test"
echo "------------------------------------------"
echo ""
echo "Cloning https://github.com/SalesforceFoundation/CumulusCI-Test"
git clone https://github.com/SalesforceFoundation/CumulusCI-Test
cd CumulusCI-Test
if [ "$HEROKU_TEST_RUN_BRANCH" == "master" ] ||\
[[ "$HEROKU_TEST_RUN_BRANCH" == feature/* ]] ; then
# Start TAP output
echo "1...4"
# Run ci_feature
coverage run --append --source=../cumulusci `which cci` flow run ci_feature --org scratch --delete-org | tee cci.log
exit_status=$?
if [ "$exit_status" == "0" ]; then
echo "ok 1 - Successfully ran ci_feature"
else
echo "not ok 1 - Failed ci_feature: `tail -1 cci.log`"
fi
# Run ci_beta
coverage run --append --source=../cumulusci `which cci` flow run ci_beta --org scratch --delete-org | tee -a cci.log
exit_status=$?
if [ "$exit_status" == "0" ]; then
echo "ok 4 - Successfully ran ci_beta"
else
echo "not ok 4 - Failed ci_beta: `tail -1 cci.log`"
fi
# Run ci_master
coverage run --append --source=../cumulusci `which cci` flow run ci_master --org packaging | tee -a cci.log
exit_status=$?
if [ "$exit_status" == "0" ]; then
echo "ok 2 - Successfully ran ci_master"
else
echo "not ok 2 - Failed ci_master: `tail -1 cci.log`"
fi
# Run release_beta
coverage run --append --source=../cumulusci `which cci` flow run release_beta --org packaging | tee -a cci.log
exit_status=$?
if [ "$exit_status" == "0" ]; then
echo "ok 3 - Successfully ran release_beta"
else
echo "not ok 3 - Failed release_beta: `tail -1 cci.log`"
fi
fi
# Combine the CumulusCI-Test test coverage with the nosetest coverage
echo "Combining .coverage files"
cd ..
coverage combine .coverage CumulusCI-Test/.coverage
# Record to coveralls.io
coveralls