forked from aws/serverless-java-container
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis.sh
executable file
·112 lines (103 loc) · 2.83 KB
/
travis.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env bash
IFS=$'\n'
echo "STARTING TRAVIS BUILD in $(pwd)"
cd $TRAVIS_BUILD_DIR
mvn -q install
if [[ "$?" -ne 0 ]]; then
exit 1
fi
echo "COMPLETED MAIN FRAMEWORK INSTALL"
echo "STARTING SAMPLES BUILD"
for SAMPLE in $(find samples -type d -maxdepth 2 -mindepth 2);
do
echo "BUILDING SAMPLE '$SAMPLE'"
cd $SAMPLE
mvn -q clean package
if [[ "$?" -ne 0 ]]; then
exit 1
fi
$GRADLE -q wrapper
if [[ "$?" -ne 0 ]]; then
exit 1
fi
./gradlew wrapper --gradle-version 5.0
if [[ "$?" -ne 0 ]]; then
exit 1
fi
./gradlew -q clean build
if [[ "$?" -ne 0 ]]; then
exit 1
fi
SAM_FILE="$TRAVIS_BUILD_DIR/$SAMPLE/sam.yaml"
if [[ -f "$SAM_FILE" ]]; then
TARGET_ZIP=$(cat $SAM_FILE | grep CodeUri | sed -e 's/^.*:\ //g')
if [[ ! -f "./$TARGET_ZIP" ]]; then
echo "COULD NOT FIND TARGET ZIP FILE $TARGET_ZIP for $SAMPLE"
exit 1
fi
else
echo "COULD NOT FIND SAM FILE: '$TRAVIS_BUILD_DIR/$SAMPLE/sam.yaml'"
exit 1
fi
cd $TRAVIS_BUILD_DIR
echo "'$SAMPLE' BUILT SUCCESSFULLY"
done
echo "COMPLETED SAMPLES BUILD"
cd $TRAVIS_BUILD_DIR
rm -rf tmp
echo "STARTING ARCHETYPE BUILD"
for ARCH in $(find . -name "*archetype" -type d);
do
echo "TESTING ARCHETYPE '$ARCH'"
ARCH_NAME=$(basename $ARCH)
TEST_PROJ="TEST-$ARCH_NAME"
mkdir tmp && cd tmp
mvn archetype:generate -DgroupId=my.service -DartifactId=$TEST_PROJ -Dversion=1.0-SNAPSHOT \
-DarchetypeGroupId=com.amazonaws.serverless.archetypes \
-DarchetypeArtifactId=$ARCH_NAME \
-DarchetypeCatalog=local \
-DinteractiveMode=false
if [[ "$?" -ne 0 ]]; then
exit 1
fi
cd ${TEST_PROJ}
mvn -q clean package -Pshaded-jar
if [[ "$?" -ne 0 ]]; then
exit 1
fi
mvn -q clean package
if [[ "$?" -ne 0 ]]; then
exit 1
fi
if [[ -f "$TRAVIS_BUILD_DIR/tmp/$TEST_PROJ/build.gradle" ]]; then
$GRADLE -q wrapper
if [[ "$?" -ne 0 ]]; then
exit 1
fi
./gradlew wrapper --gradle-version 5.0
if [[ "$?" -ne 0 ]]; then
exit 1
fi
./gradlew -q clean build
if [[ "$?" -ne 0 ]]; then
exit 1
fi
else
echo "GRADLE BUILD FILE NOT FOUND"
fi
SAM_FILE="$TRAVIS_BUILD_DIR/tmp/$TEST_PROJ/sam.yaml"
if [[ -f "$SAM_FILE" ]]; then
TARGET_ZIP=$(cat $SAM_FILE | grep CodeUri | sed -e 's/^.*:\ //g')
if [[ ! -f "./$TARGET_ZIP" ]]; then
echo "COULD NOT FIND TARGET ZIP FILE $TARGET_ZIP for $ARCH"
exit 1
fi
else
echo "COULD NOT FIND SAM FILE: '$TRAVIS_BUILD_DIR/$SAMPLE/sam.yaml'"
exit 1
fi
echo "'$ARCH' BUILT SUCCESSFULLY"
cd $TRAVIS_BUILD_DIR
rm -rf tmp
done
echo "COMPLETED ARCHETYPE BUILD"