forked from ubuntu/snappy-playpen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci-run
executable file
·30 lines (24 loc) · 897 Bytes
/
ci-run
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
#!/bin/sh
current_branch=`git rev-parse --abbrev-ref HEAD`
projects_to_test=`find * -maxdepth 0 -type d`
if [ "$current_branch" != "master" ]; then
projects_to_test=`git diff --name-only master..$current_branch | sed -n 's#\([^/]*\).*#\1#p' | sort -u`
fi
root_dir=`pwd`
return_code=0
for dir in $projects_to_test; do
# Don't include files in root, template and testing directories
[ ! -d $dir ] && continue
[ "$dir" = "snap-template" ] && continue
[ "$dir" = "testing" ] && continue
echo "Testing $dir"
cd ${root_dir}/$dir
docker run -v $(pwd):/snapcraft -t didrocks/snapcraft sh -c "cd /snapcraft && snapcraft update && snapcraft"
ls *.snap
if [ $? -ne 0 ]; then
echo "FAILURE: No .snap file built"
return_code=1
fi
echo "###############################################################################"
done
exit $return_code