azure-functions-python-worker/azure-pipelines.yml

218 строки
7.3 KiB
YAML

name: $(Date:yyyyMMdd).$(Rev:r)
trigger:
- release/3.*
- release/4.*
- dev
variables:
patchBuildNumberForDev: $(Build.BuildNumber)
PROD_V4_WORKER_PY: 'python/prodV4/worker.py'
jobs:
- job: Build_WINDOWS_X64
pool:
name: '1ES-Hosted-AzFunc' #MMS2019TLS for Windows2019 or MMSUbuntu20.04TLS for ubuntu
demands:
- ImageOverride -equals MMS2019TLS
strategy:
matrix:
Python37V4:
pythonVersion: '3.7'
workerPath: $(PROD_V4_WORKER_PY)
Python38V4:
pythonVersion: '3.8'
workerPath: $(PROD_V4_WORKER_PY)
Python39V4:
pythonVersion: '3.9'
workerPath: $(PROD_V4_WORKER_PY)
Python310V4:
pythonVersion: '3.10'
workerPath: $(PROD_V4_WORKER_PY)
Python311V4:
pythonVersion: '3.11'
workerPath: $(PROD_V4_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
pool:
name: '1ES-Hosted-AzFunc' #MMS2019TLS for Windows2019 or MMSUbuntu20.04TLS for ubuntu
demands:
- ImageOverride -equals MMS2019TLS
strategy:
matrix:
Python37V4:
pythonVersion: '3.7'
workerPath: $(PROD_V4_WORKER_PY)
Python38V4:
pythonVersion: '3.8'
workerPath: $(PROD_V4_WORKER_PY)
Python39V4:
pythonVersion: '3.9'
workerPath: $(PROD_V4_WORKER_PY)
Python310V4:
pythonVersion: '3.10'
workerPath: $(PROD_V4_WORKER_PY)
Python311V4:
pythonVersion: '3.11'
workerPath: $(PROD_V4_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
pool:
name: '1ES-Hosted-AzFunc' # MMS2019TLS for Windows2019 or MMSUbuntu20.04TLS for ubuntu
demands:
- ImageOverride -equals MMSUbuntu20.04TLS
strategy:
matrix:
Python37V4:
pythonVersion: '3.7'
workerPath: $(PROD_V4_WORKER_PY)
Python38V4:
pythonVersion: '3.8'
workerPath: $(PROD_V4_WORKER_PY)
Python39V4:
pythonVersion: '3.9'
workerPath: $(PROD_V4_WORKER_PY)
Python310V4:
pythonVersion: '3.10'
workerPath: $(PROD_V4_WORKER_PY)
Python311V4:
pythonVersion: '3.11'
workerPath: $(PROD_V4_WORKER_PY)
steps:
- template: pack/templates/nix_env_gen.yml
parameters:
pythonVersion: '$(pythonVersion)'
workerPath: '$(workerPath)'
artifactName: '$(pythonVersion)_LINUX_X64'
- job: Build_OSX_X64
pool:
vmImage: 'macOS-latest'
strategy:
matrix:
Python37V4:
pythonVersion: '3.7'
workerPath: $(PROD_V4_WORKER_PY)
Python38V4:
pythonVersion: '3.8'
workerPath: $(PROD_V4_WORKER_PY)
Python39V4:
pythonVersion: '3.9'
workerPath: $(PROD_V4_WORKER_PY)
Python310V4:
pythonVersion: '3.10'
workerPath: $(PROD_V4_WORKER_PY)
Python311V4:
pythonVersion: '3.11'
workerPath: $(PROD_V4_WORKER_PY)
steps:
- template: pack/templates/nix_env_gen.yml
parameters:
pythonVersion: '$(pythonVersion)'
workerPath: '$(workerPath)'
artifactName: '$(pythonVersion)_OSX_X64'
- job: Build_OSX_ARM64
pool:
vmImage: 'macOS-latest'
strategy:
matrix:
Python39V4:
pythonVersion: '3.9'
workerPath: $(PROD_V4_WORKER_PY)
Python310V4:
pythonVersion: '3.10'
workerPath: $(PROD_V4_WORKER_PY)
Python311V4:
pythonVersion: '3.11'
workerPath: $(PROD_V4_WORKER_PY)
steps:
- template: pack/templates/macos_64_env_gen.yml
parameters:
pythonVersion: '$(pythonVersion)'
workerPath: '$(workerPath)'
artifactName: '$(pythonVersion)_OSX_ARM64'
- job: PackageWorkers
dependsOn: ['Build_WINDOWS_X64', 'Build_WINDOWS_X86', 'Build_LINUX_X64', 'Build_OSX_X64', 'Build_OSX_ARM64']
condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['GeneratePackage'], True))
pool:
name: '1ES-Hosted-AzFunc'
demands:
- ImageOverride -equals MMS2019TLS
steps:
- bash: |
echo "Releasing from $BUILD_SOURCEBRANCHNAME"
sudo apt-get install -y jq
if [[ $BUILD_SOURCEBRANCHNAME = 4\.* ]]
then
echo "Generating V4 Release Package for $BUILD_SOURCEBRANCHNAME"
NUSPEC="pack\Microsoft.Azure.Functions.V4.PythonWorker.nuspec"
WKVERSION="$BUILD_SOURCEBRANCHNAME"
elif [[ $BUILD_SOURCEBRANCHNAME = dev ]]
then
echo "Generating V4 Integration Test Package for $BUILD_SOURCEBRANCHNAME"
VERSION=$(cat azure_functions_worker/version.py | tail -1 | cut -d' ' -f3 | sed "s/'//g")
NUSPEC="pack\Microsoft.Azure.Functions.V4.PythonWorker.nuspec"
WKVERSION="$VERSION-$(patchBuildNumberForDev)"
else
# this is only to test nuget related workflow because we are setting nuspec here
echo "Generating Integration Test Package for $BUILD_SOURCEBRANCHNAME for testing purpose"
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.V4.PythonWorker.nuspec"
# Only required for Integration Test. Version number contains date (e.g. 3.1.2.20211028-dev)
WKVERSION="3.$LATEST_TAG-$(BUILD_BUILDID)-TEST"
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.SourcesDirectory)'
Verbosity: 'Verbose'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)'
Contents: '**'
TargetFolder: '$(Build.SourcesDirectory)'
- task: NuGetCommand@2
inputs:
command: pack
packagesToPack: '$(nuspec_path)'
packDestination: $(Build.ArtifactStagingDirectory)
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'