forked from rubocop/rubocop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.sh
executable file
·56 lines (45 loc) · 1.02 KB
/
.travis.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
#!/bin/bash
set -eo pipefail
run() {
run_main_task
report_coverage
documentation
check_requiring_libraries
}
# Check requiring libraries successfully.
# See https://github.com/rubocop-hq/rubocop/pull/4523#issuecomment-309136113
check_requiring_libraries() {
logged ruby -I lib -r rubocop -e 'exit 0'
}
# Running YARD under jruby crashes so skip checking the manual.
documentation() {
if ! is_jruby; then
logged bundle exec rake documentation_syntax_check generate_cops_documentation
fi
}
is_jruby() {
[ "$(ruby -e "puts RUBY_ENGINE == 'jruby'")" = 'true' ]
}
is_master() {
[ "$TRAVIS_BRANCH" = 'master' ] && [ "$TRAVIS_PULL_REQUEST" = 'false' ]
}
report_coverage() {
if is_test && is_master; then
logged bundle exec codeclimate-test-reporter
fi
}
run_main_task() {
if is_master || ! is_test || is_jruby; then
logged bundle exec rake "$TASK"
else
logged bundle exec rake "parallel:$TASK"
fi
}
logged() {
echo "$ $*"
time "$@"
}
is_test() {
[ "$TASK" != 'internal_investigation' ]
}
run