build(appveyor): 移除dev分支编译条件

This commit is contained in:
Argo Zhang 2019-06-15 13:20:26 +08:00
parent 2cf6c14266
commit 3e3f555213
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 18 additions and 24 deletions

View File

@ -36,31 +36,20 @@ function installDB() {
cd $($env:appveyor_build_folder) cd $($env:appveyor_build_folder)
} }
function runUnitTest() {
write-host "dotnet test UnitTest" -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=../
}
function coverallUnitTest() { function coverallUnitTest() {
write-host "install coveralls.net tools" -ForegroundColor Cyan write-host "install coveralls.net tools" -ForegroundColor Cyan
dotnet tool install coveralls.net --version 1.0.0 --tool-path "./tools" dotnet tool install coveralls.net --version 1.0.0 --tool-path "./tools"
runUnitTest
write-host "dotnet test UnitTest with Coveralls" -ForegroundColor Cyan write-host "report 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" cmd.exe /c ".\tools\csmacnz.Coveralls.exe --opencover -i coverage.opencover.xml --useRelativePaths"
} }
if ("$($env:APPVEYOR_REPO_BRANCH)" -eq "master") { function codecovUnitTest() {
installDB
if ("$($env:APPVEYOR_REPO_PROVIDER)" -eq "gitHub") {
coverallUnitTest
}
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
}
}
elseif ("$($env:APPVEYOR_REPO_PROVIDER)" -eq "gitLab") {
installDB
coverallUnitTest
Set-AppveyorBuildVariable COVERALLS_REPO_TOKEN $($env:COVERALLS_REPO_TOKEN_GITLAB) Set-AppveyorBuildVariable COVERALLS_REPO_TOKEN $($env:COVERALLS_REPO_TOKEN_GITLAB)
Set-AppveyorBuildVariable CODECOV_TOKEN $($env:CODECOV_TOKEN_GITLAB) Set-AppveyorBuildVariable CODECOV_TOKEN $($env:CODECOV_TOKEN_GITLAB)
@ -70,8 +59,14 @@ elseif ("$($env:APPVEYOR_REPO_PROVIDER)" -eq "gitLab") {
write-host "install codecov tools" -ForegroundColor Cyan write-host "install codecov tools" -ForegroundColor Cyan
choco install codecov choco install codecov
} }
$coverageFile = Test-Path coverage.opencover.xml
if (!$coverageFile) {
runUnitTest
}
write-host "report UnitTest with Codecov" -ForegroundColor Cyan
cmd.exe /c "$codecovCmd -f ""coverage.opencover.xml""" cmd.exe /c "$codecovCmd -f ""coverage.opencover.xml"""
} }
else {
write-warning "UnitTest has been skipped because current branch is ""$($env:APPVEYOR_REPO_BRANCH)""" installDB
} coverallUnitTest
codecovUnitTest

View File

@ -2,7 +2,6 @@
branches: branches:
only: only:
- master - master
- dev
image: Visual Studio 2017 image: Visual Studio 2017
clone_depth: 1 clone_depth: 1
init: init:
@ -58,7 +57,7 @@ notifications:
- provider: Email - provider: Email
to: to:
- argo@163.com - argo@163.com
subject: '{{projectName}} {{branch}} Build {{status}} {{buildVersion}}' subject: '{{projectName}} Build {{status}} {{buildVersion}}'
message: >- message: >-
<div style="font-family:'Segoe UI',Arial,Sans-Serif;font-size:10pt;"> <div style="font-family:'Segoe UI',Arial,Sans-Serif;font-size:10pt;">
{{#passed}} {{#passed}}