-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.sh
executable file
·28 lines (24 loc) · 1002 Bytes
/
tests.sh
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
#!/bin/bash
set -e
GIT_CHANGES='git diff --diff-filter=ACMR --name-only HEAD^'
# run test if TEST has been changed
if [ -n "$($GIT_CHANGES | grep $TEST)" ]; then
# build image for TEST
./build.sh $(cut -d\/ -f1,2 <<< $TEST)/Dockerfile
# build packages if TEST is a build script
if [ -n "$(grep build_scripts <<< $TEST)" ]; then
# get docker tag name from filepath
tag=$(cut -d\/ -f1,2 <<< $TEST | sed 's/\//-/')
# get package name from filename
package=$(basename $TEST | sed 's/build_//')
# get space delimited versions to test from file contents
versions=$(grep TEST_VERSIONS $TEST | sed 's/.*TEST_VERSIONS:\s*//')
# test all specified versions
for version in $versions; do
docker run -e "BUILD_PACKAGE=${package}" -e "BUILD_VERSION=${version}" -e 'BUILD_ITERATION=1' -v `pwd`:/mnt/shared colinhoglund/fpm:${tag}
done
fi
else
echo "INFO: Skipping unchanged build for $TEST"
exit 0
fi