-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Testing of Conda Artifacts (#18478)
* take advantage of additional test-matrix, add ci.conda.tests to jobs/ci.yml which further extends test matrix for conda artifacts * test our conda packages on windows/mac/linux py 3.6, 3.8, 3.9 * add common conda requirements file
- Loading branch information
Showing
13 changed files
with
257 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
variables: | ||
AZURESDK_CONDA_VERSION: '2021.05.01' | ||
AZURESDK_CONDA_VERSION: '2021.05.01b1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# install from root of repo | ||
aiohttp>=3.0; python_version >= '3.5' | ||
tools/azure-devtools | ||
tools/azure-sdk-tools | ||
mock; | ||
aiodns>=2.0; python_version >= '3.5' | ||
parameterized>=0.7.3; python_version >= '3.0' | ||
trio; python_version >= '3.5' | ||
typing_extensions>=3.7.2 | ||
futures==3.3.0; python_version <= '2.7' | ||
cryptography | ||
adal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
parameters: | ||
- name: TestPipeline | ||
type: boolean | ||
default: false | ||
- name: ServiceDirectory | ||
type: string | ||
default: '' | ||
- name: CondaArtifacts | ||
type: object | ||
default: [] | ||
- name: TestMarkArgument | ||
type: string | ||
default: '' | ||
- name: PythonVersion | ||
type: string | ||
default: '' | ||
- name: OSVmImage | ||
type: string | ||
default: '' | ||
- name: Matrix | ||
type: string | ||
- name: DependsOn | ||
type: string | ||
default: '' | ||
- name: UsePlatformContainer | ||
type: boolean | ||
default: false | ||
- name: TestTimeoutInMinutes | ||
type: number | ||
default: 0 | ||
- name: CloudConfig | ||
type: object | ||
default: {} | ||
|
||
jobs: | ||
- job: | ||
displayName: 'Test Conda' | ||
condition: | | ||
and( | ||
succeededOrFailed(), | ||
ne(variables['Skip.TestConda'], 'true') | ||
) | ||
timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} | ||
|
||
dependsOn: | ||
- ${{ parameters.DependsOn }} | ||
|
||
strategy: | ||
matrix: $[ ${{ parameters.Matrix }} ] | ||
|
||
pool: | ||
name: $(Pool) | ||
vmImage: $(OSVmImage) | ||
|
||
${{ if eq(parameters.UsePlatformContainer, 'true') }}: | ||
# Add a default so the job doesn't fail when the matrix is empty | ||
container: $[ variables['Container'] ] | ||
|
||
variables: | ||
- template: ../variables/globals.yml | ||
|
||
steps: | ||
- task: DownloadPipelineArtifact@2 | ||
inputs: | ||
artifactName: 'conda' | ||
targetPath: $(Build.ArtifactStagingDirectory) | ||
|
||
- template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml | ||
parameters: | ||
PackageName: "azure-template" | ||
ServiceDirectory: "template" | ||
TestPipeline: ${{ parameters.TestPipeline }} | ||
|
||
- task: UsePythonVersion@0 | ||
displayName: 'Use Python $(PythonVersion)' | ||
inputs: | ||
versionSpec: $(PythonVersion) | ||
|
||
- pwsh: | | ||
# due to faulty deployed scripts/how the path gets manipulated by conda actions on | ||
# ubuntu and mac, we can't rely on bin/scripts being referenced correctly. see | ||
# https://github.com/MicrosoftDocs/azure-devops-docs/issues/3812 | ||
$activateMethod = "source $($env:CONDA)/bin/activate" | ||
# pypy3 is not a true python executable. in conda-land, we need to call it using pypy3, NOT python | ||
# on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to | ||
# how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. | ||
$requirementSuffix = "" | ||
# we always want to prepend the path with conda bin | ||
Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" | ||
if ($IsWindows) { | ||
# powershell does not have an equivalent of call/source, which is necessary when | ||
# using conda in azure devops. Note that we use `activate` natively here, as | ||
# a later path prepend of the /scripts directory actually works. | ||
$activateMethod = "call activate" | ||
$requirementSuffix = " --user" | ||
# on windows only, need to prepend with the scripts directory as well | ||
Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" | ||
} | ||
if("$(PythonVersion)" -eq "pypy3"){ | ||
Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7 pip" | ||
} | ||
else { | ||
Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" | ||
} | ||
# we will use these variables extensively later | ||
Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" | ||
Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" | ||
displayName: 'Evaluate OS Specific PATH and Parameters' | ||
- ${{ each artifact in parameters.CondaArtifacts }}: | ||
# due to the fact that `pypy3` and `conda-build` conda packages are INCOMPATIBLE, we have to create | ||
# a separate env to install `conda-build` and use that to `conda index` the local file channel | ||
- script: | | ||
echo "conda create --name ${{ artifact.name }} $(PyVersion) --yes" | ||
conda create --name ${{ artifact.name }} $(PyVersion) --yes | ||
echo "conda create --name index-env --yes" | ||
conda create --name index-env --yes | ||
echo "conda install --name index-env --yes --quiet conda-build" | ||
conda install --name index-env --yes --quiet conda-build | ||
echo "$(activate.method) index-env" | ||
$(activate.method) index-env | ||
echo "conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }}" | ||
conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} | ||
displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' | ||
- script: | | ||
echo "$(activate.method) ${{ artifact.name }}" | ||
$(activate.method) ${{ artifact.name }} | ||
echo "python -m pip install -r eng/ci_tools.txt $(requirement.suffix)" | ||
python -m pip install -r eng/ci_tools.txt $(requirement.suffix) | ||
displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' | ||
- pwsh: | | ||
mkdir $(Agent.BuildDirectory)/conda/ | ||
Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" | ||
displayName: 'Create Conda Working Directory for Testing' | ||
- script: | | ||
echo "$(activate.method) ${{ artifact.name }}" | ||
$(activate.method) ${{ artifact.name }} | ||
echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" | ||
python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt | ||
python -m pip uninstall azure-core -y | ||
displayName: 'Prep Conda Environment w/ Dependencies' | ||
- script: | | ||
echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" | ||
conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) | ||
echo "conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes" | ||
conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes | ||
echo "$(activate.method) ${{ artifact.name }}" | ||
$(activate.method) ${{ artifact.name }} | ||
python -m pip freeze | ||
displayName: 'Install ${{ artifact.name }} Conda Package' | ||
- ${{ each checkout in artifact.checkout }}: | ||
- pwsh: | ||
Write-Host "Clean up Conda Build Directory $(conda.build)" | ||
Remove-Item $(conda.build)/* -Recurse -Force | ||
displayName: 'Clean Up Before Testing ${{ artifact.name }}' | ||
|
||
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml | ||
parameters: | ||
Paths: | ||
- "${{ checkout.checkout_path }}" | ||
- "sdk/conftest.py" | ||
- "tools/" | ||
Repositories: | ||
- Name: "Azure/azure-sdk-for-python" | ||
Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" | ||
WorkingDirectory: "$(conda.build)" | ||
SkipDefaultCheckout: true | ||
|
||
- script: | | ||
echo "$(activate.method) ${{ artifact.name }}" | ||
$(activate.method) ${{ artifact.name }} | ||
python -m pytest $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} | ||
displayName: 'Run Tests for ${{ checkout.package }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
eng/pipelines/templates/stages/platform-matrix-conda-support.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"matrix": { | ||
"Agent": { | ||
"ubuntu-18.04": { "OSVmImage": "MMSUbuntu18.04", "Pool": "azsdk-pool-mms-ubuntu-1804-general" }, | ||
"windows-2019": { "OSVmImage": "MMS2019", "Pool": "azsdk-pool-mms-win-2019-general" }, | ||
"macOS-10.15": { "OSVmImage": "macOS-10.15", "Pool": "Azure Pipelines" } | ||
}, | ||
"PythonVersion": [ "3.6", "3.8", "3.9" ] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.