/
build.sh
executable file
·95 lines (77 loc) · 2.76 KB
/
build.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
#!/bin/bash
cd `dirname $0`
CWD="`pwd`"
echo "";
echo "--------------------------------------------------------";
echo "Welcome to the PresideCMS Test runner and build suite :)";
echo "--------------------------------------------------------";
echo "";
echo "This script will install dependencies, run tests, and conditionally build docs and package preside into a ZIP file.";
echo "Each of these operations can be run independently with the following commands:";
echo "";
echo "box install - installs dependencies";
echo "./test.sh - runs tests";
echo "./support/docs/build.sh - builds documentation";
echo "ant -f ./support/build/build.xml - packages PresideCMS into a zip file";
echo "";
echo "The script has dependencies on CommandBox, ant + an accessible database for running the test suite.";
echo "";
echo "-------------------------------------------------------";
echo "";
echo "Installing dependencies via box.json...";
echo "";
box install --force save=false
rm -rf ./system/externals/lucee-spreadsheet/javaLoader
rm -rf ./system/externals/lucee-spreadsheet/test
echo "";
echo "Running tests (please be patient, expect this to take several minutes)...";
echo "";
./test.sh || exit 1;
if [[ $TRAVIS_JDK_VERSION == 'openjdk7' ]] ; then
echo "Finished (only run tests on JDK 7, builds performed in the JDK8 environment)."
exit 0;
fi
if [[ $TRAVIS_PULL_REQUEST == 'true' ]] ; then
echo "Finished (not packaging up docs or source due to running in a pull request)."
exit 0;
fi
if [[ $TRAVIS_TAG == v* ]] ; then
./support/docs/build.sh
echo "";
echo "";
else
echo "Skipping docs build, not on a release tag in a travis build. To build the docs yourself, run ./support/docs/build.sh"
fi
if [[ $TRAVIS_TAG == v* ]] || [[ $TRAVIS_BRANCH == release* ]] ; then
if [[ $TRAVIS_TAG == v* ]] ; then
VERSION_NUMBER="${TRAVIS_TAG//v}"
else if [[ $TRAVIS_BRANCH == release* ]]
VERSION_NUMBER="${TRAVIS_BRANCH//release-}"
else
VERSION_NUMBER="unknown"
fi
echo "Packaging application ${VERSION_NUMBER}...";
echo "";
echo "";
ant -f support/build/build.xml -Dbranch=$TRAVIS_BRANCH -Dtag=$TRAVIS_TAG -Dversionnumber=$VERSION_NUMBER
echo "";
echo "";
echo "Creating and registering docker image";
if [[ $TRAVIS_TAG == v* ]] ; then
DOCKER_TAG=${TRAVIS_TAG:1}
else
DOCKER_TAG=bleeding-edge
fi
docker build -t pixl8/preside-cms:$DOCKER_TAG ./support/build
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
docker push pixl8/preside-cms:$DOCKER_TAG
if [[ $TRAVIS_TAG == v* ]] ; then
docker push pixl8/preside-cms:latest
fi
else
echo "Skipping packaging, not on stable or release branch in a travis build. To package preside yourself, run ant -f ./support/build/build.xml"
fi
echo "";
echo "All done :)";
echo "";
exit 0;