1
- # This file was generated on 2019-12-18T14:01:39+00:00 from the rspec-dev repo.
2
- # DO NOT modify it by hand as your changes will get lost the next time it is generated.
3
-
4
1
SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
5
- source $SCRIPT_DIR /ci_functions.sh
6
- source $SCRIPT_DIR /predicate_functions.sh
7
-
8
- # If JRUBY_OPTS isn't set, use these.
9
- # see https://docs.travis-ci.com/user/ci-environment/
10
- export JRUBY_OPTS=${JRUBY_OPTS:- " --server -Xcompile.invokedynamic=false" }
11
2
SPECS_HAVE_RUN_FILE=specs.out
12
3
MAINTENANCE_BRANCH=` cat maintenance-branch`
13
4
14
5
# Don't allow rubygems to pollute what's loaded. Also, things boot faster
15
6
# without the extra load time of rubygems. Only works on MRI Ruby 1.9+
16
- if is_mri; then
17
- export RUBYOPT=" --disable=gem"
18
- fi
7
+ export RUBYOPT=" --disable=gem"
8
+
9
+ ci_retry () {
10
+ local result=0
11
+ local count=1
12
+ while [ $count -le 3 ]; do
13
+ [ $result -ne 0 ] && {
14
+ echo -e " \n\033[33;1mThe command \" $@ \" failed. Retrying, $count of 3.\033[0m\n" >&2
15
+ }
16
+ " $@ "
17
+ result=$?
18
+ [ $result -eq 0 ] && break
19
+ count=$(( $count + 1 ))
20
+ sleep 1
21
+ done
19
22
20
- function clone_repo {
21
- if [ ! -d $1 ]; then # don't clone if the dir is already there
22
- travis_retry eval " git clone https://github.com/rspec/$1 --depth 1 --branch $MAINTENANCE_BRANCH "
23
- fi ;
23
+ [ $count -eq 3 ] && {
24
+ echo " \n\033[33;1mThe command \" $@ \" failed 3 times.\033[0m\n" >&2
25
+ }
26
+
27
+ return $result
24
28
}
25
29
26
- function run_specs_and_record_done {
27
- local rspec_bin=bin/rspec
30
+ fold () {
31
+ local name=" $1 "
32
+ local status=0
33
+ shift 1
34
+ echo " ============= Starting $name ==============="
28
35
29
- # rspec-core needs to run with a special script that loads simplecov first,
30
- # so that it can instrument rspec-core's code before rspec-core has been loaded.
31
- if [ -f script/rspec_with_simplecov ] && is_mri; then
32
- rspec_bin=script/rspec_with_simplecov
33
- fi ;
36
+ " $@ "
37
+ status=$?
34
38
35
- echo " ${PWD} /bin/rspec"
36
- $rspec_bin spec --backtrace --format progress --profile --format progress --out $SPECS_HAVE_RUN_FILE
39
+ if [ " $status " -eq 0 ]; then
40
+ echo " ============= Ending $name ==============="
41
+ else
42
+ STATUS=" $status "
43
+ fi
44
+
45
+ return $status
37
46
}
38
47
39
- function run_cukes {
40
- if [ -d features ]; then
41
- # force jRuby to use client mode JVM or a compilation mode that's as close as possible,
42
- # idea taken from https://github.com/jruby/jruby/wiki/Improving-startup-time
43
- #
44
- # Note that we delay setting this until we run the cukes because we've seen
45
- # spec failures in our spec suite due to problems with this mode.
46
- export JAVA_OPTS=' -client -XX:+TieredCompilation -XX:TieredStopAtLevel=1'
47
-
48
- echo " ${PWD} /bin/cucumber"
49
-
50
- if is_jruby; then
51
- # For some reason JRuby doesn't like our improved bundler setup
52
- RUBYOPT=" -I${PWD} /../bundle -rbundler/setup" \
53
- PATH=" ${PWD} /bin:$PATH " \
54
- bin/cucumber --strict
55
- else
56
- # Prepare RUBYOPT for scenarios that are shelling out to ruby,
57
- # and PATH for those that are using `rspec` or `rake`.
58
- RUBYOPT=" ${RUBYOPT} -I${PWD} /../bundle -rbundler/setup" \
59
- PATH=" ${PWD} /bin:$PATH " \
60
- bin/cucumber --strict
61
- fi
48
+ function documentation_enforced {
49
+ if [ -x ./bin/yard ]; then
50
+ return 0
51
+ else
52
+ return 1
62
53
fi
63
54
}
64
55
56
+ function clone_repo {
57
+ if [ ! -d $1 ]; then # don't clone if the dir is already there
58
+ ci_retry eval " git clone https://github.com/rspec/$1 --depth 1 --branch $MAINTENANCE_BRANCH "
59
+ fi ;
60
+ }
61
+
62
+ function run_specs_and_record_done {
63
+ echo " ${PWD} /bin/rspec"
64
+ bin/rspec spec --backtrace --format progress --profile --format progress --out $SPECS_HAVE_RUN_FILE
65
+ }
66
+
65
67
function run_specs_one_by_one {
66
68
echo " Running each spec file, one-by-one..."
67
69
@@ -71,27 +73,6 @@ function run_specs_one_by_one {
71
73
done
72
74
}
73
75
74
- function run_spec_suite_for {
75
- if [ ! -f ../$1 /$SPECS_HAVE_RUN_FILE ]; then # don't rerun specs that have already run
76
- if [ -d ../$1 ]; then
77
- echo " Running specs for $1 "
78
- pushd ../$1
79
- unset BUNDLE_GEMFILE
80
- bundle_install_flags=` cat .travis.yml | grep bundler_args | tr -d ' "' | grep -o " .*" `
81
- travis_retry eval " (unset RUBYOPT; exec bundle install $bundle_install_flags )"
82
- run_specs_and_record_done
83
- popd
84
- else
85
- echo " "
86
- echo " WARNING: The ../$1 directory does not exist. Usually the"
87
- echo " travis build cds into that directory and run the specs to"
88
- echo " ensure the specs still pass with your latest changes, but"
89
- echo " we are going to skip that step."
90
- echo " "
91
- fi ;
92
- fi ;
93
- }
94
-
95
76
function check_binstubs {
96
77
echo " Checking required binstubs"
97
78
@@ -174,16 +155,3 @@ function check_documentation_coverage {
174
155
end
175
156
"
176
157
}
177
-
178
- function check_style_and_lint {
179
- echo " bin/rubocop"
180
- eval " (unset RUBYOPT; rm -rf tmp/*; exec bin/rubocop)"
181
- }
182
-
183
- function run_all_spec_suites {
184
- fold " rspec-core specs" run_spec_suite_for " rspec-core"
185
- fold " rspec-expectations specs" run_spec_suite_for " rspec-expectations"
186
- fold " rspec-mocks specs" run_spec_suite_for " rspec-mocks"
187
- fold " rspec-rails specs" run_spec_suite_for " rspec-rails"
188
- fold " rspec-support specs" run_spec_suite_for " rspec-support"
189
- }
0 commit comments