From ecc609fb220295416e2aa308b18ba453fd5c0356 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 3 Jul 2019 10:17:02 -0400 Subject: [PATCH 1/6] Avoid reuse in azure pipelines job configuration In the azure pipelines runs for #258 the jobs are failing for what looks like a mismatch with the installed aer python package and what should have been built. Just to rule that out for runs this commit makes 2 changes. First it creates a conda environment/virtualenv with a unique name for each run. Secondly it runs git clean to remove any old built wheels (assuming there are any). Hopefully this will provide more reliability in future runs. --- azure-pipelines.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 92f3ad0e1f..1435e219b9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,14 +21,15 @@ strategy: steps: - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: Add conda to PATH - - script: conda create --yes --quiet --name qiskit-aer + - script: conda create --yes --quiet --name qiskit-aer-$(Build.BuildNumber) displayName: Create Anaconda environment - script: | - call activate qiskit-aer - conda install --yes --quiet --name qiskit-aer python=%PYTHON_VERSION% numpy + call activate qiskit-aer-$(Build.BuildNumber) + conda install --yes --quiet --name qiskit-aer-$(Build.BuildNumber) python=%PYTHON_VERSION% numpy displayName: Install Anaconda packages - script: | - call activate qiskit-aer + call activate qiskit-aer-$(Build.BuildNumber) + git clean -fdX python -m pip install --disable-pip-version-check pip==18 pip install cython pip install git+https://github.com/Qiskit/qiskit-terra.git From a96e7bb3858e1968fde6c945637e5f5e03027841 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 3 Jul 2019 10:40:48 -0400 Subject: [PATCH 2/6] Change pip aer install and split tests from build --- azure-pipelines.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1435e219b9..f703210e58 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -35,6 +35,9 @@ steps: pip install git+https://github.com/Qiskit/qiskit-terra.git pip install --ignore-installed -r requirements-dev.txt python setup.py bdist_wheel -- -G "Visual Studio 15 2017 Win64" - pip install --find-links=dist\ qiskit_aer + pip install dist\qiskit_aer* + displayName: 'Install dependencies and build Aer' + - script: | + call activate qiskit-aer-$(Build.BuildNumber) python -m unittest discover -s test/terra -v - displayName: 'Install dependencies and Run Tests' + displayName: 'Run Tests' From 896500d357dd135f9c3060ede2b83483a192f3b4 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 3 Jul 2019 10:52:05 -0400 Subject: [PATCH 3/6] Use bash for pip --- azure-pipelines.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f703210e58..a1ada164e8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -35,9 +35,9 @@ steps: pip install git+https://github.com/Qiskit/qiskit-terra.git pip install --ignore-installed -r requirements-dev.txt python setup.py bdist_wheel -- -G "Visual Studio 15 2017 Win64" - pip install dist\qiskit_aer* - displayName: 'Install dependencies and build Aer' - - script: | + displayName: 'Install Dependencies and Build Aer' + - bash: | call activate qiskit-aer-$(Build.BuildNumber) + pip install 'dist\qiskit_aer*.whl' python -m unittest discover -s test/terra -v - displayName: 'Run Tests' + displayName: 'Install Aer and Run Tests' From 963067ad8a443e1fa9b11c51a5f9845489f72f1b Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 3 Jul 2019 11:07:12 -0400 Subject: [PATCH 4/6] Switch back to cmd for run job --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a1ada164e8..68f370b7f1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,8 +36,8 @@ steps: pip install --ignore-installed -r requirements-dev.txt python setup.py bdist_wheel -- -G "Visual Studio 15 2017 Win64" displayName: 'Install Dependencies and Build Aer' - - bash: | + - script: | call activate qiskit-aer-$(Build.BuildNumber) - pip install 'dist\qiskit_aer*.whl' + pip install dist\qiskit_aer*.whl python -m unittest discover -s test/terra -v displayName: 'Install Aer and Run Tests' From e0242a12097b5592f40f56f36659c9ab0805fccd Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 3 Jul 2019 11:10:57 -0400 Subject: [PATCH 5/6] Switch to bash and set -e --- azure-pipelines.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 68f370b7f1..52f0422fa1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -27,8 +27,9 @@ steps: call activate qiskit-aer-$(Build.BuildNumber) conda install --yes --quiet --name qiskit-aer-$(Build.BuildNumber) python=%PYTHON_VERSION% numpy displayName: Install Anaconda packages - - script: | - call activate qiskit-aer-$(Build.BuildNumber) + - bash: | + set -e + source activate qiskit-aer-$(Build.BuildNumber) git clean -fdX python -m pip install --disable-pip-version-check pip==18 pip install cython @@ -36,8 +37,9 @@ steps: pip install --ignore-installed -r requirements-dev.txt python setup.py bdist_wheel -- -G "Visual Studio 15 2017 Win64" displayName: 'Install Dependencies and Build Aer' - - script: | - call activate qiskit-aer-$(Build.BuildNumber) + - bash: | + set -e + source activate qiskit-aer-$(Build.BuildNumber) pip install dist\qiskit_aer*.whl python -m unittest discover -s test/terra -v displayName: 'Install Aer and Run Tests' From f551b691c1f45b0cca6a07cf695dcde883835e4c Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 3 Jul 2019 11:27:21 -0400 Subject: [PATCH 6/6] Switch \ to / in bash --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 52f0422fa1..b004a74a58 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -40,6 +40,6 @@ steps: - bash: | set -e source activate qiskit-aer-$(Build.BuildNumber) - pip install dist\qiskit_aer*.whl + pip install dist/qiskit_aer*.whl python -m unittest discover -s test/terra -v displayName: 'Install Aer and Run Tests'