-
Notifications
You must be signed in to change notification settings - Fork 36
/
run-all-tests.erb
executable file
·81 lines (61 loc) · 1.6 KB
/
run-all-tests.erb
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
#!/bin/bash
# Generated by rake (<%= Time.now %>)
REPORT=SUPPORTED_VERSIONS.md
global_status="all-good"
fail() {
local ruby_version=$1
local puppet_version=$2
echo "|${ruby_version}|${puppet_version}|FAILED|" >> $REPORT
global_status="failure-detected"
}
check() {
local ruby_version=$1
local puppet_version=$2
report_string="ruby_version=$ruby_version puppet_version=$puppet_version"
echo "==> Running ${report_string}"
export PUPPET_VERSION=$puppet_version
rm -f Gemfile.lock
rbenv local $ruby_version
echo "==> ruby -v (`ruby -v`)"
bundle -h 2>&1 1>/dev/null
if [ $? -ne 0 ]; then
gem install bundler
fi
bundle install
if [ $? -ne 0 ]; then
echo "==> bundle install failed!"
fail $ruby_version $puppet_version
else
bundle exec rake
if [ $? -ne 0 ]; then
fail $ruby_version $puppet_version
else
echo "|${ruby_version}|${puppet_version}|**SUPPORTED**|" >> $REPORT
fi
fi
}
unsupported() {
local ruby_version=$1
local puppet_version=$2
local note=$3
echo "|${ruby_version}|${puppet_version}|UNSUPPORTED|${note}|" >> $REPORT
}
echo -e "| Ruby Version | Puppet Version | Status | Note |\n|---|---|---|---|" > $REPORT
if [ $# -gt 0 ]; then
check $*
else
# generated from .travis.yml
<% checks.each do |check| %>
<%= check %>
<% end %>
fi
echo "*generated at `date`*" >> $REPORT
cat $REPORT
if [ "${global_status}" != "all-good" ]; then
echo
echo " ************************"
echo " *** FAILURE DETECTED ***"
echo " ************************"
echo
exit 1
fi