Redo test structure for azure

Signed-off-by: Dan Ryan <dan.ryan@canonical.com>
This commit is contained in:
Dan Ryan
2020-04-05 00:06:40 -04:00
parent f90e183064
commit 5c525edcaa
7 changed files with 89 additions and 142 deletions
@@ -1,45 +0,0 @@
parameters:
python_version: ''
steps:
- script: |
echo "##vso[task.setvariable variable=LANG]C.UTF-8"
echo "##vso[task.setvariable variable=PIP_PROCESS_DEPENDENCY_LINKS]1"
displayName: Set Environment Variables
- ${{ if eq(parameters.vmImage, 'windows-latest') }}:
- powershell: |
pip install certifi
$env:PYTHON_PATH=$(python -c "import sys; print(sys.executable)")
$env:CERTIFI_CONTENT=$(python -m certifi)
echo "##vso[task.setvariable variable=GIT_SSL_CAINFO]$env:CERTIFI_CONTENT"
echo "##vso[task.setvariable variable=PY_EXE]$env:PYTHON_PATH"
displayName: Set Python Path
env:
PYTHONWARNINGS: 'ignore:DEPRECATION'
- ${{ if ne(parameters.vmImage, 'windows-latest') }}:
- bash: |
pip install certifi
PYTHON_PATH=$(python -c 'import sys; print(sys.executable)')
CERTIFI_CONTENT=$(python -m certifi)
echo "##vso[task.setvariable variable=GIT_SSL_CAINFO]$CERTIFI_CONTENT"
echo "##vso[task.setvariable variable=PY_EXE]$PYTHON_PATH"
displayName: Set Python Path
env:
PYTHONWARNINGS: 'ignore:DEPRECATION'
- script: |
echo "Python path: $(PY_EXE)"
echo "GIT_SSL_CAINFO: $(GIT_SSL_CAINFO)"
echo "PIPENV PYTHON VERSION: $(python.version)"
echo "python_version: ${{ parameters.python_version }}"
git submodule sync
git submodule update --init --recursive
$(PY_EXE) -m pip install "virtualenv<20"
$(PY_EXE) -m pipenv install --deploy --dev --python="$(PY_EXE)"
env:
PIPENV_DEFAULT_PYTHON_VERSION: ${{ parameters.python_version }}
PYTHONWARNINGS: 'ignore:DEPRECATION'
PIPENV_NOSPIN: '1'
displayName: Make Virtualenv
@@ -1,5 +1,30 @@
parameters:
python_version: ''
steps:
- script: 'python -m pip install --upgrade pip setuptools wheel --upgrade-strategy=eager && python -m pip install -e . --upgrade'
- script: |
echo "##vso[task.setvariable variable=LANG]C.UTF-8"
echo "##vso[task.setvariable variable=PIP_PROCESS_DEPENDENCY_LINKS]1"
displayName: Set Environment Variables
- script: |
echo "Python path: $(PY_EXE)"
echo "GIT_SSL_CAINFO: $(GIT_SSL_CAINFO)"
echo "PIPENV PYTHON VERSION: $(python.version)"
echo "python_version: ${{ parameters.python_version }}"
git submodule sync
git submodule update --init --recursive
$(PY_EXE) -m pip install --upgrade --upgrade-strategy=eager pip setuptools wheel
$(PY_EXE) -m pip install "virtualenv<20"
$(PY_EXE) -m pipenv install --deploy --dev --python="$(PY_EXE)"
env:
PIPENV_DEFAULT_PYTHON_VERSION: ${{ parameters.python_version }}
PYTHONWARNINGS: 'ignore:DEPRECATION'
PIPENV_NOSPIN: '1'
displayName: Make Virtualenv
- script: 'python -m pip install -e . --upgrade'
displayName: Upgrade Pip & Install Pipenv
env:
PYTHONWARNINGS: 'ignore:DEPRECATION'
@@ -1,34 +0,0 @@
steps:
- script: |
# When you paste this, please make sure the indentation is preserved
# Fail out if any setups fail
set -e
# Delete old Pythons
rm -rf $AGENT_TOOLSDIRECTORY/Python/2.7.16
rm -rf $AGENT_TOOLSDIRECTORY/Python/3.5.7
rm -rf $AGENT_TOOLSDIRECTORY/Python/3.7.3
[ -e $AGENT_TOOLSDIRECTORY/Python/3.7.2 ] && [ -e $AGENT_TOOLSDIRECTORY/Python/3.5.5 ] && [ -e $AGENT_TOOLSDIRECTORY/Python/2.7.15 ] && exit 0
# Download new Pythons
azcopy --recursive \
--source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/linux/Python/2.7.15 \
--destination $AGENT_TOOLSDIRECTORY/Python/2.7.15
azcopy --recursive \
--source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/linux/Python/3.5.5 \
--destination $AGENT_TOOLSDIRECTORY/Python/3.5.5
azcopy --recursive \
--source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/linux/Python/3.7.2 \
--destination $AGENT_TOOLSDIRECTORY/Python/3.7.2
# Install new Pythons
original_directory=$PWD
setups=$(find $AGENT_TOOLSDIRECTORY/Python -name setup.sh)
for setup in $setups; do
chmod +x $setup;
cd $(dirname $setup);
./$(basename $setup);
cd $original_directory;
done;
displayName: 'Workaround: roll back Python versions'
+16 -1
View File
@@ -2,11 +2,26 @@ parameters:
python_version: ''
steps:
- bash: |
pip install certifi
PYTHON_PATH=$(python -c 'import sys; print(sys.executable)')
CERTIFI_CONTENT=$(python -m certifi)
echo "##vso[task.setvariable variable=GIT_SSL_CAINFO]$CERTIFI_CONTENT"
echo "##vso[task.setvariable variable=PY_EXE]$PYTHON_PATH"
displayName: Set Python Path
env:
PYTHONWARNINGS: 'ignore:DEPRECATION'
- template: install-dependencies.yml
parameters:
python_version: ${{ parameters.python_version }}
- script: |
# Fix Git SSL errors
echo "Using pipenv python version: $(PIPENV_DEFAULT_PYTHON_VERSION)"
git submodule sync && git submodule update --init --recursive
pipenv run pytest -n 4 --junitxml=test-results.xml
pipenv run pytest -n 4 --junitxml=junit/test-results.xml
displayName: Run integration tests
env:
PYTHONWARNINGS: ignore:DEPRECATION
+44 -22
View File
@@ -3,42 +3,64 @@ parameters:
python_architecture: ''
steps:
- task: UsePythonVersion@0
- task: PowerShell@2
inputs:
versionSpec: ${{ parameters.python_version }}
architecture: ${{ parameters.python_architecture }}
addToPath: true
displayName: Use Python ${{ parameters.python_version }}
- script: |
echo '##vso[task.setvariable variable=PIPENV_DEFAULT_PYTHON_VERSION]'${{ parameters.python_version }}
env:
PYTHON_VERSION: ${{ parameters.python_version }}
- template: install-dependencies.yml
- template: create-virtualenv.yml
parameters:
python_version: ${{ parameters.python_version }}
filePath: .azure-pipelines/scripts/New-RAMDisk.ps1
arguments: "-Drive R -Size 2GB"
displayName: Setup RAMDisk
- powershell: |
subst T: "$env:TEMP"
Write-Host "##vso[task.setvariable variable=TEMP]T:\"
Write-Host "##vso[task.setvariable variable=TMP]T:\"
mkdir R:\Temp
$acl = Get-Acl "R:\Temp"
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule(
"Everyone", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow"
)
$acl.AddAccessRule($rule)
Set-Acl "R:\Temp" $acl
displayName: Set RAMDisk Permissions
- powershell: |
Write-Host "##vso[task.setvariable variable=TEMP]R:\"
Write-Host "##vso[task.setvariable variable=TMP]R:\"
Write-Host "##vso[task.setvariable variable=WORKON_HOME]R:\virtualenvs"
Write-Host "##vso[task.setvariable variable=PIPENV_DEFAULT_PYTHON_VERSION]$env:PYTHON_VERSION"
Write-Host "##vso[task.setvariable variable=PIPENV_NOSPIN]1"
displayName: Fix Temp Variable
env:
PYTHON_VERSION: ${{ parameters.python_version }}
- powershell: |
pip install certifi
$env:PYTHON_PATH=$(python -c "import sys; print(sys.executable)")
$env:CERTIFI_CONTENT=$(python -m certifi)
echo "##vso[task.setvariable variable=GIT_SSL_CAINFO]$env:CERTIFI_CONTENT"
echo "##vso[task.setvariable variable=PY_EXE]$env:PYTHON_PATH"
displayName: Set Python Path
env:
PYTHONWARNINGS: 'ignore:DEPRECATION'
- template: install-dependencies.yml
parameters:
python_version: ${{ parameters.python_version }}
- powershell: |
git submodule sync
git submodule update --init --recursive
Write-Host "Running Command: pipenv run pytest -n 4 --junitxml=test-results.xml --timeout 300 tests/"
pipenv run pytest -n 4 --junitxml=test-results.xml --timeout 300 tests/
Write-Host "Running Command: pipenv run pytest -n 4 --junitxml=junit/test-results.xml --timeout 300 tests/"
$env:TEMP = "R:\Temp"
pipenv run pytest -ra -n 4 --timeout=300 --junit-xml=junit/test-results.xml tests/
failOnStderr: false
displayName: Run integration tests
env:
PYTHONWARNINGS: 'ignore:DEPRECATION'
PIPENV_NOSPIN: '1'
PIPENV_NOSPIN: 1
GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=accept-new -o CheckHostIP=no
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFiles: junit/*.xml
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()
+1 -7
View File
@@ -6,17 +6,11 @@ steps:
addToPath: true
displayName: Use Python $(python.version)
- template: install-dependencies.yml
- script: |
echo '##vso[task.setvariable variable=PIPENV_DEFAULT_PYTHON_VERSION]'$(python.version)
env:
PYTHON_VERSION: $(python.version)
- template: create-virtualenv.yml
parameters:
python_version: $(python.version)
- ${{ if eq(parameters.vmImage, 'windows-latest') }}:
- template: run-tests-windows.yml
parameters:
@@ -29,6 +23,6 @@ steps:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFiles: '**/test-results.xml'
testResultsFiles: '**/junit/*.xml'
testRunTitle: 'Python $(python.version)'
condition: succeededOrFailed()
+2 -32
View File
@@ -69,7 +69,7 @@ jobs:
parameters:
vmImage: 'Ubuntu-latest'
- job: TestWindows1
- job: TestWindows
timeoutInMinutes: 0
pool:
vmImage: windows-latest
@@ -89,39 +89,9 @@ jobs:
python.architecture: x64
maxParallel: 8
steps:
- template: .azure-pipelines/steps/run-tests-windows.yml
- template: .azure-pipelines/steps/run-tests.yml
parameters:
vmImage: windows-latest
python_version: $(python.version)
python_architecture: $(python.architecture)
# pytest_markers: "lock or dotvenv or markers or project or utils or patched or core or cli"
# - job: TestWindows2
# timeoutInMinutes: 0
# pool:
# vmImage: windows-latest
# strategy:
# matrix:
# Python27:
# python.version: '2.7'
# python.architecture: x64
# Python36:
# python.version: '3.6'
# python.architecture: x64
# Python37:
# python.version: '3.7'
# python.architecture: x64
# Python38:
# python.version: '3.8'
# python.architecture: x64
# maxParallel: 8
# steps:
# - template: .azure-pipelines/steps/run-tests-windows.yml
# parameters:
# vmImage: windows-latest
# python_version: $(python.version)
# python_architecture: $(python.architecture)
# pytest_markers: "urls or multiprocessing or local or sequential or run or outdated or basic or code or uninstall"
- job: TestMacOS
pool: