-
Notifications
You must be signed in to change notification settings - Fork 4
/
travis.sh
executable file
·75 lines (57 loc) · 1.54 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
ideaVersion="2017.1.5"
ideaPluginVersion="2017.1"
travisCache=".cache"
if [ ! -d ${travisCache} ]; then
echo "Create cache" ${travisCache}
mkdir ${travisCache}
fi
function download {
url=$1
basename=${url##*[/|\\]}
cachefile=${travisCache}/${basename}
if [ ! -f ${cachefile} ]; then
wget $url -P ${travisCache};
else
echo "Cached file `ls -sh $cachefile` - `date -r $cachefile +'%Y-%m-%d %H:%M:%S'`"
fi
if [ ! -f ${cachefile} ]; then
echo "Failed to download: $url"
exit 1
fi
}
# Unzip IDEA
if [ -d ./idea ]; then
rm -rf idea
echo "created idea dir"
fi
# Download main idea folder
download "http://download.jetbrains.com/idea/ideaIU-${ideaVersion}.tar.gz"
tar zxf ${travisCache}/ideaIU-${ideaVersion}.tar.gz -C .
# Move the versioned IDEA folder to a known location
ideaPath=$(find . -name 'idea-IU*' | head -n 1)
mv ${ideaPath} ./idea
if [ -d ./plugins ]; then
rm -rf plugins
mkdir plugins
echo "created plugin dir"
fi
download "http://phpstorm.espend.de/files/proxy/phpstorm-${ideaPluginVersion}-php.zip"
unzip -qo $travisCache/phpstorm-${ideaPluginVersion}-php.zip -d ./plugins
# Run the tests
if [ "$1" = "-d" ]; then
ant -d -f build-test.xml -Didea.build=./idea
else
ant -f build-test.xml -Didea.build=./idea
fi
# Was our build successful?
stat=$?
if [ "${TRAVIS}" != true ]; then
ant -f build-test.xml -q clean
if [ "$1" = "-r" ]; then
rm -rf idea
rm -rf plugins
fi
fi
# Return the build status
exit ${stat}