docs-pr.yaml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. name: Prepare documentation PR preview
  2. on:
  3. pull_request:
  4. paths:
  5. - docs/**
  6. - book.toml
  7. - .github/workflows/docs-pr.yaml
  8. - scripts-dev/schema_versions.py
  9. jobs:
  10. pages:
  11. name: GitHub Pages
  12. runs-on: ubuntu-latest
  13. steps:
  14. - uses: actions/checkout@v4
  15. with:
  16. # Fetch all history so that the schema_versions script works.
  17. fetch-depth: 0
  18. - name: Setup mdbook
  19. uses: peaceiris/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
  20. with:
  21. mdbook-version: '0.4.17'
  22. - name: Setup python
  23. uses: actions/setup-python@v4
  24. with:
  25. python-version: "3.x"
  26. - run: "pip install 'packaging>=20.0' 'GitPython>=3.1.20'"
  27. - name: Build the documentation
  28. # mdbook will only create an index.html if we're including docs/README.md in SUMMARY.md.
  29. # However, we're using docs/README.md for other purposes and need to pick a new page
  30. # as the default. Let's opt for the welcome page instead.
  31. run: |
  32. mdbook build
  33. cp book/welcome_and_overview.html book/index.html
  34. - name: Upload Artifact
  35. uses: actions/upload-artifact@v3
  36. with:
  37. name: book
  38. path: book
  39. # We'll only use this in a workflow_run, then we're done with it
  40. retention-days: 1
  41. link-check:
  42. name: Check links in documentation
  43. runs-on: ubuntu-latest
  44. steps:
  45. - uses: actions/checkout@v4
  46. - name: Setup mdbook
  47. uses: peaceiris/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
  48. with:
  49. mdbook-version: '0.4.17'
  50. - name: Setup htmltest
  51. run: |
  52. wget https://github.com/wjdp/htmltest/releases/download/v0.17.0/htmltest_0.17.0_linux_amd64.tar.gz
  53. echo '775c597ee74899d6002cd2d93076f897f4ba68686bceabe2e5d72e84c57bc0fb htmltest_0.17.0_linux_amd64.tar.gz' | sha256sum -c
  54. tar zxf htmltest_0.17.0_linux_amd64.tar.gz
  55. - name: Test links with htmltest
  56. # Build the book with `./` as the site URL (to make checks on 404.html possible)
  57. # Then run htmltest (without checking external links since that involves the network and is slow).
  58. run: |
  59. MDBOOK_OUTPUT__HTML__SITE_URL="./" mdbook build
  60. ./htmltest book --skip-external