3 # MIT Alexander Couzens <lynxis@fe80.eu>
8 SDK_PATH
=https
://downloads.lede-project.org
/snapshots
/targets
/ar71xx
/generic
/
9 SDK
=lede-sdk-ar71xx-generic_gcc-5.4
.0_musl.Linux-x86_64
12 echo_red
() { printf "\033[1;31m$*\033[m\n"; }
13 echo_green
() { printf "\033[1;32m$*\033[m\n"; }
14 echo_blue
() { printf "\033[1;34m$*\033[m\n"; }
17 ("$@" 2>&1) > logoutput
&& status
=0 || status
=1
18 grep -qE 'WARNING|ERROR' logoutput
&& status
=1
20 if [ $status -eq 0 ]; then
21 echo_green
"=> $* successful"
24 echo_red
"=> $* failed"
29 # download will run on the `before_script` step
30 # The travis cache will be used (all files under $HOME/sdk/). Meaning
31 # We don't have to download the file again
36 echo_blue
"=== download SDK"
37 wget
"$SDK_PATH/sha256sums" -O sha256sums
38 wget
"$SDK_PATH/sha256sums.gpg" -O sha256sums.asc
40 # LEDE Build System (LEDE GnuPG key for unattended build jobs)
41 gpg
--recv 0xCD84BCED626471F1
42 # LEDE Release Builder (17.01 "Reboot" Signing Key)
43 gpg
--recv 0x833C6010D52BBB6B
44 gpg
--verify sha256sums.asc
45 grep "$SDK" sha256sums
> sha256sums.small
47 # if missing, outdated or invalid, download again
48 if ! sha256sum
-c .
/sha256sums.small
; then
49 wget
"$SDK_PATH/$SDK.tar.xz" -O "$SDK.tar.xz"
52 # check again and fail here if the file is still bad
53 sha256sum
-c .
/sha256sums.small
54 echo_blue
"=== SDK is up-to-date"
57 # test_package will run on the `script` step.
58 # test_package call make download check for very new/modified package in it's
59 # own clean sdk directory
61 # search for new or modified packages. PKGS will hold a list of package like 'admin/muninlite admin/monit ...'
62 PKGS
=$
(git
diff --name-only "$TRAVIS_COMMIT_RANGE" |
grep 'Makefile$' |
grep -v '/files/' |
awk -F'/Makefile' '{ print $1 }')
64 if [ -z "$PKGS" ] ; then
65 echo_blue
"No new or modified packages found!" >&2
69 echo_blue
"=== Found new/modified packages:"
74 echo_blue
"=== Setting up SDK"
77 tar Jxf
"$SDK_HOME/$SDK.tar.xz" --strip=1
79 # use github mirrors to spare lede servers
80 cat > feeds.conf
<<EOF
81 src-git base https://github.com/lede-project/source.git
82 src-link packages $PACKAGES_DIR
83 src-git luci https://github.com/openwrt/luci.git
86 .
/scripts
/feeds update
-a
87 .
/scripts
/feeds
install -a
89 echo_blue
"=== Setting up SDK done"
92 # E.g: pkg_dir => admin/muninlite
93 # pkg_name => muninlite
94 for pkg_dir
in $PKGS ; do
95 pkg_name
=$
(echo "$pkg_dir" |
awk -F/ '{ print $NF }')
96 echo_blue
"=== $pkg_name Testing package"
98 exec_status
make "package/$pkg_name/download" V
=s || RET
=1
99 exec_status
make "package/$pkg_name/check" V
=s || RET
=1
101 echo_blue
"=== $pkg_name Finished package"
107 echo_blue
"=== Travis ENV"
109 echo_blue
"=== Travis ENV"
111 if [ "$TRAVIS_PULL_REQUEST" = false
] ; then
112 echo "Only Pull Requests are supported at the moment." >&2
117 if [ $# -ne 1 ] ; then
119 Usage: $0 (download_sdk|test_packages)
121 download_sdk - download the SDK to $HOME/sdk.tar.xz
122 test_packages - do a make check on the package