-
Notifications
You must be signed in to change notification settings - Fork 16
/
run_tests
executable file
·86 lines (75 loc) · 1.95 KB
/
run_tests
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
set -e
ME="${BASH_SOURCE[0]}"
mydir=$(cd $(dirname $ME) && pwd)
cd $mydir
container="robkinyon/dbm-deep"
# Broken: 5.12
all_versions="5.10 5.14 5.16 5.18 5.20 5.22 5.24"
export MSYS_NO_PATHCONV=1
if [[ "$1" == "pull" ]]; then
shift
versions=${@:-"${all_versions}"}
for version in ${versions}; do
docker pull perl:${version}
done
elif [[ "$1" == "build" ]]; then
shift
mkdir -p build_log
versions=${@:-"${all_versions}"}
for version in ${versions}; do
echo "Running build for perl-${version}"
set +e
(
cat Dockerfile.test | sed "s/{{version}}/${version}/" \
> Dockerfile.${version}
docker build -t ${container}:${version} -f Dockerfile.${version} .
rm Dockerfile.${version}
)&>build_log/${version}.log
set -e
done
elif [[ "$1" == "test" ]]; then
shift
versions=${@:-"${all_versions}"}
for version in ${versions}; do
echo "Running tests against perl-${version}"
MSYS_NO_PATHCONV=1 \
docker run \
--rm \
-v $(pwd)/lib:/app/lib \
-v $(pwd)/t:/app/t \
${container}:${version} #prove -l t/parent_child.t
done
elif [[ "$1" == "release" ]]; then
shift
if [[ ! -f ~/.pause ]]; then
>&2 echo "No ~/.pause file found."
exit 1
fi
# Because of an interaction between Docker-toolbox and Git-bash, we have to
# copy the .pause here out of $HOME.
cp ~/.pause .
tag=5.24
if [[ -z $(docker images -q ${container}:${tag}) ]]; then
$ME build ${tag}
fi
files_dirs_to_map=(
lib t utils etc
Changes LICENSE
Build.PL
MANIFEST MANIFEST.SKIP
)
volumes=(-v $(pwd)/.pause:/root/.pause)
for item in ${files_dirs_to_map[@]}; do
volumes+=(-v $(pwd)/$item:/app/$item)
done
docker run \
--rm \
"${volumes[@]}" \
--entrypoint bash \
${container}:${tag} \
-c "carton exec perl Build.PL && ./Build dist && cpan-upload *.tar.gz"
else
>&2 echo "${ME}: <pull | build | test | release> [version, ...]"
exit 1
fi