forked from DigitalRuby/ExchangeSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
182 lines (178 loc) · 5.78 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
trigger:
batch: false
branches:
include:
- main
paths:
exclude:
- .github/**
- .nuget/**
- docs/**
- examples/**
tags:
include:
- '*'
pr:
autoCancel: true
branches:
include:
- main
paths:
exclude:
- .github/**
- .nuget/**
- docs/**
- examples/**
schedules:
- cron: "0 0 1 * *"
displayName: Monthly release
branches:
include:
- main
variables:
BuildConfiguration: 'Release'
DOTNET_CLI_TELEMETRY_OPTOUT: 1
PipelineDate: $[format('{0:yyyyMMddHHmmss}', pipeline.startTime)]
jobs:
- job: build_ci
displayName: CI Build
timeoutInMinutes: 2
continueOnError: false
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
displayName: 'Install current .NET Core SDK'
inputs:
packageType: sdk
version: 6.x
- task: DotNetCoreCLI@2
displayName: 'Restore'
inputs:
command: 'restore'
projects: 'src/ExchangeSharp/ExchangeSharp.csproj'
- task: DotNetCoreCLI@2
displayName: 'Build lib+console'
inputs:
command: 'build'
projects: 'src/ExchangeSharp/ExchangeSharp.csproj'
arguments: '--configuration $(BuildConfiguration) --version-suffix prerelease-$(PipelineDate) --output $(Build.ArtifactStagingDirectory)'
#- task: DotNetCoreCLI@2
# displayName: 'Tests'
# inputs:
# command: 'test'
# configuration: $(BuildConfiguration)
# projects: 'tests/*/*.csproj'
# publishTestResults: true
# testRunTitle: 'All tests'
#- task: DotNetCoreCLI@2
# displayName: 'NuGet Pack'
# inputs:
# command: pack
# packagesToPack: 'src/ExchangeSharp/ExchangeSharp.csproj'
# packDestination: '$(Build.ArtifactStagingDirectory)'
# versioningScheme: off
- task: NuGetToolInstaller@1
- task: NuGetAuthenticate@0
displayName: 'NuGet Authenticate'
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
publishVstsFeed: DigitalRuby/DigitalRuby
- job: build_tag
displayName: Build console app
timeoutInMinutes: 5
dependsOn: build_ci
condition: or(eq(variables['Build.Reason'], 'Schedule'), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
continueOnError: false
strategy:
matrix:
macos:
imageName: macOS-latest
rid: osx-x64
linux:
imageName: ubuntu-18.04
rid: linux-x64
windows:
imageName: windows-2019
rid: win-x64
pool:
vmImage: $(imageName)
steps:
- task: UseDotNet@2
displayName: 'Install current .NET Core'
condition: eq(variables['Agent.OS'], 'Darwin')
inputs:
packageType: sdk
version: 6.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: DotNetCoreCLI@2
displayName: "Publish console executable"
timeoutInMinutes: 5
inputs:
command: 'publish' # Options: build, push, pack, publish, restore, run, test, custom
configuration: $(BuildConfiguration)
arguments: |
--force -r $(rid) -f netcoreapp30 -o "$(Build.ArtifactStagingDirectory)/$(rid)" /NoLogo /p:PublishTrimmed=True /p:PublishReadyToRun=True /p:PublishSingleFile=True /p:PublishReadyToRunShowWarnings=True /p:ShowLinkerSizeComparison=True /p:LinkerTrimNativeDeps=True
zipAfterPublish: true
restoreDirectory:
verbosityRestore: 'Detailed'
#versioningScheme: 'off' # Options: off, byPrereleaseNumber, byEnvVar, byBuildNumber
#versionEnvVar: # Required when versioningScheme == ByEnvVar
publishWebProjects: false
workingDirectory: ./src/ExchangeSharpConsole/
- bash: |
set -x
rm -rfv $(Build.ArtifactStagingDirectory)/$(rid)/*.pdb
displayName: Remove pdb from artifacts
- task: PublishBuildArtifacts@1
displayName: "Save artifacts"
inputs:
artifactName: build-$(rid)
- job: publish_tag
displayName: Publish artifacts to GH
timeoutInMinutes: 2
dependsOn: build_tag
continueOnError: false
pool:
vmImage: ubuntu-latest
condition: or(eq(variables['Build.Reason'], 'Schedule'), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
steps:
- bash: echo "##vso[task.setvariable variable=TAG;isOutput=true]$(git describe --tags --exact-match)"
name: setTag
displayName: Set TAG env var
- task: DownloadBuildArtifacts@0
displayName: Download linux-x64 artifact
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'build-linux-x64'
downloadPath: '$(System.ArtifactsDirectory)'
- task: DownloadBuildArtifacts@0
displayName: Download osx-x64 artifact
inputs:
buildType: 'current'
downloadType: 'single'
# This is temporary there's a bug with our tests on Mac
allowPartiallySucceededBuilds: true
artifactName: 'build-osx-x64'
downloadPath: '$(System.ArtifactsDirectory)'
- task: DownloadBuildArtifacts@0
displayName: Download win-x64 artifact
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'build-win-x64'
downloadPath: '$(System.ArtifactsDirectory)'
- task: GitHubRelease@0
displayName: "Attach artifacts to GH Release"
inputs:
gitHubConnection: DigitalRubyToken
target: '$(Build.SourceVersion)'
title: $(setTag.TAG)
tag: $(setTag.TAG)
action: 'edit'
addChangeLog: false
assets: '$(System.ArtifactsDirectory)/**'
assetUploadMode: 'replace'