forked from spring-attic/spring-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-samples.sh
executable file
·59 lines (53 loc) · 1.53 KB
/
build-samples.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
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
#!/usr/bin/env bash
RC=0
echo "Testing buildpacks-based builds"
if ! (cd "samples/commandlinerunner" && mvn -ntp spring-boot:build-image); then
RC=1
fi
docker run commandlinerunner:0.0.1-SNAPSHOT&
PID=$!
sleep 3
kill ${PID} > /dev/null 2>&1
if ! (cd "samples/commandlinerunner-gradle" && ./gradlew bootBuildImage); then
RC=1
fi
docker run commandlinerunner-gradle:0.0.1-SNAPSHOT&
PID=$!
sleep 3
kill ${PID} > /dev/null 2>&1
if ! (cd "samples/webmvc-kotlin" && ./gradlew bootBuildImage); then
RC=1
fi
docker run webmvc-kotlin:0.0.1-SNAPSHOT&
PID=$!
sleep 3
kill ${PID} > /dev/null 2>&1
if ! (cd "samples/security-kotlin" && ./gradlew bootBuildImage); then
RC=1
fi
docker run security-kotlin:0.0.1-SNAPSHOT&
PID=$!
sleep 3
kill ${PID} > /dev/null 2>&1
echo "GraalVM: `native-image --version`" > samples-summary.csv
echo "Date,Sample,Build Time (s),Build Mem (GB),RSS Mem (M),Image Size (M),Startup Time (s),JVM Uptime (s)" >> samples-summary.csv
for d in $(find samples -maxdepth 2 -type d)
do
if [[ -f "$d/build.sh" && ! -f "$d/.ignore" ]]; then
if ! (cd "$d" && ./build.sh); then
RC=1
fi
if [ -f "$d/target/native-image/summary.csv" ]; then
cat $d/target/native-image/summary.csv >> samples-summary.csv
else
echo `date +%Y%m%d-%H%M`,`basename $d`,ERROR,-,,,, >> samples-summary.csv
fi
fi
done
head -1 samples-summary.csv
if ! [ -x "$(command -v tty-table)" ]; then
tail -n +2 samples-summary.csv | perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' | column -t -s,
else
tail -n +2 samples-summary.csv | tty-table
fi
exit $RC