diff --git a/appveyor.build.ps1 b/appveyor.build.ps1 index 50ce0c88..8aa7b505 100644 --- a/appveyor.build.ps1 +++ b/appveyor.build.ps1 @@ -1,4 +1,15 @@ -dotnet build -dotnet publish Bootstrap.Admin --configuration Release --no-restore -xcopy "$($env:appveyor_build_folder)\Scripts\Longbow.lic" "$($env:appveyor_build_folder)\Bootstrap.Admin\bin\Release\netcoreapp2.2\publish" /y -xcopy "$($env:appveyor_build_folder)\Bootstrap.Admin\BootstrapAdmin.db" "$($env:appveyor_build_folder)\Bootstrap.Admin\bin\Release\netcoreapp2.2\publish" /y \ No newline at end of file +function runCmd ($cmd) { + write-host $cmd -ForegroundColor Cyan + cmd.exe /c $cmd +} +runCmd "dotnet build" +runCmd "dotnet publish Bootstrap.Admin --configuration Release --no-restore" + +$publishFolder = "$($env:appveyor_build_folder)\Bootstrap.Admin\bin\Release\netcoreapp2.2\publish" +$licFile = "$($env:appveyor_build_folder)\Scripts\Longbow.lic" +write-host "copy file $licFile" -ForegroundColor Cyan +xcopy $licFile $publishFolder /y + +$dbFile = "$($env:appveyor_build_folder)\Bootstrap.Admin\BootstrapAdmin.db" +write-host "copy file $dbFile" -ForegroundColor Cyan +xcopy $dbFile $publishFolder /y \ No newline at end of file diff --git a/appveyor.test.ps1 b/appveyor.test.ps1 index 1650aea5..425b122c 100644 --- a/appveyor.test.ps1 +++ b/appveyor.test.ps1 @@ -1,6 +1,5 @@ -if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master") -{ - # init sqlserver database +if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master") { + write-host "init sqlserver database..." -ForegroundColor Cyan $startPath = "$($env:appveyor_build_folder)\DatabaseScripts\SqlServer" $sqlInstance = "(local)\SQL2014" $outFile = join-path $startPath "output.log" @@ -9,7 +8,7 @@ if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master") sqlcmd -S "$sqlInstance" -U sa -P Password12! -i "$sqlFile" -i "$initFile" -o "$outFile" - # init mysql database + write-host "init mysql database..." -ForegroundColor Cyan $env:MYSQL_PWD="Password12!" $mysql = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe"' $cmd = $mysql + ' -e "create database BootstrapAdmin;" -uroot' @@ -25,7 +24,7 @@ if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master") $cmd = $mysql + $para + $initFile cmd.exe /c $cmd - # init mongodb data + write-host "init mongodb data..." -ForegroundColor Cyan $initFolder = "$($env:appveyor_build_folder)\DatabaseScripts\MongoDB" cd $initFolder @@ -37,13 +36,19 @@ if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master") cd $($env:appveyor_build_folder) if ("$($env:APPVEYOR_REPO_PROVIDER)" -eq "gitHub") { - echo "" "Install coveralls.net tools" + write-host "install coveralls.net tools" -ForegroundColor Cyan dotnet tool install coveralls.net --version 1.0.0 --tool-path "./tools" + write-host "dotnet test UnitTest with Coveralls" -ForegroundColor Cyan dotnet test UnitTest --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[Bootstrap*]*" /p:ExcludeByFile="../Bootstrap.Admin/Program.cs%2c../Bootstrap.Admin/Startup.cs%2c../Bootstrap.Admin/HttpHeaderOperation.cs" /p:CoverletOutput=../ cmd.exe /c ".\tools\csmacnz.Coveralls.exe --opencover -i coverage.opencover.xml --useRelativePaths" } else { + write-warning "Coveralls has been skipped because current provider is ""$($env:APPVEYOR_REPO_PROVIDER)""" + write-host "dotnet test UnitTest without Coveralls" -ForegroundColor Cyan dotnet test UnitTest --no-restore } +} +else { + write-warning "UnitTest has been skipped because current branch is ""$($env:APPVEYOR_REPO_BRANCH)""" } \ No newline at end of file