diff --git a/.azure-pipelines/client.yml b/.azure-pipelines/client.yml index ff5e85a5..abae1da2 100644 --- a/.azure-pipelines/client.yml +++ b/.azure-pipelines/client.yml @@ -9,437 +9,451 @@ variables: PythonVersion312: '3.12.0' GetPip: 'https://bootstrap.pypa.io/get-pip.py' -jobs: - - job: 'sdist' - displayName: 'Source Distribution' - - pool: - vmImage: 'ubuntu-20.04' - - steps: - - template: /.azure-pipelines/use-python-version.yml - parameters: - versionSpec: '$(PythonVersion38)' - - - script: | - echo "Prepending PATH environment variable with directory: $HOME/.local/bin" - echo "##vso[task.prependpath]$HOME/.local/bin" - displayName: 'Prepare PATH' - - - script: | - python --version - curl -sS $(GetPip) | python - --user - python -m pip --version - python -m pip install --user -r dev_requirements.txt - displayName: 'Install dependencies' - - script: python setup.py sdist - displayName: 'Build uAMQP sdist' - - - script: ls ./dist - displayName: 'Check output' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish sdist artifact' - inputs: - artifactName: uamqp-sdist - pathToPublish: 'dist' - - - job: 'MacOS' - - pool: - vmImage: 'macOS-11' - - strategy: - matrix: - Python 3.8: - PythonBin: 'python3' - PythonVersion: '$(PythonVersion38)' - BWFilter: 'cp38-*' - Python 3.9: - PythonBin: 'python3' - PythonVersion: '$(PythonVersion39)' - BWFilter: 'cp39-*' - Python 3.10: - PythonBin: 'python3' - PythonVersion: '$(PythonVersion310)' - BWFilter: 'cp310-*' - Python 3.11: - PythonBin: 'python3' - PythonVersion: '$(PythonVersion311)' - BWFilter: 'cp311-*' - Python 3.12: - PythonBin: 'python3' - PythonVersion: '$(PythonVersion312)' - BWFilter: 'cp312-*' - - variables: - MacOSXDeploymentTarget: '10.9' - OpenSSLDir: $(Agent.BuildDirectory)/openssl-macosx$(MacOSXDeploymentTarget) - PythonVersion38: '3.8.2' - PythonVersion39: '3.9.0' - PythonVersion310: '3.10.0' - PythonVersion311: '3.11.0' - PythonVersion312: '3.12.0' - - steps: - - task: DownloadPipelineArtifact@1 - displayName: 'Download OpenSSL artifact' - inputs: - artifactName: openssl-macosx$(MacOSXDeploymentTarget) - buildType: specific - buildVersionToDownload: latest - downloadPath: $(Agent.BuildDirectory) - pipeline: 119 # azure-uamqp-python - openssl - project: '29ec6040-b234-4e31-b139-33dc4287b756' # public - - - script: sudo ls /Applications/ - displayName: 'List All apps' - - - script: sudo xcode-select --switch /Applications/Xcode_13.1.app - displayName: 'Select Xcode 13.1' - - - script: source ./install_python_osx.sh - displayName: 'Install Official Python' - - - script: | - echo "Prepending PATH environment variable with directory: /usr/local/bin" - echo "##vso[task.prependpath]/usr/local/bin" - export PYTHON_SHORT_VER=`echo $(PythonVersion) | cut -d . -f 1,2` - echo "Prepending PATH environment variable with directory: $HOME/Library/Python/$PYTHON_SHORT_VER/bin" - echo "##vso[task.prependpath]$HOME/Library/Python/$PYTHON_SHORT_VER/bin" - displayName: 'Prepare PATH' - - - script: | - $(PythonBin) --version - curl -sS $(GetPip) | $(PythonBin) - --user - $(PythonBin) -m pip --version - $(PythonBin) -m pip install --user -r dev_requirements.txt - displayName: 'Install dependencies' - - - bash: | - set -o errexit - $(PythonBin) -m pip install --user cibuildwheel==2.16.2 --force - displayName: Install cibuildwheel 2.16.2 - - - pwsh: | - cibuildwheel --output-dir dist . - displayName: 'Build uAMQP Wheel' - env: - CIBW_PRERELEASE_PYTHONS: True - CIBW_ARCHS_MACOS: x86_64 - CIBW_BUILD: $(BWFilter) - - - script: ls ./dist - displayName: 'Check output' - - - script: | - $(PythonBin) -m pip install --user --ignore-installed ./dist/*.whl - $(PythonBin) -m pip install --user pytest==6.2.4 --force - $(PythonBin) -m pip install --user pytest-asyncio==0.12.0 --force - pytest tests --doctest-modules --junitxml=junit/test-results-c.xml - pytest samples --doctest-modules --junitxml=junit/test-results-live.xml - displayName: 'Run tests' - - - task: PublishTestResults@2 - displayName: 'Publish test results' - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/test-results-*.xml' - testResultsFormat: 'JUnit' - testRunTitle: 'MacOS Python $(PythonVersion)' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish wheel artifact' - inputs: - artifactName: uamqp-macosx$(MacOSXDeploymentTarget)-$(PythonVersion)-whl - pathToPublish: 'dist' - - - job: 'Windows' - - pool: - name: azsdk-pool-mms-win-2022-general - vmImage: MMS2022 - variables: - VS_INSTALLER_URL: "https://aka.ms/vs/17/release/vs_enterprise.exe" - VS_INSTALLER_PATH: "$(Build.BinariesDirectory)/vs_enterprise.exe" - VS_ENTERPRISE_PATH: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise" - - strategy: - matrix: - x64 Python 3.8: - PythonArchitecture: 'x64' - PythonVersion: '$(PythonVersion38)' - BWFilter: 'cp38-win_amd64' - x64 Python 3.9: - PythonArchitecture: 'x64' - PythonVersion: '$(PythonVersion39)' - BWFilter: 'cp39-win_amd64' - x64 Python 3.10: - PythonArchitecture: 'x64' - PythonVersion: '$(PythonVersion310)' - BWFilter: 'cp310-win_amd64' - x64 Python 3.11: - PythonArchitecture: 'x64' - PythonVersion: '$(PythonVersion311)' - BWFilter: 'cp311-win_amd64' - x64 Python 3.12: - PythonArchitecture: 'x64' - PythonVersion: '$(PythonVersion312)' - BWFilter: 'cp312-win_amd64' - x86 Python 3.8: - PythonArchitecture: 'x86' - PythonVersion: '$(PythonVersion38)' - BWFilter: 'cp38-win32' - x86 Python 3.9: - PythonArchitecture: 'x86' - PythonVersion: '$(PythonVersion39)' - BWFilter: 'cp39-win32' - x86 Python 3.10: - PythonArchitecture: 'x86' - PythonVersion: '$(PythonVersion310)' - BWFilter: 'cp310-win32' - x86 Python 3.11: - PythonArchitecture: 'x86' - PythonVersion: '$(PythonVersion311)' - BWFilter: 'cp311-win32' - x86 Python 3.12: - PythonArchitecture: 'x86' - PythonVersion: '$(PythonVersion312)' - BWFilter: 'cp312-win32' - - steps: - - template: /.azure-pipelines/use-python-version.yml - parameters: - architecture: '$(PythonArchitecture)' - versionSpec: '$(PythonVersion)' - - - powershell: | - python --version - Invoke-WebRequest -UseBasicParsing -Uri $(GetPip) | Select-Object -ExpandProperty Content | python - python -m pip --version - python -m pip install -r dev_requirements.txt - displayName: 'Install dependencies' - env: - PYTHONWARNINGS: ignore:DEPRECATION - - - pwsh: | - Invoke-WebRequest "$(VS_INSTALLER_URL)" -OutFile "$(VS_INSTALLER_PATH)" - # In order of component appearance in the install command below, these are the names of the components - # as they in the VS Installer UI. (What you would do locally.) - # C# and Visual Basic Roslyn Compilers (components pane) - # C++ 2022 Redistributable Update (components pane) - # C++ CMake tools for Windows (components pane) - # MSBuild (components pane) - # MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) (components pane) - # Native Desktop Workload (workloads pane) - $(VS_INSTALLER_PATH) --installPath $(VS_ENTERPRISE_PATH) ` - --add Microsoft.VisualStudio.Component.Roslyn.Compiler ` - --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest ` - --add Microsoft.VisualStudio.Component.VC.CMake.Project ` - --add Microsoft.Component.MSBuild ` - --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` - --add Microsoft.VisualStudio.Workload.NativeDesktop ` - --quiet --wait --norestart - displayName: Install build script requirements - - - script: | - call "$(VS_ENTERPRISE_PATH)\VC\Auxiliary\Build\vcvars64.bat" - python -m pip install cibuildwheel==2.16.2 - displayName: Install cibuildwheel 2.16.2 - - - pwsh: | - cibuildwheel --output-dir dist . - displayName: 'Build uAMQP Wheel' - env: - CIBW_PRERELEASE_PYTHONS: True - CIBW_BUILD: $(BWFilter) - - - script: dir dist - displayName: 'Check output' - - - powershell: | - $whlfile = Get-ChildItem -Filter *.whl dist | Select-Object -First 1 -ExpandProperty Name - python -m pip install --ignore-installed ./dist/$whlfile - pytest tests --doctest-modules --junitxml=junit/test-results-c.xml - pytest samples --doctest-modules --junitxml=junit/test-results-live.xml - displayName: 'Run tests' - - - task: PublishTestResults@2 - displayName: 'Publish test results' - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/test-results-*.xml' - testResultsFormat: 'JUnit' - testRunTitle: 'Windows $(PythonArchitecture) Python $(PythonVersion)' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish wheel artifact' - inputs: - artifactName: uamqp-win$(PythonArchitecture)-$(PythonVersion)-whl - pathToPublish: 'dist' - - - job: 'Linux' - - pool: - vmImage: 'ubuntu-20.04' - - strategy: - matrix: - Python 3.8: - PythonVersion: '$(PythonVersion38)' - BWFilter: 'cp38-*' - Python 3.9: - PythonVersion: '$(PythonVersion39)' - BWFilter: 'cp39-*' - Python 3.10: - PythonVersion: '$(PythonVersion310)' - BWFilter: 'cp310-*' - Python 3.11: - PythonVersion: '$(PythonVersion311)' - BWFilter: 'cp311-*' - Python 3.12: - PythonVersion: '$(PythonVersion312)' - BWFilter: 'cp312-*' - - steps: - - template: /.azure-pipelines/use-python-version.yml - parameters: - versionSpec: '$(PythonVersion)' - - - script: | - echo "Prepending PATH environment variable with directory: $HOME/.local/bin" - echo "##vso[task.prependpath]$HOME/.local/bin" - displayName: 'Prepare PATH' - - - script: | - python --version - curl -sS $(GetPip) | python - --user - python -m pip --version - python -m pip install setuptools --force - curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb && sudo dpkg -i libffi6_3.2.1-8_amd64.deb - python -m pip install --user -r dev_requirements.txt - displayName: 'Install dependencies' - - - bash: | - set -o errexit - python -m pip install cibuildwheel==2.16.2 - displayName: Install cibuildwheel 2.16.2 - - - pwsh: | - cibuildwheel --output-dir dist . - displayName: 'Build uAMQP Wheel' - env: - CIBW_BUILD: $(BWFilter) - CIBW_PRERELEASE_PYTHONS: True - CIBW_BEFORE_BUILD_LINUX: bash utils/install_openssl.sh - CIBW_ENVIRONMENT_LINUX: OPENSSL_ROOT_DIR="/opt/pyca/cryptography/openssl" LIBRARY_PATH="/opt/pyca/cryptography/openssl/lib" CPATH="/opt/pyca/cryptography/openssl/include" CIBW_ARCHS_LINUX="x86_64" - - - script: ls ./dist - displayName: 'Check output' - - - script: | - python -m pip install --user --ignore-installed ./dist/*.whl - pytest tests --doctest-modules --junitxml=junit/test-results-c.xml - pytest samples --doctest-modules --junitxml=junit/test-results-live.xml - displayName: 'Run tests' - - - task: PublishTestResults@2 - displayName: 'Publish test results' - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/test-results-*.xml' - testResultsFormat: 'JUnit' - testRunTitle: 'Linux Python $(PythonVersion)' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish wheel artifact' - inputs: - artifactName: uamqp-linux-$(PythonVersion)-whl - pathToPublish: 'dist' - - - job: 'ManyLinux' - - condition: ne(variables['System.TeamProject'], 'public') - - pool: - vmImage: 'ubuntu-20.04' - - strategy: - matrix: - Python38-manylinux2014: - PythonVersion: '$(PythonVersion38)' - Platform: 'manylinux2014_x86_64' - BWFilter: 'cp38-*' - Python39-manylinux2014: - PythonVersion: '$(PythonVersion39)' - Platform: 'manylinux2014_x86_64' - BWFilter: 'cp39-*' - Python310-manylinux2014: - PythonVersion: '$(PythonVersion310)' - Platform: 'manylinux2014_x86_64' - BWFilter: 'cp310-*' - Python311-manylinux2014: - PythonVersion: '$(PythonVersion311)' - Platform: 'manylinux2014_x86_64' - BWFilter: 'cp311-*' - Python312-manylinux2014: - PythonVersion: '$(PythonVersion312)' - Platform: 'manylinux2014_x86_64' - BWFilter: 'cp312-*' - - steps: - - template: /.azure-pipelines/use-python-version.yml - parameters: - versionSpec: '$(PythonVersion)' - - - script: | - echo "Prepending PATH environment variable with directory: $HOME/.local/bin" - echo "##vso[task.prependpath]$HOME/.local/bin" - displayName: 'Prepare PATH' - - - script: | - python --version - curl -sS $(GetPip) | python - --user - python -m pip --version - python -m pip install setuptools --force - curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb && sudo dpkg -i libffi6_3.2.1-8_amd64.deb - python -m pip install --user -r dev_requirements.txt - displayName: 'Install dependencies' - - - bash: | - set -o errexit - python -m pip install cibuildwheel==2.16.2 - displayName: Install cibuildwheel 2.16.2 - - - pwsh: | - cibuildwheel --output-dir dist . - displayName: 'Build uAMQP Wheel' - env: - CIBW_BUILD: $(BWFilter) - CIBW_PRERELEASE_PYTHONS: True - CIBW_BEFORE_BUILD_LINUX: bash utils/install_openssl.sh - CIBW_ENVIRONMENT_LINUX: OPENSSL_ROOT_DIR="/opt/pyca/cryptography/openssl" LIBRARY_PATH="/opt/pyca/cryptography/openssl/lib" CPATH="/opt/pyca/cryptography/openssl/include" CIBW_ARCHS_LINUX="x86_64" - CIBW_MANYLINUX_*_IMAGE: manylinux2014 - - - script: ls ./dist - displayName: 'Check output' - - - script: | - python -m pip install --user --ignore-installed ./dist/*.whl - pytest tests --doctest-modules --junitxml=junit/test-results-c.xml - pytest samples --doctest-modules --junitxml=junit/test-results-live.xml - displayName: 'Run tests' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish wheel artifacts' - inputs: - artifactName: uamqp-$(Platform)-$(PythonVersion)-x64-whl - pathToPublish: 'dist' - - - task: PublishTestResults@2 - displayName: 'Publish test results' - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/test-results-*.xml' - testResultsFormat: 'JUnit' - testRunTitle: 'ManyLinux2014 Python $(PythonVersion)' + +extends: + template: /.azure-pipelines/templates/stages/1es-redirect.yml + parameters: + stages: + - stage: + displayName: 'Build and Test' + variables: + - template: /.azure-pipelines/templates/variables.yml + jobs: + - job: 'sdist' + displayName: 'Source Distribution' + + pool: + image: $(LINUXVMIMAGEIMAGE) + name: $(LINUXPOOL) + os: linux + + steps: + - template: /.azure-pipelines/use-python-version.yml + parameters: + versionSpec: '$(PythonVersion38)' + + - script: | + echo "Prepending PATH environment variable with directory: $HOME/.local/bin" + echo "##vso[task.prependpath]$HOME/.local/bin" + displayName: 'Prepare PATH' + + - script: | + python --version + curl -sS $(GetPip) | python - --user + python -m pip --version + python -m pip install --user -r dev_requirements.txt + displayName: 'Install dependencies' + - script: python setup.py sdist + displayName: 'Build uAMQP sdist' + + - script: ls ./dist + displayName: 'Check output' + + - template: /.azure-pipelines/templates/steps/publish-1es-artifact.yml + parameters: + ArtifactName: uamqp-sdist + ArtifactPath: 'dist' + + - job: 'MacOS' + + pool: + name: $(MACPOOL) + vmImage: $(MACVMIMAGE) + os: macOS + + strategy: + matrix: + Python 3.8: + PythonBin: 'python3' + PythonVersion: '$(PythonVersion38)' + BWFilter: 'cp38-*' + Python 3.9: + PythonBin: 'python3' + PythonVersion: '$(PythonVersion39)' + BWFilter: 'cp39-*' + Python 3.10: + PythonBin: 'python3' + PythonVersion: '$(PythonVersion310)' + BWFilter: 'cp310-*' + Python 3.11: + PythonBin: 'python3' + PythonVersion: '$(PythonVersion311)' + BWFilter: 'cp311-*' + Python 3.12: + PythonBin: 'python3' + PythonVersion: '$(PythonVersion312)' + BWFilter: 'cp312-*' + + variables: + MacOSXDeploymentTarget: '10.9' + OpenSSLDir: $(Agent.BuildDirectory)/openssl-macosx$(MacOSXDeploymentTarget) + PythonVersion38: '3.8.2' + PythonVersion39: '3.9.0' + PythonVersion310: '3.10.0' + PythonVersion311: '3.11.0' + PythonVersion312: '3.12.0' + + steps: + - task: DownloadPipelineArtifact@1 + displayName: 'Download OpenSSL artifact' + inputs: + artifactName: openssl-macosx$(MacOSXDeploymentTarget) + buildType: specific + buildVersionToDownload: latest + downloadPath: $(Agent.BuildDirectory) + pipeline: 119 # azure-uamqp-python - openssl + project: '29ec6040-b234-4e31-b139-33dc4287b756' # public + + - script: sudo ls /Applications/ + displayName: 'List All apps' + + - script: sudo xcode-select --switch /Applications/Xcode_13.1.app + displayName: 'Select Xcode 13.1' + + - script: source ./install_python_osx.sh + displayName: 'Install Official Python' + + - script: | + echo "Prepending PATH environment variable with directory: /usr/local/bin" + echo "##vso[task.prependpath]/usr/local/bin" + export PYTHON_SHORT_VER=`echo $(PythonVersion) | cut -d . -f 1,2` + echo "Prepending PATH environment variable with directory: $HOME/Library/Python/$PYTHON_SHORT_VER/bin" + echo "##vso[task.prependpath]$HOME/Library/Python/$PYTHON_SHORT_VER/bin" + displayName: 'Prepare PATH' + + - script: | + $(PythonBin) --version + curl -sS $(GetPip) | $(PythonBin) - --user + $(PythonBin) -m pip --version + $(PythonBin) -m pip install --user -r dev_requirements.txt + displayName: 'Install dependencies' + + - bash: | + set -o errexit + $(PythonBin) -m pip install --user cibuildwheel==2.16.2 --force + displayName: Install cibuildwheel 2.16.2 + + - pwsh: | + cibuildwheel --output-dir dist . + displayName: 'Build uAMQP Wheel' + env: + CIBW_PRERELEASE_PYTHONS: True + CIBW_ARCHS_MACOS: x86_64 + CIBW_BUILD: $(BWFilter) + + - script: ls ./dist + displayName: 'Check output' + + - script: | + $(PythonBin) -m pip install --user --ignore-installed ./dist/*.whl + $(PythonBin) -m pip install --user pytest==6.2.4 --force + $(PythonBin) -m pip install --user pytest-asyncio==0.12.0 --force + pytest tests --doctest-modules --junitxml=junit/test-results-c.xml + pytest samples --doctest-modules --junitxml=junit/test-results-live.xml + displayName: 'Run tests' + + - task: PublishTestResults@2 + displayName: 'Publish test results' + condition: succeededOrFailed() + inputs: + testResultsFiles: '**/test-results-*.xml' + testResultsFormat: 'JUnit' + testRunTitle: 'MacOS Python $(PythonVersion)' + + - template: /.azure-pipelines/templates/steps/publish-1es-artifact.yml + parameters: + ArtifactName: uamqp-macosx$(MacOSXDeploymentTarget)-$(PythonVersion)-whl + ArtifactPath: 'dist' + + - job: 'Windows' + + pool: + name: $(WINDOWSPOOL) + image: $(WINDOWSVMIMAGE) + os: windows + variables: + VS_INSTALLER_URL: "https://aka.ms/vs/17/release/vs_enterprise.exe" + VS_INSTALLER_PATH: "$(Build.BinariesDirectory)/vs_enterprise.exe" + VS_ENTERPRISE_PATH: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise" + + strategy: + matrix: + x64 Python 3.8: + PythonArchitecture: 'x64' + PythonVersion: '$(PythonVersion38)' + BWFilter: 'cp38-win_amd64' + x64 Python 3.9: + PythonArchitecture: 'x64' + PythonVersion: '$(PythonVersion39)' + BWFilter: 'cp39-win_amd64' + x64 Python 3.10: + PythonArchitecture: 'x64' + PythonVersion: '$(PythonVersion310)' + BWFilter: 'cp310-win_amd64' + x64 Python 3.11: + PythonArchitecture: 'x64' + PythonVersion: '$(PythonVersion311)' + BWFilter: 'cp311-win_amd64' + x64 Python 3.12: + PythonArchitecture: 'x64' + PythonVersion: '$(PythonVersion312)' + BWFilter: 'cp312-win_amd64' + x86 Python 3.8: + PythonArchitecture: 'x86' + PythonVersion: '$(PythonVersion38)' + BWFilter: 'cp38-win32' + x86 Python 3.9: + PythonArchitecture: 'x86' + PythonVersion: '$(PythonVersion39)' + BWFilter: 'cp39-win32' + x86 Python 3.10: + PythonArchitecture: 'x86' + PythonVersion: '$(PythonVersion310)' + BWFilter: 'cp310-win32' + x86 Python 3.11: + PythonArchitecture: 'x86' + PythonVersion: '$(PythonVersion311)' + BWFilter: 'cp311-win32' + x86 Python 3.12: + PythonArchitecture: 'x86' + PythonVersion: '$(PythonVersion312)' + BWFilter: 'cp312-win32' + + steps: + - template: /.azure-pipelines/use-python-version.yml + parameters: + architecture: '$(PythonArchitecture)' + versionSpec: '$(PythonVersion)' + + - powershell: | + python --version + Invoke-WebRequest -UseBasicParsing -Uri $(GetPip) | Select-Object -ExpandProperty Content | python + python -m pip --version + python -m pip install -r dev_requirements.txt + displayName: 'Install dependencies' + env: + PYTHONWARNINGS: ignore:DEPRECATION + + - pwsh: | + Invoke-WebRequest "$(VS_INSTALLER_URL)" -OutFile "$(VS_INSTALLER_PATH)" + # In order of component appearance in the install command below, these are the names of the components + # as they in the VS Installer UI. (What you would do locally.) + # C# and Visual Basic Roslyn Compilers (components pane) + # C++ 2022 Redistributable Update (components pane) + # C++ CMake tools for Windows (components pane) + # MSBuild (components pane) + # MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) (components pane) + # Native Desktop Workload (workloads pane) + $(VS_INSTALLER_PATH) --installPath $(VS_ENTERPRISE_PATH) ` + --add Microsoft.VisualStudio.Component.Roslyn.Compiler ` + --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest ` + --add Microsoft.VisualStudio.Component.VC.CMake.Project ` + --add Microsoft.Component.MSBuild ` + --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` + --add Microsoft.VisualStudio.Workload.NativeDesktop ` + --quiet --wait --norestart + displayName: Install build script requirements + + - script: | + call "$(VS_ENTERPRISE_PATH)\VC\Auxiliary\Build\vcvars64.bat" + python -m pip install cibuildwheel==2.16.2 + displayName: Install cibuildwheel 2.16.2 + + - pwsh: | + cibuildwheel --output-dir dist . + displayName: 'Build uAMQP Wheel' + env: + CIBW_PRERELEASE_PYTHONS: True + CIBW_BUILD: $(BWFilter) + + - script: dir dist + displayName: 'Check output' + + - powershell: | + $whlfile = Get-ChildItem -Filter *.whl dist | Select-Object -First 1 -ExpandProperty Name + python -m pip install --ignore-installed ./dist/$whlfile + pytest tests --doctest-modules --junitxml=junit/test-results-c.xml + pytest samples --doctest-modules --junitxml=junit/test-results-live.xml + displayName: 'Run tests' + + - task: PublishTestResults@2 + displayName: 'Publish test results' + condition: succeededOrFailed() + inputs: + testResultsFiles: '**/test-results-*.xml' + testResultsFormat: 'JUnit' + testRunTitle: 'Windows $(PythonArchitecture) Python $(PythonVersion)' + + - template: /.azure-pipelines/templates/steps/publish-1es-artifact.yml + parameters: + ArtifactName: uamqp-win$(PythonArchitecture)-$(PythonVersion)-whl + ArtifactPath: 'dist' + + - job: 'Linux' + + pool: + name: $(LINUXPOOL) + image: $(LINUXVMIMAGE) + os: linux + + strategy: + matrix: + Python 3.8: + PythonVersion: '$(PythonVersion38)' + BWFilter: 'cp38-*' + Python 3.9: + PythonVersion: '$(PythonVersion39)' + BWFilter: 'cp39-*' + Python 3.10: + PythonVersion: '$(PythonVersion310)' + BWFilter: 'cp310-*' + Python 3.11: + PythonVersion: '$(PythonVersion311)' + BWFilter: 'cp311-*' + Python 3.12: + PythonVersion: '$(PythonVersion312)' + BWFilter: 'cp312-*' + + steps: + - template: /.azure-pipelines/use-python-version.yml + parameters: + versionSpec: '$(PythonVersion)' + + - script: | + echo "Prepending PATH environment variable with directory: $HOME/.local/bin" + echo "##vso[task.prependpath]$HOME/.local/bin" + displayName: 'Prepare PATH' + + - script: | + python --version + curl -sS $(GetPip) | python - --user + python -m pip --version + python -m pip install setuptools --force + curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb && sudo dpkg -i libffi6_3.2.1-8_amd64.deb + python -m pip install --user -r dev_requirements.txt + displayName: 'Install dependencies' + + - bash: | + set -o errexit + python -m pip install cibuildwheel==2.16.2 + displayName: Install cibuildwheel 2.16.2 + + - pwsh: | + cibuildwheel --output-dir dist . + displayName: 'Build uAMQP Wheel' + env: + CIBW_BUILD: $(BWFilter) + CIBW_PRERELEASE_PYTHONS: True + CIBW_BEFORE_BUILD_LINUX: bash utils/install_openssl.sh + CIBW_ENVIRONMENT_LINUX: OPENSSL_ROOT_DIR="/opt/pyca/cryptography/openssl" LIBRARY_PATH="/opt/pyca/cryptography/openssl/lib" CPATH="/opt/pyca/cryptography/openssl/include" CIBW_ARCHS_LINUX="x86_64" + + - script: ls ./dist + displayName: 'Check output' + + - script: | + python -m pip install --user --ignore-installed ./dist/*.whl + pytest tests --doctest-modules --junitxml=junit/test-results-c.xml + pytest samples --doctest-modules --junitxml=junit/test-results-live.xml + displayName: 'Run tests' + + - task: PublishTestResults@2 + displayName: 'Publish test results' + condition: succeededOrFailed() + inputs: + testResultsFiles: '**/test-results-*.xml' + testResultsFormat: 'JUnit' + testRunTitle: 'Linux Python $(PythonVersion)' + + - template: /.azure-pipelines/templates/steps/publish-1es-artifact.yml + parameters: + ArtifactName: uamqp-linux-$(PythonVersion)-whl + ArtifactPath: 'dist' + + - job: 'ManyLinux' + + condition: ne(variables['System.TeamProject'], 'public') + + pool: + name: $(LINUXPOOL) + image: $(LINUXVMIMAGE) + os: 'linux' + + + strategy: + matrix: + Python38-manylinux2014: + PythonVersion: '$(PythonVersion38)' + Platform: 'manylinux2014_x86_64' + BWFilter: 'cp38-*' + Python39-manylinux2014: + PythonVersion: '$(PythonVersion39)' + Platform: 'manylinux2014_x86_64' + BWFilter: 'cp39-*' + Python310-manylinux2014: + PythonVersion: '$(PythonVersion310)' + Platform: 'manylinux2014_x86_64' + BWFilter: 'cp310-*' + Python311-manylinux2014: + PythonVersion: '$(PythonVersion311)' + Platform: 'manylinux2014_x86_64' + BWFilter: 'cp311-*' + Python312-manylinux2014: + PythonVersion: '$(PythonVersion312)' + Platform: 'manylinux2014_x86_64' + BWFilter: 'cp312-*' + + steps: + - template: /.azure-pipelines/use-python-version.yml + parameters: + versionSpec: '$(PythonVersion)' + + - script: | + echo "Prepending PATH environment variable with directory: $HOME/.local/bin" + echo "##vso[task.prependpath]$HOME/.local/bin" + displayName: 'Prepare PATH' + + - script: | + python --version + curl -sS $(GetPip) | python - --user + python -m pip --version + python -m pip install setuptools --force + curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb && sudo dpkg -i libffi6_3.2.1-8_amd64.deb + python -m pip install --user -r dev_requirements.txt + displayName: 'Install dependencies' + + - bash: | + set -o errexit + python -m pip install cibuildwheel==2.16.2 + displayName: Install cibuildwheel 2.16.2 + + - pwsh: | + cibuildwheel --output-dir dist . + displayName: 'Build uAMQP Wheel' + env: + CIBW_BUILD: $(BWFilter) + CIBW_PRERELEASE_PYTHONS: True + CIBW_BEFORE_BUILD_LINUX: bash utils/install_openssl.sh + CIBW_ENVIRONMENT_LINUX: OPENSSL_ROOT_DIR="/opt/pyca/cryptography/openssl" LIBRARY_PATH="/opt/pyca/cryptography/openssl/lib" CPATH="/opt/pyca/cryptography/openssl/include" CIBW_ARCHS_LINUX="x86_64" + CIBW_MANYLINUX_*_IMAGE: manylinux2014 + + - script: ls ./dist + displayName: 'Check output' + + - script: | + python -m pip install --user --ignore-installed ./dist/*.whl + pytest tests --doctest-modules --junitxml=junit/test-results-c.xml + pytest samples --doctest-modules --junitxml=junit/test-results-live.xml + displayName: 'Run tests' + + - template: /.azure-pipelines/templates/steps/publish-1es-artifact.yml + parameters: + ArtifactName: 'uamqp-$(Platform)-$(PythonVersion)-x64-whl' + ArtifactPath: 'dist' + + - task: PublishTestResults@2 + displayName: 'Publish test results' + condition: succeededOrFailed() + inputs: + testResultsFiles: '**/test-results-*.xml' + testResultsFormat: 'JUnit' + testRunTitle: 'ManyLinux2014 Python $(PythonVersion)' diff --git a/.azure-pipelines/templates/stages/1es-redirect.yml b/.azure-pipelines/templates/stages/1es-redirect.yml new file mode 100644 index 00000000..348a21e3 --- /dev/null +++ b/.azure-pipelines/templates/stages/1es-redirect.yml @@ -0,0 +1,56 @@ +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +parameters: +- name: stages + type: stageList + default: [] +- name: UseOfficial + type: boolean + default: true + +extends: + ${{ if and(parameters.UseOfficial, eq(variables['System.TeamProject'], 'internal')) }}: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + ${{ else }}: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + settings: + skipBuildTagsForGitHubPullRequests: true + sdl: + sourceAnalysisPool: + name: azsdk-pool-mms-win-2022-general + image: azsdk-pool-mms-win-2022-1espt + os: windows + sourceRepositoriesToScan: + exclude: + - repository: azure-sdk-build-tools + # TODO: migrate analyze spot bugs configuration here from steps/run-and-validate-linting.yml + spotBugs: + enabled: false + binskim: + # Exclude imported azure-sdk-build-tools gpg/azcopy binaries + # See https://dev.azure.com/securitytools/SecurityIntegration/_wiki/wikis/Guardian/1378/Glob-Format + analyzeTargetGlob: +:file|**/*.jar;+:file|**\*.jar;+:file|**/*.exe;-:f|**/tools/gpg/**/*.dll;-:f|**/tools/gpg/**/*.exe;-:f|**/tools/azcopy/**/*.exe;-:f|**/tools/azcopy/**/*.dll + eslint: + enabled: false + justificationForDisabling: 'ESLint injected task has failures because it uses an old version of mkdirp. We should not fail for tools not controlled by the repo. See: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=3499746' + codeql: + compiled: + enabled: false + justificationForDisabling: CodeQL times our pipelines out by running for 2+ hours before being force canceled. + psscriptanalyzer: + compiled: true + break: true + policy: M365 + credscan: + suppressionsFile: $(Build.SourcesDirectory)/eng/CredScanSuppression.json + scanFolder: $(Build.SourcesDirectory)/credscan.tsv + toolVersion: 2.3.12.23 + baselineFiles: $(Build.SourcesDirectory)/eng/java.gdnbaselines + + stages: ${{ parameters.stages }} diff --git a/.azure-pipelines/templates/steps/publish-1es-artifact.yml b/.azure-pipelines/templates/steps/publish-1es-artifact.yml new file mode 100644 index 00000000..7648a341 --- /dev/null +++ b/.azure-pipelines/templates/steps/publish-1es-artifact.yml @@ -0,0 +1,32 @@ +# This step is used to prevent duplication of artifact publishes when there is an issue that would prevent the overall success of the job. +# Ensuring that we only publish when successful (and two a differently named artifact otherwise) will allow easy retry on a build pipeline +# without running into the "cannot override artifact" failure when we finally do get a passing run. + +# ArtifactName - The name of the artifact in the "successful" case. +# ArtifactPath - The path we will be publishing. +# CustomCondition - Used if there is additional logic necessary to prevent attempt of publish. +# SbomEnabled - Set whether to auto-inject 1es pipeline template sbom tasks + +parameters: + ArtifactName: '' + ArtifactPath: '' + CustomCondition: true + SbomEnabled: true + +steps: + - pwsh: | + if ($env:AGENT_JOBSTATUS -eq "Failed") { + Write-Host "##vso[task.setvariable variable=PublishArtifactName;]${{ parameters.ArtifactName }}-FailedAttempt$(System.JobAttempt)" + } else { + Write-Host "##vso[task.setvariable variable=PublishArtifactName;]${{ parameters.ArtifactName }}" + } + condition: and(succeededOrFailed(), ${{ parameters.CustomCondition }}) + displayName: Set Artifact Name $(Agent.JobStatus) + + - task: 1ES.PublishPipelineArtifact@1 + condition: and(succeededOrFailed(), ${{ parameters.CustomCondition }}) + displayName: 'Publish ${{ parameters.ArtifactName }} Artifacts' + inputs: + artifactName: '$(PublishArtifactName)' + targetPath: '${{ parameters.ArtifactPath }}' + sbomEnabled: ${{ parameters.SbomEnabled }} diff --git a/.azure-pipelines/templates/variables/image.yml b/.azure-pipelines/templates/variables/image.yml new file mode 100644 index 00000000..322e3875 --- /dev/null +++ b/.azure-pipelines/templates/variables/image.yml @@ -0,0 +1,26 @@ +# Default pool image selection. Set as variable so we can override at pipeline level + +variables: + - name: LINUXPOOL + value: azsdk-pool-mms-ubuntu-2004-general + - name: WINDOWSPOOL + value: azsdk-pool-mms-win-2022-general + - name: MACPOOL + value: Azure Pipelines + + - name: LINUXVMIMAGE + value: azsdk-pool-mms-ubuntu-2004-1espt + - name: LINUXNEXTVMIMAGE + value: azsdk-pool-mms-ubuntu-2204-1espt + - name: WINDOWSVMIMAGE + value: azsdk-pool-mms-win-2022-1espt + - name: MACVMIMAGE + value: macos-11 + + # Values required for pool.os field in 1es pipeline templates + - name: LINUXOS + value: linux + - name: WINDOWSOS + value: windows + - name: MACOS + value: macOS