-
-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
81 lines (69 loc) · 2.46 KB
/
azure-pipelines.yml
File metadata and controls
81 lines (69 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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