You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.5 KiB
81 lines
2.5 KiB
# ASP.NET Core (.NET Framework)
|
|
# Build and test ASP.NET Core projects targeting the full .NET Framework.
|
|
# Add steps that publish symbols, save build artifacts, and more:
|
|
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
|
|
# 代码覆盖率参考:https://docs.microsoft.com/zh-cn/azure/devops/pipelines/ecosystems/dotnet-core?view=azure-devops#collect-code-coverage
|
|
# https://www.meziantou.net/computing-code-coverage-for-a-dotnet-core-project-with-azure-devops-and-coverlet.htm
|
|
# trigger
|
|
# https://docs.microsoft.com/zh-cn/azure/devops/pipelines/build/triggers?view=azure-devops&tabs=yaml
|
|
# ReportGenerator,将Coverlet,OpenCover,dotCover,Visual Studio,NCover,Cobertura,JaCoCo,Clover,gcov或lcov生成的覆盖率报告转换为各种格式的可读报告:
|
|
# https://github.com/danielpalme/ReportGenerator
|
|
# https://danielpalme.github.io/ReportGenerator/usage.html
|
|
|
|
# specific path build
|
|
trigger:
|
|
branches:
|
|
include:
|
|
- master
|
|
- develop
|
|
- release/*
|
|
paths:
|
|
include:
|
|
- src/*
|
|
exclude:
|
|
- src/*.md
|
|
|
|
pr:
|
|
- master
|
|
- develop
|
|
|
|
pool:
|
|
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml
|
|
vmImage: 'windows-latest'
|
|
|
|
variables:
|
|
solution: '**/*.sln'
|
|
buildPlatform: 'Any CPU'
|
|
buildConfiguration: 'Release'
|
|
disable.coverage.autogenerate: 'true'
|
|
|
|
steps:
|
|
- task: UseDotNet@2
|
|
inputs:
|
|
packageType: 'sdk'
|
|
version: '6.x'
|
|
|
|
- task: UseDotNet@2
|
|
inputs:
|
|
packageType: 'sdk'
|
|
version: '7.x'
|
|
|
|
- task: UseDotNet@2
|
|
inputs:
|
|
packageType: 'sdk'
|
|
version: '8.x'
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Package Push'
|
|
condition: eq(variables['Build.SourceBranchName'], 'master')
|
|
env:
|
|
NUGET_API_KEY: ${nugetapikey}
|
|
GITHUB_API_KEY: ${githubapikey}
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
# 打包
|
|
Get-ChildItem -Path ./ -Recurse |
|
|
Where-Object { $_.Name.EndsWith(".csproj") -and !$_.Name.Contains("Test") } |
|
|
ForEach-Object -Process {
|
|
Write-Host $_.Name
|
|
dotnet pack $_.FullName -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg --include-source --output $(Build.ArtifactStagingDirectory) -c $(BuildConfiguration)
|
|
}
|
|
ls $(Build.ArtifactStagingDirectory)
|
|
|
|
#推包
|
|
dotnet nuget push $(Build.ArtifactStagingDirectory)\*.nupkg -k $env:NUGET_API_KEY --skip-duplicate -s https://api.nuget.org/v3/index.json
|
|
failOnStderr: true
|
|
showWarnings: true
|
|
ignoreLASTEXITCODE: true
|
|
|
|
|
|
|
|
|