Update build.sh
This commit is contained in:
committed by
Petrutiu Mihai
parent
20aa9e6b7e
commit
e75c139e7a
63
build.sh
63
build.sh
@@ -1,46 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $repoFolder
|
||||
|
||||
koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
|
||||
if [ ! -z $KOREBUILD_ZIP ]; then
|
||||
koreBuildZip=$KOREBUILD_ZIP
|
||||
#exit if any command fails
|
||||
set -e
|
||||
|
||||
artifactsFolder="./artifacts"
|
||||
|
||||
if [ -d $artifactsFolder ]; then
|
||||
rm -R $artifactsFolder
|
||||
fi
|
||||
|
||||
buildFolder=".build"
|
||||
buildFile="$buildFolder/KoreBuild.sh"
|
||||
dotnet restore
|
||||
|
||||
if test ! -d $buildFolder; then
|
||||
echo "Downloading KoreBuild from $koreBuildZip"
|
||||
|
||||
tempFolder="/tmp/KoreBuild-$(uuidgen)"
|
||||
mkdir $tempFolder
|
||||
|
||||
localZipFile="$tempFolder/korebuild.zip"
|
||||
|
||||
retries=6
|
||||
until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null)
|
||||
do
|
||||
echo "Failed to download '$koreBuildZip'"
|
||||
if [ "$retries" -le 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
retries=$((retries - 1))
|
||||
echo "Waiting 10 seconds before retrying. Retries left: $retries"
|
||||
sleep 10s
|
||||
done
|
||||
|
||||
unzip -q -d $tempFolder $localZipFile
|
||||
|
||||
mkdir $buildFolder
|
||||
cp -r $tempFolder/**/build/** $buildFolder
|
||||
|
||||
chmod +x $buildFile
|
||||
|
||||
# Cleanup
|
||||
if test ! -d $tempFolder; then
|
||||
rm -rf $tempFolder
|
||||
fi
|
||||
fi
|
||||
# Ideally we would use the 'dotnet test' command to test netcoreapp and net451 so restrict for now
|
||||
# but this currently doesn't work due to https://github.com/dotnet/cli/issues/3073 so restrict to netcoreapp
|
||||
|
||||
$buildFile -r $repoFolder "$@"
|
||||
dotnet test ./test/TEST_PROJECT_NAME -c Release -f netcoreapp1.0
|
||||
|
||||
# Instead, run directly with mono for the full .net version
|
||||
dotnet build ./test/TEST_PROJECT_NAME -c Release -f net451
|
||||
|
||||
mono \
|
||||
./test/TEST_PROJECT_NAME/bin/Release/net451/*/dotnet-test-xunit.exe \
|
||||
./test/TEST_PROJECT_NAME/bin/Release/net451/*/TEST_PROJECT_NAME.dll
|
||||
|
||||
revision=${TRAVIS_JOB_ID:=1}
|
||||
revision=$(printf "%04d" $revision)
|
||||
|
||||
dotnet pack ./src/PROJECT_NAME -c Release -o ./artifacts --version-suffix=$revision
|
||||
|
||||
Reference in New Issue
Block a user