Skip to content

Commit

Permalink
Merge branch 'main' into fix-dag-drawer-no-reg
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Apr 14, 2022
2 parents f1b423f + 0e61992 commit d276cce
Show file tree
Hide file tree
Showing 21 changed files with 858 additions and 811 deletions.
56 changes: 56 additions & 0 deletions .azure/docs-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
parameters:
- name: "pythonVersion"
type: string
displayName: "Version of Python to use"

jobs:
- job: 'Docs'
pool: {vmImage: 'ubuntu-latest'}

variables:
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip

steps:
- checkout: self

- task: UsePythonVersion@0
inputs:
versionSpec: '${{ parameters.pythonVersion }}'
displayName: 'Use Python ${{ parameters.pythonVersion }}'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: Cache pip

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel
pip install -U tox
sudo apt-get update
sudo apt-get install -y graphviz
displayName: 'Install dependencies'
- bash: |
tox -edocs
displayName: 'Run Docs build'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: 'docs/_build/html'
archiveType: tar
archiveFile: '$(Build.ArtifactStagingDirectory)/html_docs.tar.gz'
verbose: true

- task: PublishBuildArtifacts@1
displayName: 'Publish docs'
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'html_docs'
Parallel: true
ParallelCount: 8
55 changes: 55 additions & 0 deletions .azure/lint-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
parameters:
- name: "pythonVersion"
type: string
displayName: "Version of Python to use"

jobs:
- job: 'Lint'
pool: {vmImage: 'ubuntu-latest'}

variables:
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '${{ parameters.pythonVersion }}'
displayName: 'Use Python ${{ parameters.pythonVersion }}'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: Cache pip

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel virtualenv
virtualenv test-job
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -U -c constraints.txt -e .
pip install -U "qiskit-aer" -c constraints.txt
python setup.py build_ext --inplace
displayName: 'Install dependencies'
- bash: |
set -e
source test-job/bin/activate
black --check qiskit test tools examples setup.py
cargo fmt --check
displayName: "Formatting"
- bash: |
set -e
source test-job/bin/activate
pylint -rn qiskit test tools
cargo clippy -- -D warnings
tools/verify_headers.py qiskit test
python tools/find_optional_imports.py
reno lint
displayName: 'Lint'
162 changes: 162 additions & 0 deletions .azure/test-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
parameters:
- name: "pythonVersion"
type: string
displayName: "Version of Python to test"

- name: "testQPY"
type: boolean
default: false

- name: "testImages"
type: boolean
default: false

- name: "installFromSdist"
type: boolean
default: false


jobs:
- job: "Linux_Tests_Python${{ replace(parameters.pythonVersion, '.', '') }}"
displayName: "Test Linux Python ${{ parameters.pythonVersion }}"
pool: {vmImage: 'ubuntu-latest'}

variables:
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
QISKIT_TEST_CAPTURE_STREAMS: 1

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '${{ parameters.pythonVersion }}'
displayName: 'Use Python ${{ parameters.pythonVersion }}'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" |"$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: "Cache pip"

- task: Cache@2
inputs:
key: 'stestr | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
restoreKeys: |
stestr | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
stestr | "$(Agent.OS)"
stestr
path: .stestr
displayName: "Cache stestr"

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel virtualenv
virtualenv test-job
displayName: "Prepare venv"
- ${{ if eq(parameters.installFromSdist, true) }}:
- bash: |
set -e
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
python setup.py sdist
pip install -U -c constraints.txt dist/qiskit-terra*.tar.gz
displayName: "Install Terra from sdist"
- ${{ if eq(parameters.installFromSdist, false) }}:
- bash: |
set -e
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -U -c constraints.txt -e .
displayName: "Install Terra directly"
- bash: |
set -e
source test-job/bin/activate
pip install -U "cplex" "qiskit-aer" "z3-solver" -c constraints.txt
mkdir -p /tmp/terra-tests
cp -r test /tmp/terra-tests/.
cp tools/verify_parallel_map.py /tmp/terra-tests/.
cp .stestr.conf /tmp/terra-tests/.
cp -r .stestr /tmp/terra-tests/. || :
sudo apt-get update
sudo apt-get install -y graphviz
pip check
displayName: 'Install post-install optional dependencies'
- bash: |
set -e
source test-job/bin/activate
pushd /tmp/terra-tests
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 4294967295))")
echo "PYTHONHASHSEED=$PYTHONHASHSEED"
stestr run
python ./verify_parallel_map.py
popd
env:
QISKIT_PARALLEL: FALSE
displayName: 'Run tests'
- bash: |
set -e
source test-job/bin/activate
cp tools/subunit_to_junit.py /tmp/terra-tests/.
pip install -U junitxml
pushd /tmp/terra-tests
mkdir -p junit
stestr last --subunit | ./subunit_to_junit.py -o junit/test-results.xml
pushd .stestr
ls | grep -P "^\d" | xargs -d "\n" rm -f
popd
popd
cp -r /tmp/terra-tests/junit .
cp -r /tmp/terra-tests/.stestr .
displayName: 'Generate results'
condition: succeededOrFailed()
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Test results for Linux Python ${{ parameters.pythonVersion }}'

