-
-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathtravis.sh
115 lines (88 loc) · 2.77 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
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
#!/bin/bash
ideaVersion="2017.1"
if [ "$PHPSTORM_ENV" == "2017.1" ]; then
ideaVersion="2017.1.3"
elif [ "$PHPSTORM_ENV" == "eap" ]; then
ideaVersion="163.5644.15"
fi
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
mkdir 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
if [ "$PHPSTORM_ENV" == "2017.1" ]; then
#php
download "http://phpstorm.espend.de/files/proxy/phpstorm-2017.1-php.zip"
unzip -qo $travisCache/phpstorm-2017.1-php.zip -d ./plugins
#twig
download "http://phpstorm.espend.de/files/proxy/phpstorm-2017.1-twig.zip"
unzip -qo $travisCache/phpstorm-2017.1-twig.zip -d ./plugins
elif [ "$PHPSTORM_ENV" == "eap" ]; then
#php
download "https://plugins.jetbrains.com/files/6610/28510/php-163.4830.18.zip"
unzip -qo $travisCache/php-163.4830.18.zip -d ./plugins
#twig
download "https://plugins.jetbrains.com/files/7303/28516/twig-163.4830.18.zip"
unzip -qo $travisCache/twig-163.4830.18.zip -d ./plugins
# TODO: extract latest builds for plugins from eap site they are not public
# https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program
# echo "No configuration for PhpStorm: $PHPSTORM_ENV"
# exit 1
else
echo "Unknown PHPSTORM_ENV value: $PHPSTORM_ENV"
exit 1
fi
rm -f $travisCache/php-annotation.jar
download "https://jetbrains-plugins.s3.amazonaws.com/7320/34692/php-annotation.jar"
cp $travisCache/php-annotation.jar ./plugins
rm -f $travisCache/php-toolbox.jar
download "https://plugins.jetbrains.com/files/8133/23580/php-toolbox.jar"
cp $travisCache/php-toolbox.jar ./plugins
# Run the tests
if [ "$1" = "-d" ]; then
ant -d -f build-test.xml -DIDEA_HOME=./idea
else
ant -f build-test.xml -DIDEA_HOME=./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}