diff --git a/.github/actions/set-up-notebook-testing/action.yml b/.github/actions/set-up-notebook-testing/action.yml index 078c96f334..e1f2aae1f0 100644 --- a/.github/actions/set-up-notebook-testing/action.yml +++ b/.github/actions/set-up-notebook-testing/action.yml @@ -28,7 +28,7 @@ runs: steps: - uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.11" - name: Install Python packages shell: bash diff --git a/.github/workflows/notebook-test.yml b/.github/workflows/notebook-test.yml index 995b07cec0..e7c916b556 100644 --- a/.github/workflows/notebook-test.yml +++ b/.github/workflows/notebook-test.yml @@ -16,6 +16,7 @@ on: paths: - "docs/**/*.ipynb" - "!docs/api/**/*" + - "scripts/nb-tester/**/*" workflow_dispatch: jobs: execute: @@ -64,7 +65,9 @@ jobs: - name: Setup environment uses: ./.github/actions/set-up-notebook-testing with: - install-linux-deps: ${{ steps.linux-changed-files.outputs.any_changed }} + # Install Linux deps if the specific guides were changed, or + # if all files are being tested. + install-linux-deps: ${{ steps.linux-changed-files.outputs.any_changed == 'true' || steps.all-changed-files.outputs.any_changed == 'false' }} ibm-quantum-token: ${{ secrets.IBM_QUANTUM_TEST_TOKEN }} - name: Check lint @@ -91,12 +94,22 @@ jobs: run: | import subprocess files = """${{ steps.all-changed-files.outputs.all_changed_files }}""" - args = ["tox", "--"] + files.split("\n") + ["--write"] + args = ["tox", "--", "--write"] + if files: + args.extend(files.split("\n")) subprocess.run(args, check=True) + - name: Detect changed notebooks + id: changed-notebooks + if: "!cancelled()" + run: | + echo "CHANGED_NOTEBOOKS<> $GITHUB_OUTPUT + git diff --name-only >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + - name: Upload executed notebooks if: "!cancelled()" uses: actions/upload-artifact@v4 with: name: Executed notebooks - path: ${{ steps.all-changed-files.outputs.all_changed_files }} + path: ${{ steps.changed-notebooks.outputs.CHANGED_NOTEBOOKS }} diff --git a/scripts/nb-tester/pyproject.toml b/scripts/nb-tester/pyproject.toml index 3971aa5de2..d9f2622be4 100644 --- a/scripts/nb-tester/pyproject.toml +++ b/scripts/nb-tester/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" name = "qiskit-docs-notebook-tester" version = "0.0.1" description = "Tool for the Qiskit docs team to test their notebooks" -requires-python = ">=3.9" +requires-python = ">=3.11" license = "Apache-2.0" dependencies = [ "qiskit-ibm-runtime", diff --git a/scripts/nb-tester/requirements.txt b/scripts/nb-tester/requirements.txt index 643020a93e..db6482e8c0 100644 --- a/scripts/nb-tester/requirements.txt +++ b/scripts/nb-tester/requirements.txt @@ -3,6 +3,6 @@ qiskit[all]~=1.1 qiskit-aer~=0.14.2 -qiskit-ibm-runtime~=0.26.0 +qiskit-ibm-runtime~=0.27.0 qiskit-ibm-provider~=0.11.0 -qiskit-serverless~=0.14.2 +qiskit-serverless~=0.15.2 diff --git a/tox.ini b/tox.ini index ef5e90f9b4..f37baaba62 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] min_version = 4.0 -env_list = py3 +env_list = py311 skipsdist = true [testenv]