Skip to content

Commit 89c75d0

Browse files
committed
Allow template test builds to fail the workflow
1 parent cc71629 commit 89c75d0

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

testtemplates.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ nuget pack cloudscribe.templates.nuspec -OutputDirectory "nupkgs"
1616

1717
#Uninstall any existing local version of the template
1818
dotnet new uninstall cloudscribe.templates
19+
[ $? -ne 0 ] && echo "dotnet new uninstall failed" && exit 1
20+
1921
#Install the new version of the template we've just compiled
2022
dotnet new install ./nupkgs/*.nupkg
23+
[ $? -ne 0 ] && echo "dotnet new install failed" && exit 1
2124

2225
# now we need to create a new project from the template and try and build it
2326
# we'll use various options to test the different template options
@@ -31,6 +34,7 @@ dotnet new install ./nupkgs/*.nupkg
3134
DBOPTIONS="NoDb MSSQL MySql SQLite pgsql AllStorage"
3235

3336
S=0
37+
FAILED=""
3438

3539
echo "---------------------------------------------------------------------------------------------"
3640

@@ -58,12 +62,12 @@ for DB in $DBOPTIONS; do
5862
if [ -d "$SCRIPT_DIR/$TESTPROJECTDIR" ]; then
5963
cd $SCRIPT_DIR/$TESTPROJECTDIR
6064
dotnet new cloudscribe -Da $DB $MODULEOPTIONS
61-
[ $? -ne 0 ] && echo "dotnet new failed" && break
65+
[ $? -ne 0 ] && echo "dotnet new failed" && FAILED="$FAILED $DB" && break
6266
dotnet restore --force --no-cache --force-evaluate
63-
[ $? -ne 0 ] && echo "dotnet restore failed" && break
67+
[ $? -ne 0 ] && echo "dotnet restore failed" && FAILED="$FAILED $DB" && break
6468
dotnet list package
6569
dotnet build
66-
[ $? -ne 0 ] && echo "dotnet build failed" && break
70+
[ $? -ne 0 ] && echo "dotnet build failed" && FAILED="$FAILED $DB" && break
6771
cd $SCRIPT_DIR
6872
S=$((S+1))
6973
fi
@@ -73,6 +77,14 @@ for DB in $DBOPTIONS; do
7377
done
7478
rm -Rf $SCRIPT_DIR/$TESTPROJECTDIR 2>/dev/null
7579

80+
if [ $S -ne 6 ]; then
81+
echo "------------------------------------------------------"
82+
echo "Failed to build all 6 projects, only built $S"
83+
echo "Failed DB options: $FAILED"
84+
echo "------------------------------------------------------"
85+
exit 1
86+
fi
87+
7688
echo "------------------------------------------------------"
7789
echo "Successfully built $S/6 projects with various options!"
7890
echo "------------------------------------------------------"

0 commit comments

Comments
 (0)