forked from testmycode/tmc-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-travis.sh
executable file
·62 lines (53 loc) · 2.34 KB
/
setup-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
#!/bin/bash -e
# Sets up dependencies and environment for tests to be run in Travis.
#
# This is not recommended to be run locally, and it employs some hacks and tricks to get by limitations of travis.
set -v
# Unset bundle Gemfile, since we have multiple projects with separate Gemfiles and it will just cause confusion
unset BUNDLE_GEMFILE
# Update bundler
gem update --system
gem --version
# Cache file containing vendor/bundle/cache - to speed up bundle install and to fix possible connection timeouts to Rubygems
wget -r -q -nH --cut-dirs=2 --no-parent -A gem http://testmycode.net/travis/rubygems-cache/vendor/
bundle install --retry=3 --jobs=3 --deployment
# Git settings so that Travis can clone submodules
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
git submodule update --init --recursive
git config --global user.email "[email protected]"
git config --global user.name "Travis"
# Install tmc-check
export CHECK_INSTALL_DIR=$HOME/check
mkdir $CHECK_INSTALL_DIR
git clone https://github.com/testmycode/tmc-check.git
cd tmc-check
bundle install --jobs=3 --retry=3 --deployment
make
make install PREFIX=$CHECK_INSTALL_DIR
export PATH="$CHECK_INSTALL_DIR/bin:$PATH"
cd ..
export LD_LIBRARY_PATH=$CHECK_INSTALL_DIR/lib:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$CHECK_INSTALL_DIR/include:$C_INCLUDE_PATH
export PKG_CONFIG_PATH=$CHECK_INSTALL_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
# Reduce mavens memory usage
export MAVEN_OPTS="-Xms512m -Xmx1024m -XX:PermSize=1024m"
# Build submodules except sandbox
bundle exec rake compile
# Use pre built tmc-sandbox
wget -qO- http://testmycode.net/travis/sandbox-$(git submodule status ext/tmc-sandbox | grep -E -o "[0-9a-f]{40}").tar.gz | tar xvz -C ext/
cd ext/tmc-sandbox/web
# Set current user and reduce max instances, though only one instance will be used at any given time
sed -i "s/\(tmc_user: \)tmc/\1 $(whoami)/" site.defaults.yml
sed -i "s/\(tmc_group: \)tmc/\1 $(whoami)/" site.defaults.yml
sed -i 's/\(max_instances: \)[0-9]*/\12/' site.defaults.yml
# Disable network
sed -i '/^network:$/{$!{N;s/^\(network:\)\n\( enabled: \)true$/\1\n\2false/;ty;P;D;:y}}' site.defaults.yml
cat site.defaults.yml
bundle install --retry=3 --jobs=3
rake ext
cd ../../../
git clone https://github.com/testmycode/tmc-langs.git $HOME/tmc-langs
cd $HOME/tmc-langs
mvn package -Dmaven.test.skip=true
cd -
set +v