forked from spring-attic/spring-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-samples.sh
executable file
·63 lines (58 loc) · 1.67 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
60
61
62
63
#!/usr/bin/env bash
RC=0
echo "Testing buildpacks-based builds"
if ! (cd "samples/commandlinerunner" && mvn -ntp clean package 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),ReflectConfig (lines)" >> samples-summary.csv
for d in $(find samples -maxdepth 2 -type d | sort -n)
do
if [[ -f "$d/build.sh" && ! -f "$d/.ignore" ]]; then
if ! (cd "$d" && ./build.sh); then
RC=1
fi
if [ -f "$d/pom.xml" ]; then
REPORT_DIR="$d/target/native"
else
REPORT_DIR="$d/build/native"
fi
if [ -f "$REPORT_DIR/summary.csv" ]; then
cat $REPORT_DIR/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