forked from meteor/meteor
-
Notifications
You must be signed in to change notification settings - Fork 3
/
ci.sh
executable file
·133 lines (110 loc) · 3.92 KB
/
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh
#
# Optional Environment Variables for Configuration
#
# - TIMEOUT_SCALE_FACTOR: (default: 15)
# A multiplation factor that can be used to raise the wait-time on
# various longer-running tests. Useful for slower (or faster!) hardware.
# - ADDL_SELF_TEST_EXCLUDE: (optional)
# A regex or list of additional regexes to skip.
# Export this one so it's available in the node environment.
export TIMEOUT_SCALE_FACTOR=${TIMEOUT_SCALE_FACTOR:-15}
# Skip these tests always. Add other tests with ADDL_SELF_TEST_EXCLUDE.
SELF_TEST_EXCLUDE="^old cli tests|^minifiers can't register non-js|^minifiers: apps can't use|^compiler plugins - addAssets"
# If no SELF_TEST_EXCLUDE is defined, use those defined here by default
if ! [ -z "$ADDL_SELF_TEST_EXCLUDE" ]; then
SELF_TEST_EXCLUDE="${SELF_TEST_EXCLUDE}|${ADDL_SELF_TEST_EXCLUDE}"
fi
# Don't print as many progress indicators
export EMACS=t
export METEOR_HEADLESS=true
if [ -z "$CIRCLE_NODE_TOTAL" ] || [ -z "$CIRCLE_NODE_INDEX" ]; then
# In the case where these aren't set, just pretend like we're a single node.
# This is also handy if the user is using another CI service besides CircleCI
CIRCLE_NODE_TOTAL=1
CIRCLE_NODE_INDEX=0
echo "[warn] CIRCLE_NODE_TOTAL or CIRCLE_NODE_INDEX was not defined. \c"
echo "Running all tests!"
fi
# Clear dev_bundle/.npm to ensure consistent test runs.
./meteor npm cache clear
# Since PhantomJS has been removed from dev_bundle/lib/node_modules
# (#6905), but self-test still needs it, install it now.
./meteor npm install -g phantomjs-prebuilt browserstack-webdriver
# Make sure we have initialized and updated submodules such as
# packages/non-core/blaze.
git submodule update --init --recursive
# run different jobs based on CicleCI parallel container index
should_run_test () {
test $(($1 % $CIRCLE_NODE_TOTAL)) -eq $CIRCLE_NODE_INDEX
}
# Keep track of errors, but let the tests all finish. This is necessary since
# more than one of the following tests may be executed from a single run if
# parallelism is lower than the number of tests.
exit_code=0
# Also, if any uncaught errors slip through, fail the build.
set -e
if should_run_test 0; then
echo "Running warehouse self-tests"
./meteor self-test --headless \
--with-tag "custom-warehouse" \
--exclude "$SELF_TEST_EXCLUDE" \
|| exit_code=$?
fi
if should_run_test 1; then
echo "Running self-test (1): A-Com"
./meteor self-test --headless \
--file "^[a-b]|^c[a-n]|^co[a-l]|^compiler-plugins" \
--without-tag "custom-warehouse" \
--exclude "$SELF_TEST_EXCLUDE" \
|| exit_code=$?
fi
if should_run_test 2; then
echo "Running self-test (2): Con-K"
./meteor self-test --headless \
--file "^co[n-z]|^c[p-z]|^[d-k]" \
--without-tag "custom-warehouse" \
--exclude "$SELF_TEST_EXCLUDE" \
|| exit_code=$?
fi
if should_run_test 3; then
echo "Running self-test (3): L-O"
./meteor self-test --headless \
--file "^[l-o]" \
--without-tag "custom-warehouse" \
--exclude "$SELF_TEST_EXCLUDE" \
|| exit_code=$?
fi
if should_run_test 4; then
echo "Running self-test (4): P"
./meteor self-test --headless \
--file "^p" \
--without-tag "custom-warehouse" \
--exclude "$SELF_TEST_EXCLUDE" \
|| exit_code=$?
fi
if should_run_test 5; then
echo "Running self-test (5): Run"
./meteor self-test --headless \
--file "^run" \
--without-tag "custom-warehouse" \
--exclude "$SELF_TEST_EXCLUDE" \
|| exit_code=$?
fi
if should_run_test 6; then
echo "Running self-test (6): R-S"
./meteor self-test --headless \
--file "^r(?!un)|^s" \
--without-tag "custom-warehouse" \
--exclude "$SELF_TEST_EXCLUDE" \
|| exit_code=$?
fi
if should_run_test 7; then
echo "Running self-test (7): Sp-Z"
./meteor self-test --headless \
--file "^[t-z]|^command-line" \
--without-tag "custom-warehouse" \
--exclude "$SELF_TEST_EXCLUDE" \
|| exit_code=$?
fi
exit $exit_code