-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy path.travis-ci.sh
70 lines (57 loc) · 2.08 KB
/
.travis-ci.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
# OPAM packages needed to build tests.
OPAM_PACKAGES="cmdliner"
case "$OCAML_VERSION,$OPAM_VERSION" in
3.12.1,1.0.0) ppa=avsm/ocaml312+opam10 ;;
3.12.1,1.1.0) ppa=avsm/ocaml312+opam11 ;;
4.00.1,1.0.0) ppa=avsm/ocaml40+opam10 ;;
4.00.1,1.1.0) ppa=avsm/ocaml40+opam11 ;;
4.01.0,1.0.0) ppa=avsm/ocaml41+opam10 ;;
4.01.0,1.1.0) ppa=avsm/ocaml41+opam11 ;;
*) echo Unknown $OCAML_VERSION,$OPAM_VERSION; exit 1 ;;
esac
echo "yes" | sudo add-apt-repository ppa:$ppa
sudo apt-get update -qq
sudo apt-get install -qq ocaml ocaml-native-compilers camlp4-extra opam gnuplot m4
export OPAMYES=1
export OPAMVERBOSE=1
echo OCaml version
ocaml -version
echo OPAM versions
opam --version
opam --git-version
opam init
opam install ${OPAM_PACKAGES}
eval `opam config -env`
# Post-boilerplate
git clone http://github.com/robhoes/elo-ladder
cd elo-ladder
make
./ladder print --gh-pages --title "XenServer Chess Ladder" ../players ../games --reverse > index.md
./ladder json ../players ../games > ladder.json
(echo set terminal png; ./ladder history --format=gnuplot ../players ../games) | gnuplot > ladder.png
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo -e "Starting to update gh-pages\n"
#copy data we're interested in to other place
cp index.html $HOME/index.html
cp ladder.js $HOME/ladder.js
cp ladder.json $HOME/ladder.json
cp ladder.png $HOME/ladder.png
cp style.css $HOME/style.css
#go to home and setup git
cd $HOME
git config --global user.email "[email protected]"
git config --global user.name "Travis"
#using token clone gh-pages branch
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/robhoes/elo-ladder-chess.git gh-pages > /dev/null
#go into directory and copy data we're interested in to that directory
cd gh-pages
cp -f $HOME/index.html .
cp -f $HOME/ladder.js .
cp -f $HOME/ladder.json .
cp -f $HOME/ladder.png .
cp -f $HOME/style.css .
#add, commit and push files
git commit --allow-empty -am "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages"
git push -fq origin gh-pages > /dev/null
echo -e "Updated Rob's gh-pages with latest ladder\n"
fi