source: mainline/tools/travis.sh@ b8ab299

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since b8ab299 was 03cfe2ec, checked in by GitHub <noreply@…>, 8 years ago

Travis CI improvements (#16)

Several improvements of the CI process. The dashboard is less cluttered as less variables are set. Ported software is built too. But only for ia32 as that seems to be the most healthy platform in this context. Overall, this should provide shorter feedback than the nightly builds.

Due to complexity of the building process (especially when ported software is compiled) a separate script is used with Travis CI to control the build. See comments in .travis.yml for details how to customize what is being built (if you plan to use it on your feature branches).

  • Property mode set to 100755
File size: 6.8 KB
Line 
1#!/bin/sh
2
3#
4# Copyright (c) 2018 Vojtech Horky
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
9# are met:
10#
11# - Redistributions of source code must retain the above copyright
12# notice, this list of conditions and the following disclaimer.
13# - Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in the
15# documentation and/or other materials provided with the distribution.
16# - The name of the author may not be used to endorse or promote products
17# derived from this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29#
30
31#
32# This is wrapper script for testing build of HelenOS under Travis CI [1].
33#
34# You probably do not want to run this script directly. If you wish to test
35# that HelenOS builds for all architectures, consider using either check.sh
36# script or running our CI solution [2] (if you want to test ported software
37# too).
38#
39# [1] https://travis-ci.org/
40# [2] http://www.helenos.org/wiki/CI
41#
42
43H_ARCH_CONFIG_CROSS_TARGET=2
44H_ARCH_CONFIG_OUTPUT_FILENAME=3
45
46h_get_arch_config_space() {
47 cat <<'EOF_CONFIG_SPACE'
48amd64:amd64-unknown-elf:image.iso
49arm32/beagleboardxm:arm-linux-gnueabi:uImage.bin
50arm32/beaglebone:arm-linux-gnueabi:uImage.bin
51arm32/gta02:arm-linux-gnueabi:uImage.bin
52arm32/integratorcp:arm-linux-gnueabi:image.boot
53arm32/raspberrypi:arm-linux-gnueabi:uImage.bin
54ia32:i686-pc-linux-gnu:image.iso
55ia64/i460GX:ia64-pc-linux-gnu:image.boot
56ia64/ski:ia64-pc-linux-gnu:image.boot
57mips32/malta-be:mips-linux-gnu:image.boot
58mips32/malta-le:mipsel-linux-gnu:image.boot
59mips32/msim:mipsel-linux-gnu:image.boot
60ppc32:ppc-linux-gnu:image.iso
61sparc64/niagara:sparc64-linux-gnu:image.iso
62sparc64/ultra:sparc64-linux-gnu:image.iso
63EOF_CONFIG_SPACE
64}
65
66h_get_arch_config() {
67 h_get_arch_config_space | grep "^$H_ARCH:" | cut '-d:' -f "$1"
68}
69
70H_DEFAULT_HARBOURS_LIST="binutils fdlibm jainja libgmp libiconv msim pcc zlib libisl libmpfr libpng python2 libmpc gcc"
71
72
73
74#
75# main script starts here
76#
77
78# Check we are actually running inside Travis
79if [ -z "$TRAVIS" ]; then
80 echo "\$TRAVIS env not set. Are you running me inside Travis?" >&2
81 exit 5
82fi
83
84# Check HelenOS configuration was set-up
85if [ -z "$H_ARCH" ]; then
86 echo "\$H_ARCH env not set. Are you running me inside Travis?" >&2
87 exit 5
88fi
89
90# Check cross-compiler target
91H_CROSS_TARGET=`h_get_arch_config $H_ARCH_CONFIG_CROSS_TARGET`
92if [ -z "$H_CROSS_TARGET" ]; then
93 echo "No suitable cross-target found for '$H_ARCH.'" >&2
94 exit 1
95fi
96
97
98# Custom CROSS_PREFIX
99export CROSS_PREFIX=/usr/local/cross-static/
100
101# Default Harbours repository
102if [ -z "$H_HARBOURS_REPOSITORY" ]; then
103 H_HARBOURS_REPOSITORY="https://github.com/HelenOS/harbours.git"
104fi
105
106if [ "$1" = "help" ]; then
107 echo
108 echo "Following variables needs to be set prior running this script."
109 echo "Example settings follows:"
110 echo
111 echo "export H_ARCH=$H_ARCH"
112 echo "export TRAVIS_BUILD_ID=`date +%s`"
113 echo
114 echo "export H_HARBOURS=true"
115 echo "export H_HARBOUR_LIST=\"$H_DEFAULT_HARBOURS_LIST\""
116 echo
117 exit 0
118
119elif [ "$1" = "install" ]; then
120 set -x
121
122 # Install dependencies
123 sudo apt-get -qq update || exit 1
124 sudo apt-get install -y genisoimage || exit 1
125
126 # Fetch and install cross-compiler
127 wget "http://ci.helenos.org/download/helenos-cross-$H_CROSS_TARGET.static.tar.xz" -O "/tmp/cross-$H_CROSS_TARGET.static.tar.xz" || exit 1
128 sudo mkdir -p "$CROSS_PREFIX" || exit 1
129 sudo tar -xJ -C "$CROSS_PREFIX" -f "/tmp/cross-$H_CROSS_TARGET.static.tar.xz" || exit 1
130 exit 0
131
132
133elif [ "$1" = "run" ]; then
134 set -x
135
136 # Expected output filename (bootable image)
137 H_OUTPUT_FILENAME=`h_get_arch_config $H_ARCH_CONFIG_OUTPUT_FILENAME`
138 if [ -z "$H_OUTPUT_FILENAME" ]; then
139 echo "No suitable output image found for '$H_ARCH.'" >&2
140 exit 1
141 fi
142
143 # Build HARBOURs too?
144 H_HARBOURS=`echo "$H_HARBOURS" | grep -e '^true$' -e '^false$'`
145 if [ -z "$H_HARBOURS" ]; then
146 H_HARBOURS=false
147 fi
148 if [ -z "$H_HARBOUR_LIST" ]; then
149 H_HARBOUR_LIST="$H_DEFAULT_HARBOURS_LIST"
150 fi
151
152
153 # Build it
154 make "PROFILE=$H_ARCH" HANDS_OFF=y || exit 1
155 test -s "$H_OUTPUT_FILENAME" || exit 1
156
157 echo
158 echo "HelenOS for $H_ARCH built okay."
159 echo
160
161 # Build harbours
162 if $H_HARBOURS; then
163 echo
164 echo "Will try to build ported software for $H_ARCH."
165 echo "Repository used is $H_HARBOURS_REPOSITORY."
166 echo
167
168 H_HELENOS_HOME=`pwd`
169 cd "$HOME" || exit 1
170 git clone --depth 10 "$H_HARBOURS_REPOSITORY" helenos-harbours || exit 1
171 mkdir "build-harbours-$TRAVIS_BUILD_ID" || exit 1
172 (
173 cd "build-harbours-$TRAVIS_BUILD_ID" || exit 1
174 mkdir build || exit 1
175 cd build
176
177 (
178 #[ "$H_ARCH" = "mips32/malta-be" ] && H_ARCH="mips32eb/malta-be"
179 echo "root = $H_HELENOS_HOME"
180 echo "arch =" `echo "$H_ARCH" | cut -d/ -f 1`
181 echo "machine =" `echo "$H_ARCH" | cut -d/ -f 2`
182 ) >hsct.conf || exit 1
183
184 # "$HOME/helenos-harbours/hsct.sh" init "$H_HELENOS_HOME" "$H_ARCH" build >/dev/null 2>/dev/null || exit 1
185
186 "$HOME/helenos-harbours/hsct.sh" update || exit 1
187
188 FAILED_HARBOURS=""
189 for HARBOUR in $H_HARBOUR_LIST; do
190 "$HOME/helenos-harbours/hsct.sh" archive --no-deps "$HARBOUR" >"run-$HARBOUR.log" 2>&1
191 if [ $? -eq 0 ]; then
192 tail -n 10 "run-$HARBOUR.log"
193 else
194 FAILED_HARBOURS="$FAILED_HARBOURS $HARBOUR"
195 cat build/$HARBOUR/*/config.log
196 tail -n 100 "run-$HARBOUR.log"
197 fi
198
199 done
200
201 if [ -n "$FAILED_HARBOURS" ]; then
202 echo
203 echo "ERROR: following packages were not built:$FAILED_HARBOURS."
204 echo
205 exit 1
206 fi
207 ) || exit 1
208 fi
209else
210 echo "Invalid action specified." >&2
211 exit 5
212fi
213
Note: See TracBrowser for help on using the repository browser.