From 1e53174a2bfc9df29c68d29f1a31babbbae387a3 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 11 Aug 2020 07:06:03 -0400 Subject: [PATCH 1/7] Add tutorials job to CI This commit adds a new job to run the qiskit tutorials in CI. The tutorials are used as a form of upgrade testing to ensure that for key examples Qiskit as a whole is N and N+1 releases. This caused friction during the qiskit 0.20.0 release because the tutorials were never updated to stop using deprecated code (or in the case of other elements by merging backwards incompatible changes). To ensure there aren't any surprises at the last minute when we run the tutorials with a proposed new metapackage this commit adds a job to CI to ensure that they always run with terra changes. It means for PRs that change an api (after a deprecation cycle) the tutorial will need to be updated first. This will ensure that users will have an upgrade path because CI in qiskit/qiskit-tutorials runs with the metapackage. --- azure-pipelines.yml | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e23a0262472c..77ed9334f643 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -527,3 +527,53 @@ stages: inputs: testResultsFiles: '**/test-*.xml' testRunTitle: 'Test results for macOS Python $(python.version)' + - job: 'Tutorials' + pool: {vmImage: 'ubuntu-latest'} + strategy: + matrix: + Python38: + python.version: '3.8' + variables: + QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y + PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | "$(python.version)"' + restoreKeys: | + pip | "$(Agent.OS)" + pip + path: $(PIP_CACHE_DIR) + displayName: Cache pip + - bash: | + set -e + git clone https://github.com/Qiskit/qiskit-tutorials + python -m pip install --upgrade pip + pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt + pip install -c constraints.txt -e . + pip install "qiskit-ibmq-provider" "qiskit-aer" "z3-solver" "qiskit-ignis" "qiskit-aqua" "pyscf<1.7.4" sphinx nbsphinx sphinx_rtd_theme cvxpy -c constraints.txt + python setup.py build_ext --inplace + sudo apt install -y graphviz + pip check + displayName: 'Install dependencies' + - bash: | + set -e + cd qiskit-tutorials + sphinx-build -b html . _build/html + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: '_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_tutorials' + Parallel: true + ParallelCount: 8 From 6a0b454ae1b1cd6f50625a6cae89b510e74ca831 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 11 Aug 2020 08:17:42 -0400 Subject: [PATCH 2/7] Install pandoc in tutorials job --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 77ed9334f643..bdd222249f7a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -557,7 +557,7 @@ stages: pip install -c constraints.txt -e . pip install "qiskit-ibmq-provider" "qiskit-aer" "z3-solver" "qiskit-ignis" "qiskit-aqua" "pyscf<1.7.4" sphinx nbsphinx sphinx_rtd_theme cvxpy -c constraints.txt python setup.py build_ext --inplace - sudo apt install -y graphviz + sudo apt install -y graphviz pandoc pip check displayName: 'Install dependencies' - bash: | From 4864d1d24e1cc85834915c87c4fcd1d5b3a2e2d7 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 11 Aug 2020 09:16:15 -0400 Subject: [PATCH 3/7] Remove aqua tutorials from ci job for run time --- azure-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index db75ce9769d6..230ff586d510 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -594,6 +594,9 @@ stages: - bash: | set -e cd qiskit-tutorials + rm -rf chemistry/*ipynb + rm -rf finance/*ipynb + rm -rf optimizations/*ipynb sphinx-build -b html . _build/html - task: ArchiveFiles@2 inputs: From a7806b868ca651c571b2dba8223c60040bdc6fd0 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 11 Aug 2020 12:14:23 -0400 Subject: [PATCH 4/7] Fix rm path and speed up tutorials clone --- azure-pipelines.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 230ff586d510..ae12099b2c2e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -582,7 +582,7 @@ stages: displayName: Cache pip - bash: | set -e - git clone https://github.com/Qiskit/qiskit-tutorials + git clone https://github.com/Qiskit/qiskit-tutorials --depth=1 python -m pip install --upgrade pip pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt pip install -c constraints.txt -e . @@ -594,9 +594,9 @@ stages: - bash: | set -e cd qiskit-tutorials - rm -rf chemistry/*ipynb - rm -rf finance/*ipynb - rm -rf optimizations/*ipynb + rm -rf tutorials/chemistry/*ipynb + rm -rf tutorials/finance/* + rm -rf tutorials/optimizations/* sphinx-build -b html . _build/html - task: ArchiveFiles@2 inputs: From c00fbc1da4b7634b8b78d48f34f43b820f2b1a04 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 11 Aug 2020 14:17:49 -0400 Subject: [PATCH 5/7] Try pinning matplotlib --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ae12099b2c2e..0565874f4a5b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -586,7 +586,7 @@ stages: python -m pip install --upgrade pip pip install -U -r requirements.txt -r requirements-dev.txt -c constraints.txt pip install -c constraints.txt -e . - pip install "qiskit-ibmq-provider" "qiskit-aer" "z3-solver" "qiskit-ignis" "qiskit-aqua" "pyscf<1.7.4" sphinx nbsphinx sphinx_rtd_theme cvxpy -c constraints.txt + pip install "qiskit-ibmq-provider" "qiskit-aer" "z3-solver" "qiskit-ignis" "qiskit-aqua" "pyscf<1.7.4" "matplotlib<3.3.0" sphinx nbsphinx sphinx_rtd_theme cvxpy -c constraints.txt python setup.py build_ext --inplace sudo apt install -y graphviz pandoc pip check From b227a67102ff20ade6c5fdaa4d969748cd20d4c6 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 11 Aug 2020 15:45:49 -0400 Subject: [PATCH 6/7] Try fixing archive path --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0565874f4a5b..762844e3ddcd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -600,9 +600,9 @@ stages: sphinx-build -b html . _build/html - task: ArchiveFiles@2 inputs: - rootFolderOrFile: '_build/html' + rootFolderOrFile: 'qiskit-tutorials/_build/html' archiveType: tar - archiveFile: '$(Build.ArtifactStagingDirectory)/html_docs.tar.gz' + archiveFile: '$(Build.ArtifactStagingDirectory)/html_tutorials.tar.gz' verbose: true - task: PublishBuildArtifacts@1 displayName: 'Publish docs' From 25290ebb4b5a7defab132a60dedd7a3a14534f5c Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 14 Aug 2020 14:23:48 -0400 Subject: [PATCH 7/7] Add back aqua tutorials --- azure-pipelines.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 762844e3ddcd..03481357da34 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -594,9 +594,6 @@ stages: - bash: | set -e cd qiskit-tutorials - rm -rf tutorials/chemistry/*ipynb - rm -rf tutorials/finance/* - rm -rf tutorials/optimizations/* sphinx-build -b html . _build/html - task: ArchiveFiles@2 inputs: