diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e86539366..24a351696 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -110,9 +110,32 @@ jobs: pythonVersion: '$(pythonVersion)' workerPath: '$(workerPath)' artifactName: '$(pythonVersion)_OSX_X64' +- job: Build_OSX_ARM64 + pool: + vmImage: 'macOS-12' + 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) + steps: + - template: pack/templates/mac_m1_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'] + 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')) pool: name: '1ES-Hosted-AzFunc' diff --git a/pack/scripts/mac_deps.sh b/pack/scripts/mac_deps.sh new file mode 100644 index 000000000..7577a5299 --- /dev/null +++ b/pack/scripts/mac_deps.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +python -m venv .env +source .env/bin/activate +python -m pip install --upgrade pip + +#python -m pip install . + +python -m pip install . \ + --platform manylinux_2_17_aarch64 \ + --platform macosx_10_9_universal2 \ + --only-binary=:all: \ + --target "$BUILD_SOURCESDIRECTORY/deps" \ diff --git a/pack/templates/mac_m1_env_gen.yml b/pack/templates/mac_m1_env_gen.yml new file mode 100644 index 000000000..58c714adc --- /dev/null +++ b/pack/templates/mac_m1_env_gen.yml @@ -0,0 +1,32 @@ +parameters: + pythonVersion: '' + artifactName: '' + workerPath: '' + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: ${{ parameters.pythonVersion }} + addToPath: true +- task: ShellScript@2 + inputs: + disableAutoCwd: true + scriptPath: 'pack/scripts/mac_deps.sh' +- task: CopyFiles@2 + inputs: + contents: | + ${{ parameters.workerPath }} + targetFolder: '$(Build.ArtifactStagingDirectory)' + flattenFolders: true +- task: CopyFiles@2 + inputs: + sourceFolder: '$(Build.SourcesDirectory)/deps' + contents: | + ** + !grpc_tools/**/* + !grpcio_tools*/* + targetFolder: '$(Build.ArtifactStagingDirectory)' +- task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: ${{ parameters.artifactName }}