Skip to content

Commit

Permalink
testing travis integration of make check
Browse files Browse the repository at this point in the history
  • Loading branch information
lynxis committed Jun 11, 2017
1 parent 4a3cae4 commit 165adb4
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: c
sudo: false

before_script:
- ./travis_do.sh download_sdk

script:
- ./travis_do.sh test_packages
62 changes: 62 additions & 0 deletions travis_do.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/sh
#
# MIT Alexander Couzens <[email protected]>

set -e

SDK=lede-sdk-ar71xx-generic_gcc-5.4.0_musl.Linux-x86_64
PACKAGES_DIR=$PWD

# download will run on the `before_script` step
download_sdk() {
wget https://downloads.lede-project.org/snapshots/targets/ar71xx/generic/$SDK.tar.xz -O $HOME/sdk.tar.gz
}

# test_package will run on the `script` step
test_packages() {
# search for new or modified packages. PKGS will hold a list of package like 'admin/muninlite admin/monit ...'
PKGS=$(git diff --stat origin/master | grep Makefile | grep -v '/files/' | awk '{ print $1}' | awk -F'/Makefile' '{ print $1 }')

if [ -z "$PKGS" ] ; then
echo "No new or modified packages found!" >&2
exit 1
fi

# E.g: pkg_dir => admin/muninlite
# pkg_name => muninlite
for pkg_dir in $PKGS ; do
local pkg_name
pkg_name=$(echo $pkg_dir | awk -F/ '{ print $NF }')

# create a clean sdk for every package
mkdir -p $HOME/tmp/$pkg_name/
cd $HOME/tmp/$pkg_name/
tar Jxf $HOME/sdk.tar.gz
cd $SDK

cat > feeds.conf <<EOF
src-git base https://git.lede-project.org/source.git
src-link packages $PACKAGES_DIR
src-git luci https://git.lede-project.org/project/luci.git
src-git routing https://git.lede-project.org/feed/routing.git
src-git telephony https://git.lede-project.org/feed/telephony.git
EOF
./scripts/feeds update
./scripts/feeds install $pkg_name

make package/$pkg_name/download
make package/$pkg_name/check V=s | grep -q WARNING || exit 1
done
}

if [ $# -ne 2 ] ; then
cat <<EOF
Usage: $0 (download_sdk|test_packages)
download_sdk - download the SDK to $HOME/sdk.tar.xz
test_packages - do a make check on the package
EOF
exit 1
fi

$@

0 comments on commit 165adb4

Please sign in to comment.