build: 更新 CI 自动化脚本支持 NETCore 3.0

This commit is contained in:
Argo Zhang 2019-09-28 21:20:47 +08:00
parent a5f3b75dfe
commit 14c2bebc3b
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 25 additions and 25 deletions

View File

@ -1,28 +1,28 @@
function installDB() {
write-host "init sqlserver database..." -ForegroundColor Cyan
$startPath = "$($env:appveyor_build_folder)\db\SqlServer"
$sqlInstance = "(local)\SQL2014"
$sqlInstance = "(local)\SQL2017"
$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"
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'
cmd.exe /c $cmd
#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'
#cmd.exe /c $cmd
$startPath = "$($env:appveyor_build_folder)\db\MySQL"
$para = ' -hlocalhost -uroot -DBootstrapAdmin < '
$sqlFile = join-path $startPath "Install.sql"
$cmd = $mysql + $para + $sqlFile
cmd.exe /c $cmd
#$startPath = "$($env:appveyor_build_folder)\db\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
#$initFile = join-path $startPath "InitData.sql"
#$cmd = $mysql + $para + $initFile
#cmd.exe /c $cmd
write-host "init mongodb data..." -ForegroundColor Cyan
$initFolder = "$($env:appveyor_build_folder)\db\MongoDB"
@ -38,7 +38,7 @@
function runUnitTest() {
write-host "dotnet test test\UnitTest" -ForegroundColor Cyan
dotnet test test\UnitTest /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[Bootstrap*]*" /p:ExcludeByFile="..\..\src\admin\Bootstrap.Admin\Program.cs%2c..\..\src\admin\Bootstrap.Admin\Startup.cs%2c..\..\src\admin\Bootstrap.Admin\HttpHeaderOperation.cs" /p:CoverletOutput=..\..\
dotnet test test\UnitTest --filter FullyQualifiedName!~MySql /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[Bootstrap*]*" /p:ExcludeByFile="..\..\src\admin\Bootstrap.Admin\Program.cs%2c..\..\src\admin\Bootstrap.Admin\Startup.cs%2c..\..\src\admin\Bootstrap.Admin\HttpHeaderOperation.cs" /p:CoverletOutput=..\..\
}
function coverallUnitTest() {
@ -67,6 +67,9 @@ function codecovUnitTest() {
cmd.exe /c "$codecovCmd -f ""coverage.opencover.xml"""
}
installDB
coverallUnitTest
codecovUnitTest
$branch = $($env:APPVEYOR_REPO_BRANCH)
if ($branch -ne "dev") {
installDB
coverallUnitTest
codecovUnitTest
}

View File

@ -1,8 +1,10 @@
version: 1.0.{build}
branches:
only:
- release
- master
image: Visual Studio 2017
- dev
image: Visual Studio 2019
clone_depth: 1
init:
- ps: git version
@ -18,16 +20,11 @@ environment:
secure: +22PuAn5seq4bbCVCly8zDFuyEV3m2NjW3QuM0+2gm4c8akwicNFmv2T/ZGd0Jpd
cache: C:\ProgramData\chocolatey\lib\codecov\tools
services:
- mssql2014
- mysql
- mssql2017
- mongodb
install:
- ps: >-
#copy my.ini into mysql folder
dotnet --version
xcopy "$($env:appveyor_build_folder)\db\MySQL\my.ini" "C:\Program Files\MySQL\MySQL Server 5.7" /y
build_script:
- ps: >-
.\appveyor.build.ps1