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() { function installDB() {
write-host "init sqlserver database..." -ForegroundColor Cyan write-host "init sqlserver database..." -ForegroundColor Cyan
$startPath = "$($env:appveyor_build_folder)\db\SqlServer" $startPath = "$($env:appveyor_build_folder)\db\SqlServer"
$sqlInstance = "(local)\SQL2014" $sqlInstance = "(local)\SQL2017"
$outFile = join-path $startPath "output.log" $outFile = join-path $startPath "output.log"
$sqlFile = join-path $startPath "Install.sql" $sqlFile = join-path $startPath "Install.sql"
$initFile = join-path $startPath "InitData.sql" $initFile = join-path $startPath "InitData.sql"
sqlcmd -S "$sqlInstance" -U sa -P Password12! -i "$sqlFile" -i "$initFile" -o "$outFile" sqlcmd -S "$sqlInstance" -U sa -P Password12! -i "$sqlFile" -i "$initFile" -o "$outFile"
write-host "init mysql database..." -ForegroundColor Cyan #write-host "init mysql database..." -ForegroundColor Cyan
$env:MYSQL_PWD="Password12!" #$env:MYSQL_PWD="Password12!"
$mysql = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe"' #$mysql = '"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe"'
$cmd = $mysql + ' -e "create database BootstrapAdmin;" -uroot' #$cmd = $mysql + ' -e "create database BootstrapAdmin;" -uroot'
cmd.exe /c $cmd #cmd.exe /c $cmd
$startPath = "$($env:appveyor_build_folder)\db\MySQL" #$startPath = "$($env:appveyor_build_folder)\db\MySQL"
$para = ' -hlocalhost -uroot -DBootstrapAdmin < ' #$para = ' -hlocalhost -uroot -DBootstrapAdmin < '
$sqlFile = join-path $startPath "Install.sql" #$sqlFile = join-path $startPath "Install.sql"
$cmd = $mysql + $para + $sqlFile #$cmd = $mysql + $para + $sqlFile
cmd.exe /c $cmd #cmd.exe /c $cmd
$initFile = join-path $startPath "InitData.sql" #$initFile = join-path $startPath "InitData.sql"
$cmd = $mysql + $para + $initFile #$cmd = $mysql + $para + $initFile
cmd.exe /c $cmd #cmd.exe /c $cmd
write-host "init mongodb data..." -ForegroundColor Cyan write-host "init mongodb data..." -ForegroundColor Cyan
$initFolder = "$($env:appveyor_build_folder)\db\MongoDB" $initFolder = "$($env:appveyor_build_folder)\db\MongoDB"
@ -38,7 +38,7 @@
function runUnitTest() { function runUnitTest() {
write-host "dotnet test test\UnitTest" -ForegroundColor Cyan 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() { function coverallUnitTest() {
@ -67,6 +67,9 @@ function codecovUnitTest() {
cmd.exe /c "$codecovCmd -f ""coverage.opencover.xml""" cmd.exe /c "$codecovCmd -f ""coverage.opencover.xml"""
} }
installDB $branch = $($env:APPVEYOR_REPO_BRANCH)
coverallUnitTest if ($branch -ne "dev") {
codecovUnitTest installDB
coverallUnitTest
codecovUnitTest
}

View File

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