forked from Azure/azure-functions-python-worker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
228 lines (221 loc) · 6.99 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: $(Date:yyyyMMdd).$(Rev:r)
trigger:
- release/2.*
- release/3.*
- dev
variables:
DOTNET_VERSION: '3.1.405'
DOTNET_VERSION_5: '5.0.x'
patchBuildNumberForDev: $(Build.BuildNumber)
jobs:
- job: Tests
pool:
vmImage: 'ubuntu-18.04'
strategy:
matrix:
Python36:
pythonVersion: '3.6'
Python37:
pythonVersion: '3.7'
Python38:
pythonVersion: '3.8'
Python39:
pythonVersion: '3.9'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pythonVersion)'
addToPath: true
- task: UseDotNet@2
displayName: 'Install dotnet'
inputs:
packageType: 'sdk'
version: $(DOTNET_VERSION)
- task: UseDotNet@2
displayName: 'Install DotNet 5.x'
inputs:
packageType: 'sdk'
version: $(DOTNET_VERSION_5)
- task: ShellScript@2
inputs:
disableAutoCwd: true
scriptPath: .ci/linux_devops_build.sh
displayName: 'Build'
- job: Build_WINDOWS_X64
dependsOn: 'Tests'
pool:
vmImage: 'windows-2019'
strategy:
matrix:
Python36V2:
pythonVersion: '3.6'
workerPath: 'python/prodV2/worker.py'
Python37V2:
pythonVersion: '3.7'
workerPath: 'python/prodV2/worker.py'
Python36V3:
pythonVersion: '3.6'
workerPath: 'python/prodV3/worker.py'
Python37V3:
pythonVersion: '3.7'
workerPath: 'python/prodV3/worker.py'
Python38V3:
pythonVersion: '3.8'
workerPath: 'python/prodV3/worker.py'
Python39V3:
pythonVersion: '3.9'
workerPath: 'python/prodV3/worker.py'
steps:
- template: pack/templates/win_env_gen.yml
parameters:
pythonVersion: '$(pythonVersion)'
workerPath: '$(workerPath)'
architecture: 'x64'
artifactName: '$(pythonVersion)_WINDOWS_X64'
- job: Build_WINDOWS_X86
dependsOn: 'Tests'
pool:
vmImage: 'windows-2019'
strategy:
matrix:
Python37V2:
pythonVersion: '3.7'
workerPath: 'python/prodV2/worker.py'
Python37V3:
pythonVersion: '3.7'
workerPath: 'python/prodV3/worker.py'
Python38V3:
pythonVersion: '3.8'
workerPath: 'python/prodV3/worker.py'
Python39V3:
pythonVersion: '3.9'
workerPath: 'python/prodV3/worker.py'
steps:
- template: pack/templates/win_env_gen.yml
parameters:
pythonVersion: '$(pythonVersion)'
workerPath: '$(workerPath)'
architecture: 'x86'
artifactName: '$(pythonVersion)_WINDOWS_x86'
- job: Build_LINUX_X64
dependsOn: 'Tests'
pool:
vmImage: 'ubuntu-18.04'
strategy:
matrix:
Python36V2:
pythonVersion: '3.6'
workerPath: 'python/prodV2/worker.py'
Python37V2:
pythonVersion: '3.7'
workerPath: 'python/prodV2/worker.py'
Python36V3:
pythonVersion: '3.6'
workerPath: 'python/prodV3/worker.py'
Python37V3:
pythonVersion: '3.7'
workerPath: 'python/prodV3/worker.py'
Python38V3:
pythonVersion: '3.8'
workerPath: 'python/prodV3/worker.py'
Python39V3:
pythonVersion: '3.9'
workerPath: 'python/prodV3/worker.py'
steps:
- template: pack/templates/nix_env_gen.yml
parameters:
pythonVersion: '$(pythonVersion)'
workerPath: '$(workerPath)'
artifactName: '$(pythonVersion)_LINUX_X64'
- job: Build_OSX_X64
dependsOn: 'Tests'
pool:
vmImage: 'macOS-10.15'
strategy:
matrix:
Python36V2:
pythonVersion: '3.6'
workerPath: 'python/prodV2/worker.py'
Python37V2:
pythonVersion: '3.7'
workerPath: 'python/prodV2/worker.py'
Python36V3:
pythonVersion: '3.6'
workerPath: 'python/prodV3/worker.py'
Python37V3:
pythonVersion: '3.7'
workerPath: 'python/prodV3/worker.py'
Python38V3:
pythonVersion: '3.8'
workerPath: 'python/prodV3/worker.py'
Python39V3:
pythonVersion: '3.9'
workerPath: 'python/prodV3/worker.py'
steps:
- template: pack/templates/nix_env_gen.yml
parameters:
pythonVersion: '$(pythonVersion)'
workerPath: '$(workerPath)'
artifactName: '$(pythonVersion)_OSX_X64'
- job: PackageWorkers
dependsOn: ['Build_WINDOWS_X64', 'Build_WINDOWS_X86', 'Build_LINUX_X64', 'Build_OSX_X64']
condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
pool:
vmImage: 'vs2017-win2016'
steps:
- bash: |
echo "Releasing from $BUILD_SOURCEBRANCHNAME"
apt install jq
if [[ $BUILD_SOURCEBRANCHNAME = 2\.* ]]
then
echo "Generating V2 Release Package for $BUILD_SOURCEBRANCHNAME"
NUSPEC="pack\Microsoft.Azure.Functions.V2.PythonWorker.nuspec"
WKVERSION="$BUILD_SOURCEBRANCHNAME"
elif [[ $BUILD_SOURCEBRANCHNAME = 3\.* ]]
then
echo "Generating V3 Release Package for $BUILD_SOURCEBRANCHNAME"
NUSPEC="pack\Microsoft.Azure.Functions.V3.PythonWorker.nuspec"
WKVERSION="$BUILD_SOURCEBRANCHNAME"
elif [[ $BUILD_SOURCEBRANCHNAME = dev ]]
then
echo "Generating V3 Integration Test Package for $BUILD_SOURCEBRANCHNAME"
LATEST_TAG=$(curl https://api.github.com/repos/Azure/azure-functions-python-worker/tags -s | jq '.[0].name' | sed 's/\"//g' | cut -d'.' -f-2)
NUSPEC="pack\Microsoft.Azure.Functions.V3.PythonWorker.nuspec"
# Only required for Integration Test. Version number contains date (e.g. 3.1.2.20211028-dev)
WKVERSION="3.$LATEST_TAG-$(patchBuildNumberForDev)"
else
echo "No Matching Release Tag For $BUILD_SOURCEBRANCH"
fi
echo "##vso[task.setvariable variable=nuspec_path]$NUSPEC"
echo "##vso[task.setvariable variable=worker_version]$WKVERSION"
displayName: "Generate Worker NuGet Package for Release $BUILD_SOURCEBRANCHNAME"
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(Build.SourcesDirectory)'
- task: ManifestGeneratorTask@0
displayName: 'SBOM Generation Task'
inputs:
BuildDropPath: '$(Build.ArtifactStagingDirectory)'
BuildComponentPath: '$(Build.ArtifactStagingDirectory)'
Verbosity: 'Verbose'
- task: NuGetCommand@2
inputs:
command: pack
packagesToPack: '$(nuspec_path)'
versioningScheme: 'byEnvVar'
versionEnvVar: WORKER_VERSION
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'PythonWorker'
- task: NuGetCommand@2
condition: eq(variables['UPLOADPACKAGETOPRERELEASEFEED'], true)
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df'
allowPackageConflicts: true
displayName: '[Integration Test] Push NuGet package to the AzureFunctionsPreRelease feed'