Merge pull request #261 from waddlesplash/travis_ci

Lint recipes on Travis-CI on each PR.
This commit is contained in:
gus knight
2015-06-30 14:31:11 -04:00
3 changed files with 26 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.recipe linguist-language=Shell

11
.travis.yml Normal file
View File

@@ -0,0 +1,11 @@
language: python
python: "2.7"
install:
- cd ..
- git clone https://github.com/haikuports/haikuporter.git --depth=1
- cd haikuports
- PATH=$PATH:../haikuporter && export PATH
- printf 'TREE_PATH="'`pwd`'"\nPACKAGER="Nobody <server@fake>"\nTARGET_ARCHITECTURE="x86"\n' >haikuports.conf
- wget https://github.com/waddlesplash/haiku-licenses/archive/master.zip && unzip master.zip
script:
- ./lint-new-recipes.sh --config=haikuports.conf --licenses=haiku-licenses-master

14
lint-new-recipes.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# Lints all the recipes created / modified since upstream HEAD.
git remote add real_origin https://github.com/haikuports/haikuports.git || true
git fetch real_origin
files=$(git diff $(git rev-parse --abbrev-ref HEAD) real_origin/master --numstat | awk '{print $3}')
for file in $files; do
if [ -e "$file" ] && [[ "$file" == *recipe ]]; then
baseName=$(basename $file)
portName=${baseName::-7}
haikuporter $@ --lint $portName
if [ $? -ne 0 ]; then exit 1; fi
fi
done