From 1e798b02f11f5d40bc2326f87c6023d7d772b44b Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 18 May 2019 18:47:34 +0800 Subject: [PATCH] =?UTF-8?q?doc(Appveyor):=20=E7=A7=BB=E5=8A=A8=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=88=B0ps1=E8=84=9A=E6=9C=AC=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appveyor.ps1 | 41 ++++++++++++++++++++++++++++++ appveyor.yml | 72 +--------------------------------------------------- 2 files changed, 42 insertions(+), 71 deletions(-) create mode 100644 appveyor.ps1 diff --git a/appveyor.ps1 b/appveyor.ps1 new file mode 100644 index 00000000..6dfadff3 --- /dev/null +++ b/appveyor.ps1 @@ -0,0 +1,41 @@ +if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master") +{ + echo "" "Install coveralls.net tools" + + dotnet tool install coveralls.net --version 1.0.0 --tool-path "./tools" + + # init sqlserver database + $startPath = "$($env:appveyor_build_folder)\DatabaseScripts" + $sqlInstance = "(local)\SQL2014" + $outFile = "$($env:appveyor_build_folder)\DatabaseScripts\output.log" + $sqlFile = join-path $startPath "Install.sql" + $initFile = join-path $startPath "InitData.sql" + + sqlcmd -S "$sqlInstance" -U sa -P Password12! -i "$sqlFile" -i "$initFile" -o "$outFile" + + # init mysql database + $env:MYSQL_PWD="Password12!" + $cmd = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -e "create database BootstrapAdmin;" -uroot' + cmd.exe /c $cmd + + $sqlFile = join-path $startPath "MySQL\Install.sql" + $cmd = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -hlocalhost -uroot -DBootstrapAdmin <' + cmd.exe /c $cmd $sqlFile + + $initFile = join-path $startPath "MySQL\InitData.sql" + $cmd = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -hlocalhost -uroot -DBootstrapAdmin <' + cmd.exe /c $cmd $initFile + + # init mongodb data + $initFolder = join-path $startPath "MongoDB" + cd $initFolder + $cmd = "C:\mongodb\bin\mongo $initFolder\init.js" + iex "& $cmd" + + $cmd = 'C:\mongodb\bin\mongo BootstrapAdmin --eval "printjson(db.getCollectionNames())"' + iex "& $cmd" + + cd $($env:appveyor_build_folder) + dotnet test UnitTest --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[Bootstrap*]*" /p:CoverletOutput=../ + cmd.exe /c ".\tools\csmacnz.Coveralls.exe --opencover -i coverage.opencover.xml --useRelativePaths" +} \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index dc1a81f1..9b80125c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,77 +31,7 @@ build_script: dotnet publish Bootstrap.Admin --configuration Release --no-restore test_script: - ps: >- - if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master") - - { - - echo "" "Install coveralls.net tools" - - dotnet tool install coveralls.net --version 1.0.0 --tool-path "./tools" - - - # init sqlserver database - - $startPath = "$($env:appveyor_build_folder)\DatabaseScripts" - - $sqlInstance = "(local)\SQL2014" - - $outFile = "$($env:appveyor_build_folder)\DatabaseScripts\output.log" - - $sqlFile = join-path $startPath "Install.sql" - - $initFile = join-path $startPath "InitData.sql" - - sqlcmd -S "$sqlInstance" -U sa -P Password12! -i "$sqlFile" -i "$initFile" -o "$outFile" - - - # init mysql database - - $env:MYSQL_PWD="Password12!" - - $cmd = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -e "create database BootstrapAdmin;" -uroot' - - cmd.exe /c $cmd - - - $sqlFile = join-path $startPath "MySQL\Install.sql" - - $cmd = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -hlocalhost -uroot -DBootstrapAdmin <' - - cmd.exe /c $cmd $sqlFile - - - $initFile = join-path $startPath "MySQL\InitData.sql" - - $cmd = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" -hlocalhost -uroot -DBootstrapAdmin <' - - cmd.exe /c $cmd $initFile - - - # init mongodb data - - $initFolder = join-path $startPath "MongoDB" - - cd $initFolder - - $cmd = "C:\mongodb\bin\mongo $initFolder\init.js" - - iex "& $cmd" - - - $cmd = 'C:\mongodb\bin\mongo BootstrapAdmin --eval "printjson(db.getCollectionNames())"' - - iex "& $cmd" - - - cd $($env:appveyor_build_folder) - - #dotnet test UnitTest --no-restore --filter "FullyQualifiedName~MongoDB" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutputDirectory=../ - - dotnet test UnitTest --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[Bootstrap*]*" /p:CoverletOutput=../ - - cmd.exe /c ".\tools\csmacnz.Coveralls.exe --opencover -i coverage.opencover.xml --useRelativePaths" - } + ./appveyor.ps1 artifacts: - path: Bootstrap.Admin\bin\release\netcoreapp2.2\publish\ name: BootstrapAdmin