-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-kepler.sh
executable file
·207 lines (160 loc) · 5.77 KB
/
build-kepler.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#!/bin/bash -e
# Use -e so that if the build fails, then travis will tell us so.
# Build Kepler, the Scientific Workflow System
# See https://kepler-project.org
# See https://travis-ci.org/icyphy/kepler-build
# Copy the file or directory named by
# source-file-or-directory to directory-in-gh-pages. For example
# updateGhPages logs/installers.txt logs
# will copy logs/installers.txt to logs in the gh-pages and push it.
# If the last argument ends in a /, then a directory by that name is created.
# The reason we need this is because the Travis deploy to gh-pages seems
# to overwrite everything in the repo.
# Usage:
# updateGhPages fileOrDirectory1 [fileOrDirectory2 ...] destinationDirectory
#
updateGhPages () {
length=$(($#-1))
sources=${@:1:$length}
destination=${@: -1}
if [ -z "$GITHUB_TOKEN" ]; then
echo "$0: GITHUB_TOKEN was not set, so $sources will not be copied to $destination in the gh-pages repo."
return
fi
# df -k
TMP=/tmp/ptIITravisBuild_gh_pages.$$
if [ ! -d $TMP ]; then
mkdir $TMP
fi
lastwd=`pwd`
cd $TMP
# Get to the Travis build directory, configure git and clone the repo
git config --global user.email "[email protected]"
git config --global user.name "travis-ci"
# Don't echo GITHUB_TOKEN
set +x
git clone --depth=1 --single-branch --branch=gh-pages https://${GITHUB_TOKEN}@github.com/icyphy/kepler-build gh-pages
set -x
df -k
# Commit and Push the Changes
cd gh-pages
echo "$destination" | grep '.*/$'
status=$?
if [ $status -eq 0 ]; then
if [ ! -d $destination ]; then
mkdir -p $destination
echo "$0: Created $destination in [pwd]."
fi
fi
ls -l $sources
cp -Rf $sources $destination
# JUnit xml output will include the values of the environment,
# which can include GITHUB_TOKEN, which is supposed to be secret.
# So, we remove any lines checked in to gh-pages that mentions
# GITHUB_TOKEN.
echo "Remove any instances of GITHUB_TOKEN: "
date
# Don't echo GITHUB_TOKEN
set +e
set +x
files=`find . -type f`
for file in $files
do
egrep -e "GITHUB_TOKEN" $file > /dev/null
retval=$?
if [ $retval != 1 ]; then
echo -n "$file "
egrep -v "GITHUB_TOKEN" $file > $file.tmp
mv $file.tmp $file
fi
done
#set -x
echo "Done."
set -e
git add -f .
date
# git pull
date
# Use git diff-index to avoid committing if there are no changes
# and having git commit ... return 1, causing this script to exit
# because it is invoked with bash -e.
# Don't change 'Travis Build gh-branch' because people filter email on that string.
git diff-index --quiet HEAD || git commit -m "Travis Build gh-branch: Lastest successful travis build $TRAVIS_BUILD_NUMBER auto-pushed $1 to $2 in gh-pages." -a
git pull
git push origin gh-pages
git push -f origin gh-pages
cd $lastwd
rm -rf $TMP
}
svn co https://code.kepler-project.org/code/kepler/trunk/modules/build-area
cd build-area
#ANT_HOME=/usr/local/apache-ant
#JAVA_HOME=/usr/java/jdk1.8.0_65
#PATH=${JAVA_HOME}/bin:/usr/local/bin:${PATH}
echo "JAVA_HOME: $JAVA_HOME"
echo "ANT_HOME: $ANT_HOME"
echo $PATH
which java
# Get any updates to the build area. Probably not necessary, but
# never a bad idea.
svn update
# Change to the nightly suite.
# The output has too many lines for Travis-ci, so we put it in a log.
if [ ! -d logs ]; then
mkdir logs
fi
LOG=logs/change-to.txt
echo "Running 'ant change-to -Dsuite=nightly', redirecting output to $LOG: `date`"
ant change-to -Dsuite=nightly 2>&1 | grep -v GITHUB_TOKEN > $LOG
echo "Last 100 lines of $LOG: `date`"
tail -100 $LOG
# Build it.
ant update
ant clean
ant compile eclipse netbeans idea
# Run Javadoc. The output has too many lines, so we put it in a log.
which javadoc
LOG=logs/javadoc.txt
echo "Running 'ant change-to -Dsuite=nightly', redirecting output to $LOG: `date`"
# Ignore it if "ant javadoc" returns non-zero and keep running.
ant javadoc 2>&1 | grep -v GITHUB_TOKEN > $LOG || true
echo "Last 100 lines of $LOG: `date`"
tail -100 $LOG
# Add javadoc files to the gh-pages branch so that they appear at
# https://icyphy.github.io/kepler-build/doc/javadoc/index.html
if [ ! -d ../javadoc ]; then
echo "Running javadoc did not create `pwd`/javadoc. JDK 10 javadoc has a bug that fails to create output if there are javadoc errors. So sad."
else
(cd ..; updateGhPages `pwd`/javadoc doc/)
fi
# Build the installers. If you change this, then update https://kepler-project.org/users/downloads
export KEPLER_VERSION=2.6.0.1
# Remove the installers directory, the mac installer requires this.
rm -rf ../finished-kepler-installers
# case `uname` in \
# Darwin) osfile=macosx-x86;; \
# Linux) osfile=linux-x64;; \
# esac; \
# L4J_TAR=/tmp/launch4j-3.11.tgz
# echo "Downloading for $osfile: `date`";
# wget "https://osdn.net/frs/g_redir.php?m=kent&f=launch4j%2Flaunch4j-3%2F3.11%2Flaunch4j-3.11-$$osfile.tgz" -O $L4J_TAR
ls -l resources || true
ls -l resources/installer || true
# mkdir -p resources/installer
# (cd resources/installer/; tar -zxf $L4J_TAR)
# Create the jar files for the installers.
ant jar
# Build the linux and windows installers.
ant make-linux-installer -Dversion=$KEPLER_VERSION
# Under Ubuntu, need to do
# apt-get install lib32z1 lib32ncurses5
# Otherwise, winres will report a missing file.
ant make-windows-installer -Dversion=$KEPLER_VERSION
echo "HOME: $HOME:"
ls $HOME
echo "../../finished-kepler-installers:"
ls ../../finished-kepler-installers
echo "../../finished-kepler-installers/linux:"
ls -l ../../finished-kepler-installers/linux
echo "../../finished-kepler-installers/windows:"
ls -l ../../finished-kepler-installers/windows