- task: CopyFiles@2
inputs:
contents: '**/*.png'
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: 'Copy images on test failure'
condition: failed()

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'drop_linux'
displayName: 'Publish images on test failure'
condition: failed()

- ${{ if eq(parameters.testQPY, true) }}:
- bash: |
set -e
pushd test/qpy_compat
./run_tests.sh
popd
displayName: 'Run QPY backwards compat tests'
- ${{ if eq(parameters.testImages, true) }}:
- bash: |
set -e
virtualenv image_tests
image_tests/bin/pip install -U -r requirements.txt -c constraints.txt
image_tests/bin/pip install -U -c constraints.txt -e ".[visualization]"
sudo apt-get update
sudo apt-get install -y graphviz pandoc
image_tests/bin/pip check
displayName: 'Install dependencies'
- bash: image_tests/bin/python -m unittest discover -v test/ipynb
displayName: 'Run image test'
94 changes: 94 additions & 0 deletions .azure/test-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
parameters:
- name: "pythonVersion"
type: string
displayName: "Version of Python to test"

jobs:
- job: "MacOS_Tests_Python${{ replace(parameters.pythonVersion, '.', '') }}"
displayName: "Test macOS Python ${{ parameters.pythonVersion }}"
pool: {vmImage: 'macOS-10.15'}

variables:
QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
QISKIT_TEST_CAPTURE_STREAMS: 1

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '${{ parameters.pythonVersion }}'
displayName: 'Use Python ${{ parameters.pythonVersion }}'

- task: Cache@2
inputs:
key: 'pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
restoreKeys: |
pip | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
pip | "$(Agent.OS)"
pip
path: $(PIP_CACHE_DIR)
displayName: "Cache pip"

- task: Cache@2
inputs:
key: 'stestr | "$(Agent.OS)" | "${{ parameters.pythonVersion }}" | "$(Build.BuildNumber)"'
restoreKeys: |
stestr | "$(Agent.OS)" | "${{ parameters.pythonVersion }}"
stestr | "$(Agent.OS)"
stestr
path: .stestr
displayName: "Cache stestr"

- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel virtualenv
virtualenv test-job
source test-job/bin/activate
pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt
pip install -U -c constraints.txt -e .
python setup.py build_ext --inplace
pip check
displayName: 'Install dependencies'
- bash: |
set -e
source test-job/bin/activate
export PYTHONHASHSEED=$(python -S -c "import random; print(random.randint(1, 4294967295))")
echo "PYTHONHASHSEED=$PYTHONHASHSEED"
stestr run
python ./tools/verify_parallel_map.py
env:
QISKIT_PARALLEL: FALSE
displayName: "Run tests"
- bash: |
set -e
source test-job/bin/activate
pip install -U junitxml
mkdir -p junit
stestr last --subunit | tools/subunit_to_junit.py -o junit/test-results.xml
pushd .stestr
ls | grep -e '^[[:digit:]]' | xargs -n1 rm -f
popd
displayName: "Generate results"
condition: succeededOrFailed()
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Test results for macOS Python ${{ parameters.pythonVersion }}'

- task: CopyFiles@2
inputs:
contents: '**/*.png'
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: 'Copy images on test failure'
condition: failed()

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'drop_macos'
displayName: 'Publish images on test failure'
condition: failed()

0 comments on commit d276cce

Please sign in to comment.