Skip to content

docs(readme): pin mkdocs-deploy to v1.2.0 commit and bump version ref… #178

docs(readme): pin mkdocs-deploy to v1.2.0 commit and bump version ref…

docs(readme): pin mkdocs-deploy to v1.2.0 commit and bump version ref… #178

name: Test mkdocs-deploy
on:
push:
permissions:
contents: write
pages: write
jobs:
test-pull-request-trigger:
name: Test Pull Request Trigger
runs-on: ubuntu-latest
strategy:
matrix:
package-manager: [pip, uv, pixi]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files (pip/uv)
if: matrix.package-manager != 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/uv.lock .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-pull-request-pip-uv/docs .
- name: Copy test fixture files (pixi)
if: matrix.package-manager == 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock .
cp tests/data/mkdocs-deploy/test-pull-request-pixi/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-pull-request-pixi/docs .
# Generate pixi.lock if not present (for testing)
if [ ! -f tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock ]; then
echo "Warning: pixi.lock not found, will be generated by pixi during setup"
else
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock .
fi
- name: Set install-groups for package manager
id: set-groups
run: |
if [ "${{ matrix.package-manager }}" = "pixi" ]; then
echo "groups=docs" >> $GITHUB_OUTPUT
else
echo "groups=groups: docs" >> $GITHUB_OUTPUT
fi
- name: Test MkDocs deploy for PR
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
install-groups: ${{ steps.set-groups.outputs.groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify deployment command was attempted
run: |
echo "Deployment test completed for ${{ matrix.package-manager }}"
test-main-trigger:
name: Test Main Branch Trigger
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-main-trigger/pyproject.toml .
cp tests/data/mkdocs-deploy/test-main-trigger/uv.lock .
cp tests/data/mkdocs-deploy/test-main-trigger/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-main-trigger/docs .
- name: Test MkDocs deploy for main
uses: ./actions/mkdocs-deploy
with:
trigger: 'main'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-release-trigger:
name: Test Release Trigger
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package-manager: uv
release-tag: "v1.0.0"
mike-alias: "latest"
- package-manager: pip
release-tag: "v2.0.0"
mike-alias: "stable"
- package-manager: pixi
release-tag: "v3.0.0"
mike-alias: "current"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files (pip/uv)
if: matrix.package-manager != 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-release-trigger-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-release-trigger-pip-uv/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-release-trigger-pip-uv/uv.lock .
cp -r tests/data/mkdocs-deploy/test-release-trigger-pip-uv/docs .
- name: Copy test fixture files (pixi)
if: matrix.package-manager == 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-release-trigger-pixi/pyproject.toml .
cp tests/data/mkdocs-deploy/test-release-trigger-pixi/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-release-trigger-pixi/docs .
# Generate pixi.lock if not present (for testing)
if [ ! -f tests/data/mkdocs-deploy/test-release-trigger-pixi/pixi.lock ]; then
echo "Warning: pixi.lock not found, will be generated by pixi during setup"
else
cp tests/data/mkdocs-deploy/test-release-trigger-pixi/pixi.lock .
fi
- name: Set install-groups for package manager
id: set-groups
run: |
if [ "${{ matrix.package-manager }}" = "pixi" ]; then
echo "groups=docs" >> $GITHUB_OUTPUT
else
echo "groups=groups: docs" >> $GITHUB_OUTPUT
fi
- name: Test MkDocs deploy for release
uses: ./actions/mkdocs-deploy
with:
trigger: 'release'
package-manager: ${{ matrix.package-manager }}
install-groups: ${{ steps.set-groups.outputs.groups }}
release-tag: ${{ matrix.release-tag }}
mike-alias: ${{ matrix.mike-alias }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-custom-configuration:
name: Test Custom Configuration
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Test different install-groups formats with uv
- python-version: "3.11"
install-groups: "groups: docs"
package-manager: "uv"
- python-version: "3.12"
install-groups: "groups: docs dev"
package-manager: "uv"
- python-version: "3.12"
install-groups: "extras: docs"
package-manager: "uv"
# Test pip with different formats
- python-version: "3.11"
install-groups: "groups: docs"
package-manager: "pip"
- python-version: "3.12"
install-groups: "extras: docs"
package-manager: "pip"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-custom-configuration/pyproject.toml .
cp tests/data/mkdocs-deploy/test-custom-configuration/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-custom-configuration/uv.lock .
cp -r tests/data/mkdocs-deploy/test-custom-configuration/docs .
- name: Test with custom configuration
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
python-version: ${{ matrix.python-version }}
install-groups: ${{ matrix.install-groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-error-scenarios:
name: Test Error Scenarios
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Test without MkDocs configuration
id: no-mkdocs-test
continue-on-error: true
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify deployment fails without mkdocs.yml
if: steps.no-mkdocs-test.outcome != 'failure'
run: |
echo "ERROR: Deployment should fail without mkdocs.yml"
exit 1
- name: Copy test fixture files for missing docs dependencies test
run: |
cp tests/data/mkdocs-deploy/test-error-no-docs-deps/pyproject.toml .
cp tests/data/mkdocs-deploy/test-error-no-docs-deps/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-error-no-docs-deps/docs .
- name: Test with missing docs dependencies
id: no-deps-test
continue-on-error: true
uses: ./actions/mkdocs-deploy
with:
trigger: 'main'
package-manager: 'uv'
install-groups: 'dev' # Wrong group, no mkdocs
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify deployment fails without mkdocs installed
if: steps.no-deps-test.outcome != 'failure'
run: |
echo "ERROR: Deployment should fail without mkdocs dependencies"
exit 1
- name: Test invalid trigger
id: invalid-trigger-test
continue-on-error: true
uses: ./actions/mkdocs-deploy
with:
trigger: 'invalid'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify invalid trigger handling
run: |
echo "Invalid trigger test completed"
test-git-configuration:
name: Test Git Configuration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-git-configuration/pyproject.toml .
cp tests/data/mkdocs-deploy/test-git-configuration/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-git-configuration/docs .
- name: Clear git config to test action sets it
run: |
git config --global --unset user.name || true
git config --global --unset user.email || true
- name: Test git configuration
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'pip'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify git was configured
run: |
git config --global user.name
git config --global user.email
test-package-manager-commands:
name: Test Package Manager Command Execution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-package-manager-commands/pyproject.toml .
cp tests/data/mkdocs-deploy/test-package-manager-commands/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-package-manager-commands/docs .
# Copy uv.lock if it exists
if [ -f tests/data/mkdocs-deploy/test-package-manager-commands/uv.lock ]; then
cp tests/data/mkdocs-deploy/test-package-manager-commands/uv.lock .
fi
# Copy pixi.lock if it exists
if [ -f tests/data/mkdocs-deploy/test-package-manager-commands/pixi.lock ]; then
cp tests/data/mkdocs-deploy/test-package-manager-commands/pixi.lock .
fi
- name: Test pip command execution
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'pip'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test uv command execution
uses: ./actions/mkdocs-deploy
with:
trigger: 'main'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test pixi command execution
uses: ./actions/mkdocs-deploy
with:
trigger: 'release'
package-manager: 'pixi'
install-groups: 'docs'
release-tag: 'v1.0.0'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-release-tag-resolution:
name: Test Release Tag Resolution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-release-tag-resolution/pyproject.toml .
cp tests/data/mkdocs-deploy/test-release-tag-resolution/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-release-tag-resolution/uv.lock .
cp -r tests/data/mkdocs-deploy/test-release-tag-resolution/docs .
- name: Test with explicit release tag
uses: ./actions/mkdocs-deploy
with:
trigger: 'release'
package-manager: 'uv'
release-tag: 'v4.5.6'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test without explicit release tag (simulated)
env:
GITHUB_EVENT_NAME: release
uses: ./actions/mkdocs-deploy
with:
trigger: 'release'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-default-install-groups:
name: Test Default install-groups Value
runs-on: ubuntu-latest
strategy:
matrix:
package-manager: [pip, uv, pixi]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files (pip/uv)
if: matrix.package-manager != 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/uv.lock .
cp -r tests/data/mkdocs-deploy/test-pull-request-pip-uv/docs .
- name: Copy test fixture files (pixi)
if: matrix.package-manager == 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pixi/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-pull-request-pixi/docs .
if [ -f tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock ]; then
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock .
fi
- name: Set install-groups for package manager
id: set-groups
run: |
if [ "${{ matrix.package-manager }}" = "pixi" ]; then
echo "groups=docs" >> $GITHUB_OUTPUT
else
echo "groups=groups: docs" >> $GITHUB_OUTPUT
fi
- name: Test with default install-groups (groups docs)
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
install-groups: ${{ steps.set-groups.outputs.groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify default behavior
run: |
echo "Default install-groups test completed for ${{ matrix.package-manager }}"
test-pixi-environment-parsing:
name: Test Pixi Environment Names
runs-on: ubuntu-latest
strategy:
matrix:
install-groups:
- "docs" # Direct environment name
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pixi/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-pull-request-pixi/docs .
if [ -f tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock ]; then
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock .
fi
- name: Test pixi with environment "${{ matrix.install-groups }}"
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'pixi'
install-groups: ${{ matrix.install-groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify environment succeeded
run: |
echo "Pixi environment test completed for: ${{ matrix.install-groups }}"
test-python-version-matrix:
name: Test Python Version Compatibility
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.11", "3.12", "3.13"]
package-manager: [pip, uv]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-custom-configuration/pyproject.toml .
cp tests/data/mkdocs-deploy/test-custom-configuration/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-custom-configuration/uv.lock .
cp -r tests/data/mkdocs-deploy/test-custom-configuration/docs .
- name: Test install-groups format "${{ matrix.install-groups }}"
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
python-version: ${{ matrix.python-version }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Python version
run: |
python --version
echo "Python ${{ matrix.python-version }} test completed for ${{ matrix.package-manager }}"
test-with-notebooks:
name: Test Notebook Execution
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package-manager: [pip, uv, pixi]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files (pip/uv)
if: matrix.package-manager != 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/uv.lock .
cp tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/docs .
cp -r tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/src .
- name: Copy test fixture files (pixi)
if: matrix.package-manager == 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-with-notebooks-pixi/pyproject.toml .
cp tests/data/mkdocs-deploy/test-with-notebooks-pixi/pixi.lock .
cp tests/data/mkdocs-deploy/test-with-notebooks-pixi/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-with-notebooks-pixi/docs .
cp -r tests/data/mkdocs-deploy/test-with-notebooks-pixi/src .
- name: Set install-groups for package manager
id: set-groups
run: |
if [ "${{ matrix.package-manager }}" = "pixi" ]; then
echo "groups=docs" >> $GITHUB_OUTPUT
else
echo "groups=groups: docs" >> $GITHUB_OUTPUT
fi
- name: Assert notebook has no outputs before action runs
run: |
python -c "
import json, sys
nb = json.load(open('docs/notebook/hello.ipynb'))
for cell in nb['cells']:
if cell['cell_type'] == 'code' and cell.get('outputs'):
print('FAIL: pre-run notebook should have no outputs', file=sys.stderr)
sys.exit(1)
print('OK: pre-run notebook has no outputs (as expected)')
"
- name: Run mkdocs-deploy with notebook execution
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
install-groups: ${{ steps.set-groups.outputs.groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
notebooks-path: 'docs/notebook'
- name: Assert notebook has outputs after action runs
run: |
python -c "
import json, sys
nb = json.load(open('docs/notebook/hello.ipynb'))
code_cells = [c for c in nb['cells'] if c['cell_type'] == 'code']
if not code_cells:
print('FAIL: no code cells in notebook', file=sys.stderr)
sys.exit(1)
missing = [i for i, c in enumerate(code_cells) if not c.get('outputs')]
if missing:
print(f'FAIL: code cells {missing} have no outputs after execution', file=sys.stderr)
sys.exit(1)
print(f'OK: all {len(code_cells)} code cells have outputs')
"
- name: Assert cache directory was populated
run: |
if [ ! -d ".jupyter_cache/executed" ]; then
echo "FAIL: .jupyter_cache/executed was not created"
exit 1
fi
if [ ! -f ".jupyter_cache/executed/hello.ipynb" ]; then
echo "FAIL: .jupyter_cache/executed/hello.ipynb was not saved"
ls -R .jupyter_cache || true
exit 1
fi
echo "OK: .jupyter_cache/executed/hello.ipynb was saved"
test-notebooks-path-disabled-by-default:
name: Test Notebooks Skipped When notebooks-path Empty
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy a non-notebooks fixture
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/uv.lock .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-pull-request-pip-uv/docs .
- name: Run mkdocs-deploy without notebooks-path
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'uv'
install-groups: 'groups: docs'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Assert no .jupyter_cache was created
run: |
if [ -d ".jupyter_cache" ]; then
echo "FAIL: .jupyter_cache was created even though notebooks-path was empty"
exit 1
fi
echo "OK: notebook execution was correctly skipped"
test-notebooks-exclude:
name: Test Notebook Exclude Globs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy notebook fixture (uv)
run: |
cp tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/uv.lock .
cp tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/docs .
cp -r tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/src .
- name: Add notebooks that fail if executed (must be excluded)
run: |
python - <<'PY'
import json, os
fail = {
"cells": [{"cell_type": "code", "execution_count": None, "id": "boom",
"metadata": {}, "outputs": [],
"source": ["raise RuntimeError('needs live network - must never run in CI')"]}],
"metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}},
"nbformat": 4, "nbformat_minor": 5,
}
os.makedirs("docs/notebook/cloud", exist_ok=True)
os.makedirs("docs/notebook/scratch", exist_ok=True)
# Excluded via the directory glob "cloud/*.ipynb"
json.dump(fail, open("docs/notebook/cloud/needs-network.ipynb", "w"))
# Excluded via the root-matching globstar "**/skip-*.ipynb"
json.dump(fail, open("docs/notebook/skip-me.ipynb", "w"))
# Excluded via "scratch/*.ipynb" given on a comma-separated line
json.dump(fail, open("docs/notebook/scratch/wip.ipynb", "w"))
print("Wrote three intentionally-failing notebooks")
PY
- name: Run mkdocs-deploy excluding the failing notebooks
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'uv'
install-groups: 'groups: docs'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
notebooks-path: 'docs/notebook'
# Mixes newline separation (between lines) with comma separation
# (within the second line) to exercise both split paths.
notebooks-exclude: |
cloud/*.ipynb
**/skip-*.ipynb, scratch/*.ipynb
- name: Assert excluded notebooks were neither executed nor cached
run: |
python - <<'PY'
import json, os, sys
def has_outputs(path):
nb = json.load(open(path))
return any(c["cell_type"] == "code" and c.get("outputs") for c in nb["cells"])
checks = {
"good notebook executed": has_outputs("docs/notebook/hello.ipynb"),
"good notebook cached": os.path.exists(".jupyter_cache/executed/hello.ipynb"),
"nested excluded NOT executed": not has_outputs("docs/notebook/cloud/needs-network.ipynb"),
"root excluded NOT executed": not has_outputs("docs/notebook/skip-me.ipynb"),
"comma excluded NOT executed": not has_outputs("docs/notebook/scratch/wip.ipynb"),
"nested excluded NOT cached": not os.path.exists(".jupyter_cache/executed/cloud/needs-network.ipynb"),
"root excluded NOT cached": not os.path.exists(".jupyter_cache/executed/skip-me.ipynb"),
"comma excluded NOT cached": not os.path.exists(".jupyter_cache/executed/scratch/wip.ipynb"),
}
failed = [name for name, ok in checks.items() if not ok]
for name, ok in checks.items():
print(("OK " if ok else "FAIL") + ": " + name)
if failed:
sys.exit(1)
print("All exclude-glob assertions passed (nested + root globstar + comma-separated).")
PY
test-notebooks-continue-on-error:
name: Test Notebook Continue-On-Error
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy notebook fixture (uv)
run: |
cp tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/uv.lock .
cp tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/docs .
cp -r tests/data/mkdocs-deploy/test-with-notebooks-pip-uv/src .
- name: Add a notebook that fails to execute (NOT excluded)
run: |
python - <<'PY'
import json
fail = {
"cells": [{"cell_type": "code", "execution_count": None, "id": "boom",
"metadata": {}, "outputs": [],
"source": ["raise RuntimeError('flaky notebook')"]}],
"metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}},
"nbformat": 4, "nbformat_minor": 5,
}
# Sorts before hello.ipynb, so it is reached first during the walk.
json.dump(fail, open("docs/notebook/flaky.ipynb", "w"))
print("Wrote docs/notebook/flaky.ipynb")
PY
- name: Deploy WITHOUT continue-on-error should fail (negative control)
id: strict
continue-on-error: true
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'uv'
install-groups: 'groups: docs'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
notebooks-path: 'docs/notebook'
- name: Assert the strict run aborted in the prepare step on the failing notebook
run: |
python - <<'PY'
import json, os, sys
def has_outputs(path):
nb = json.load(open(path))
return any(c["cell_type"] == "code" and c.get("outputs") for c in nb["cells"])
# Verify the failure was specifically the notebook-execution abort.
# flaky.ipynb sorts before hello.ipynb, so a strict walk reaches and
# fails on flaky before ever touching the good notebook. We therefore
# assert the good notebook in the working tree was left un-executed
# (no outputs), which is deterministic regardless of any restored
# .jupyter_cache (actions/cache may carry a cached hello.ipynb across
# runs, so cache-file presence is NOT a reliable signal here).
checks = {
# The action must have failed...
"strict run failed": "${{ steps.strict.outcome }}" == "failure",
# ...aborting on flaky.ipynb before the good notebook, so the good
# notebook in the working tree was never executed.
"good notebook NOT executed": not has_outputs("docs/notebook/hello.ipynb"),
}
failed = [name for name, ok in checks.items() if not ok]
for name, ok in checks.items():
print(("OK " if ok else "FAIL") + ": " + name)
if failed:
print("Negative control did not fail as expected:", failed, file=sys.stderr)
sys.exit(1)
print("Negative control verified: prepare step aborted on the failing notebook.")
PY
- name: Deploy WITH continue-on-error should succeed
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'uv'
install-groups: 'groups: docs'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
notebooks-path: 'docs/notebook'
notebooks-continue-on-error: 'true'
- name: Assert good notebook ran and failing one was tolerated, not cached
run: |
python - <<'PY'
import json, os, sys
def has_outputs(path):
nb = json.load(open(path))
return any(c["cell_type"] == "code" and c.get("outputs") for c in nb["cells"])
checks = {
"good notebook executed": has_outputs("docs/notebook/hello.ipynb"),
"good notebook cached": os.path.exists(".jupyter_cache/executed/hello.ipynb"),
"failing notebook NOT cached": not os.path.exists(".jupyter_cache/executed/flaky.ipynb"),
}
failed = [name for name, ok in checks.items() if not ok]
for name, ok in checks.items():
print(("OK " if ok else "FAIL") + ": " + name)
if failed:
sys.exit(1)
print("continue-on-error tolerated the failing notebook; good notebook executed and cached.")
PY
test-install-groups-variations:
name: Test install-groups Format Variations
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Test groups prefix
- install-groups: "groups: docs"
package-manager: "uv"
- install-groups: "groups: docs dev"
package-manager: "uv"
- install-groups: "groups: docs test"
package-manager: "pip"
# Test extras prefix
- install-groups: "extras: docs"
package-manager: "uv"
- install-groups: "extras: docs"
package-manager: "pip"
# Test mixed
- install-groups: "groups: docs, extras: aws"
package-manager: "uv"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-custom-configuration/pyproject.toml .
cp tests/data/mkdocs-deploy/test-custom-configuration/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-custom-configuration/uv.lock .
cp -r tests/data/mkdocs-deploy/test-custom-configuration/docs .
- name: Test install-groups format "${{ matrix.install-groups }}"
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
install-groups: ${{ matrix.install-groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify format parsing
run: |
echo "install-groups format test completed: ${{ matrix.install-groups }}"