Skip to content

Commit

Permalink
Refactor Github workflow, test notebooks (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
neiljdo authored Aug 31, 2024
2 parents d96256a + f353841 commit 0187921
Show file tree
Hide file tree
Showing 10 changed files with 641 additions and 1,029 deletions.
55 changes: 35 additions & 20 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,68 @@ env:
DOCS_BUILD_DIR: docs/_build/html

jobs:
docs:
name: Build and deploy documentation
build:
name: Build documentation
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # fetches tags, required for version info
- name: Set up uv
# Install a specific uv version using the installer
run: curl -LsSf https://astral.sh/uv/0.3.5/install.sh | sh
run: curl -LsSf https://astral.sh/uv/0.4.0/install.sh | sh
- name: Set up Python
run: uv python install 3.12
- name: Install documentation dependencies
run: |
sudo apt-get install graphviz pandoc
uv sync --dev
- name: Test example notebooks
env:
TEST_NOTEBOOKS: 1
run: >
uv run pytest --nbmake ${{ env.DOCS_DIR }}/examples/
--nbmake-timeout=60
- name: Test tutorial notebooks
env:
TEST_NOTEBOOKS: 1
run: >
uv run pytest --nbmake ${{ env.DOCS_DIR }}/tutorials/
--nbmake-timeout=60
--ignore ${{ env.DOCS_DIR }}/tutorials/code
- name: Clean notebooks
run: |
uv run scripts/clean_notebooks.py -p ${{ env.DOCS_DIR }} -s
- name: Draw diagrams from PlantUML files
uses: Timmy/plantuml-action@v1
with:
args: '-v -DPLANTUML_LIMIT_SIZE=8192 -tpng ${{ env.DOCS_DIR }}/puml/*.puml -o img'
- name: Build documentation
run: uv run ./build-docs.sh
- name: Setup Pages
- name: Setup pages
id: pages
uses: actions/configure-pages@v3
- name: Upload Artifact
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# upload build output
path: ${{ env.DOCS_BUILD_DIR }}

deploy:
name: Deploy documentation
if: ${{ github.event_name == 'push' && github.ref_name == 'release' }}
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
steps:
- name: Deploy artifact
id: deployment
uses: actions/deploy-pages@v1

# - name: Deploy documentation
# if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'release') }}
# uses: s0/git-publish-subdir-action@develop
# env:
# REPO: self
# BRANCH: docs
# FOLDER: ${{ env.DOCS_BUILD_DIR }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CLEAR_GLOBS_FILE: ${{ env.WORKFLOWS_DIR }}/clear-target-files
uses: actions/deploy-pages@v2

# - name: Zip up documentation to store as release asset
# if: ${{ github.event_name == 'release' }}
# run: |
Expand Down
105 changes: 0 additions & 105 deletions docs/examples/dependency-reader.ipynb

This file was deleted.

354 changes: 0 additions & 354 deletions docs/examples/torchquantum.ipynb

This file was deleted.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.uv]
dev-dependencies = [
"lambeq[extras]>=0.4.2",
"lambeq[extras,test]>=0.4.2",
"nbformat~=5.7.3",
"nbsphinx~=0.8.12",
"numpydoc~=1.5.0",
Expand All @@ -9,6 +9,11 @@ dev-dependencies = [
"sphinx_mdinclude~=0.5.3",
"furo~=2024.7.18",
"sphinxcontrib-jquery~=4.1",
"nbmake>=1.5.4",
"pip>=24.2",
"qiskit<1",
"pytket-qiskit>=0.48.0",
"qiskit-ibm-runtime>=0.17.0",
]

[tool.uv.workspace]
Expand Down
Loading

0 comments on commit 0187921

Please sign in to comment.