Upload notebooks in CI (#527)

Closes #523.

See https://github.com/Qiskit/documentation/actions/runs/7225258563 for
an example of this working.

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
This commit is contained in:
Frank Harkins 2024-01-03 21:10:39 +00:00 committed by GitHub
parent 247a6e1705
commit 61e783de49
2 changed files with 21 additions and 1 deletions

View File

@ -31,6 +31,9 @@ jobs:
- name: Get all changed files
id: all-changed-files
uses: tj-actions/changed-files@af2816c65436325c50621100d67f6e853cd1b0f1
with:
files: docs/**/*.ipynb
separator: "\n"
- name: Check for notebooks that require LaTeX
id: latex-changed-files
@ -71,4 +74,15 @@ jobs:
key: ${{ hashFiles('scripts/nb-tester/requirements.txt') }}
- name: Run tox
run: tox -- ${{ steps.all-changed-files.outputs.all_changed_files }}
shell: python
run: |
import subprocess
files = """${{ steps.all-changed-files.outputs.all_changed_files }}"""
args = ["tox", "--"] + files.split("\n") + ["--write"]
subprocess.run(args, check=True)
- name: Upload executed notebooks
uses: actions/upload-artifact@v4
with:
name: Executed notebooks
path: ${{ steps.all-changed-files.outputs.all_changed_files }}

View File

@ -139,6 +139,12 @@ pipx install tox
> add it to the "Check for notebooks that require LaTeX" step in
> `.github/workflows/notebook-test.yml`.
When you make a pull request with a changed notebook, you can get a version of
that notebook that was executed in a uniform environment from CI. To do this,
click "Show all checks" in the info box at the bottom of the pull request page
on GitHub, then choose "Details" for the "Test notebooks" job. From the job
page, click "Summary", then download "Executed notebooks".
## Check for broken links
CI will check for broken links. You can also check locally: