doc(Appveyor): refactor scripts

This commit is contained in:
Argo Zhang 2019-05-28 09:43:49 +08:00
parent 204a6f207e
commit ded175bd69
8 changed files with 53 additions and 54 deletions

View File

@ -15,7 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bootstrap.Admin", "Bootstra
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{792A0B12-3F41-4BC4-A768-7D8D91C213B2}"
ProjectSection(SolutionItems) = preProject
appveyor.ps1 = appveyor.ps1
appveyor.build.ps1 = appveyor.build.ps1
appveyor.test.ps1 = appveyor.test.ps1
appveyor.yml = appveyor.yml
README.md = README.md
EndProjectSection

View File

@ -1,10 +0,0 @@
# init mongodb data
$initFolder = "$($env:appveyor_build_folder)\DatabaseScripts\MongoDB"
cd $initFolder
cmd.exe /c "C:\mongodb\bin\mongo init.js"
$cmd = 'C:\mongodb\bin\mongo BootstrapAdmin --eval "printjson(db.getCollectionNames())"'
iex "& $cmd"
cd $($env:appveyor_build_folder)

View File

@ -1,15 +0,0 @@
# init mysql database
$env:MYSQL_PWD="Password12!"
$mysql = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe"'
$cmd = $mysql + ' -e "create database BootstrapAdmin;" -uroot'
cmd.exe /c $cmd
$startPath = "$($env:appveyor_build_folder)\DatabaseScripts\MySQL"
$para = ' -hlocalhost -uroot -DBootstrapAdmin < '
$sqlFile = join-path $startPath "Install.sql"
$cmd = $mysql + $para + $sqlFile
cmd.exe /c $cmd
$initFile = join-path $startPath "InitData.sql"
$cmd = $mysql + $para + $initFile
cmd.exe /c $cmd

View File

@ -1,8 +0,0 @@
# init sqlserver database
$startPath = "$($env:appveyor_build_folder)\DatabaseScripts\SqlServer"
$sqlInstance = "(local)\SQL2014"
$outFile = join-path $startPath "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"

4
appveyor.build.ps1 Normal file
View File

@ -0,0 +1,4 @@
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

View File

@ -1,12 +0,0 @@
if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master")
{
.\DatabaseScripts\SqlServer\appveyor.ps1
.\DatabaseScripts\MySQL\appveyor.ps1
.\DatabaseScripts\MongoDB\appveyor.ps1
echo "" "Install coveralls.net tools"
dotnet tool install coveralls.net --version 1.0.0 --tool-path "./tools"
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"
}

44
appveyor.test.ps1 Normal file
View File

@ -0,0 +1,44 @@
if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master")
{
# init sqlserver database
$startPath = "$($env:appveyor_build_folder)\DatabaseScripts\SqlServer"
$sqlInstance = "(local)\SQL2014"
$outFile = join-path $startPath "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!"
$mysql = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe"'
$cmd = $mysql + ' -e "create database BootstrapAdmin;" -uroot'
cmd.exe /c $cmd
$startPath = "$($env:appveyor_build_folder)\DatabaseScripts\MySQL"
$para = ' -hlocalhost -uroot -DBootstrapAdmin < '
$sqlFile = join-path $startPath "Install.sql"
$cmd = $mysql + $para + $sqlFile
cmd.exe /c $cmd
$initFile = join-path $startPath "InitData.sql"
$cmd = $mysql + $para + $initFile
cmd.exe /c $cmd
# init mongodb data
$initFolder = "$($env:appveyor_build_folder)\DatabaseScripts\MongoDB"
cd $initFolder
cmd.exe /c "C:\mongodb\bin\mongo init.js"
$cmd = 'C:\mongodb\bin\mongo BootstrapAdmin --eval "printjson(db.getCollectionNames())"'
iex "& $cmd"
cd $($env:appveyor_build_folder)
echo "" "Install coveralls.net tools"
dotnet tool install coveralls.net --version 1.0.0 --tool-path "./tools"
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"
}

View File

@ -5,7 +5,6 @@ branches:
- dev
image: Visual Studio 2017
clone_depth: 1
clone_folder: c:\Longbow\BootstrapAdmin
init:
- ps: dotnet --version
environment:
@ -20,17 +19,13 @@ install:
- ps: >-
#copy my.ini into mysql folder
$iniFile = "$($env:appveyor_build_folder)\DatabaseScripts\MySQL\my.ini"
xcopy $iniFile "C:\Program Files\MySQL\MySQL Server 5.7" /y
xcopy "$($env:appveyor_build_folder)\DatabaseScripts\MySQL\my.ini" "C:\Program Files\MySQL\MySQL Server 5.7" /y
build_script:
- ps: >-
dotnet build
dotnet publish Bootstrap.Admin --configuration Release --no-restore
./appveyor.build.ps1
test_script:
- ps: >-
./appveyor.ps1
./appveyor.test.ps1
artifacts:
- path: Bootstrap.Admin\bin\release\netcoreapp2.2\publish\
name: BootstrapAdmin