-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
115 lines (98 loc) · 3.83 KB
/
azure-pipelines.yml
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
trigger:
- master
pool:
vmImage: "windows-2019"
variables:
buildConfiguration: "Release"
system.debug: false
jobs:
- job: "Check_for_changes"
steps:
- checkout: self
submodules: "recursive"
- bash: |
PATH_FILTER="core/"
CHANGED_FILES=$(git diff HEAD HEAD~ --name-only)
MATCH_COUNT=0
echo "Checking for file changes..."
for FILE in $CHANGED_FILES
do
if [[ $FILE == *$PATH_FILTER* ]]; then
echo "MATCH: ${FILE} changed"
MATCH_COUNT=$(($MATCH_COUNT+1))
else
echo "IGNORE: ${FILE} changed"
fi
done
echo "$MATCH_COUNT match(es) for filter '$PATH_FILTER' found."
if [[ $MATCH_COUNT -gt 0 ]]; then
echo "##vso[task.setvariable variable=SOURCE_CODE_CHANGED;isOutput=true]true"
else
echo "##vso[task.setvariable variable=SOURCE_CODE_CHANGED;isOutput=true]false"
fi
name: check_changes
displayName: "Check changed files"
- job: Publish
dependsOn: "Check_for_changes"
condition: eq(dependencies.Check_for_changes.outputs['check_changes.SOURCE_CODE_CHANGED'], 'true') #map doThing and check the value
steps:
- checkout: self
submodules: true
- task: NuGetToolInstaller@1
inputs:
versionSpec: "5.x"
- task: DotNetCoreCLI@2
displayName: "dotnet restore"
inputs:
command: "restore"
- task: DotNetCoreCLI@2
displayName: "dotnet build"
inputs:
command: "build"
publishWebProjects: false # mutually exclusive with 'projects'
projects: "./sample/sample.csproj"
arguments: --configuration $(buildConfiguration)
# - task: DotNetCoreCLI@2
# inputs:
# command: test
# projects: ./test/test.csproj
# arguments: -c $(buildConfiguration) --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true
# displayName: dotnet test
# - task: DotNetCoreCLI@2
# inputs:
# command: custom
# custom: tool
# arguments: install --tool-path . dotnet-reportgenerator-globaltool
# displayName: dotnet tool install dotnet-reportgenerator
# - script: reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"Cobertura"
# displayName: generate reports
# - task: PublishCodeCoverageResults@1
# displayName: 'publish code coverage'
# inputs:
# codeCoverageTool: Cobertura
# summaryFileLocation: $(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml
- task: DotNetCoreCLI@2
displayName: "dotnet pack"
inputs:
command: "pack"
arguments: "-p:SymbolPackageFormat=snupkg"
packagesToPack: "core/glow.core.csproj"
versioningScheme: "off"
- script: "ls $(Build.ArtifactStagingDirectory)/*.nupkg"
- script: 'dotnet nuget push $(Build.ArtifactStagingDirectory)\*.nupkg --api-key $(nuget_key) --source https://api.nuget.org/v3/index.json'
# - task: DotNetCoreCLI@2
# displayName: 'dotnet nuget push'
# inputs:
# command: 'custom'
# custom: 'nuget push --api-key $(nuget_key)'
# packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
# nuGetFeedType: 'external'
# publishFeedCredentials: 'nuget.org'
# - task: NuGetCommand@2
# displayName: 'NuGet push'
# inputs:
# command: push
# nuGetFeedType: external
# publishFeedCredentials: nuget.org
# packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
# condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/master'))