docs.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: Docs
  2. on:
  3. pull_request:
  4. paths:
  5. - 'docs/**'
  6. - '.github/workflows/docs.yml'
  7. push:
  8. branches:
  9. - main
  10. paths:
  11. - 'docs/**'
  12. - '.github/workflows/docs.yml'
  13. concurrency:
  14. group: ${{ github.workflow }}-${{ github.ref }}
  15. cancel-in-progress: true
  16. permissions:
  17. contents: read
  18. jobs:
  19. docs:
  20. # OS must be the same as on djangoproject.com.
  21. runs-on: ubuntu-20.04
  22. name: docs
  23. steps:
  24. - name: Checkout
  25. uses: actions/checkout@v4
  26. - name: Set up Python
  27. uses: actions/setup-python@v4
  28. with:
  29. python-version: '3.12'
  30. cache: 'pip'
  31. cache-dependency-path: 'docs/requirements.txt'
  32. - run: python -m pip install -r docs/requirements.txt
  33. - name: Build docs
  34. run: |
  35. cd docs
  36. sphinx-build -b spelling -n -q -W --keep-going -d _build/doctrees -D language=en_US -j auto . _build/spelling
  37. blacken-docs:
  38. runs-on: ubuntu-latest
  39. name: blacken-docs
  40. steps:
  41. - name: Checkout
  42. uses: actions/checkout@v4
  43. - name: Set up Python
  44. uses: actions/setup-python@v4
  45. with:
  46. python-version: '3.12'
  47. - run: python -m pip install blacken-docs
  48. - name: Build docs
  49. run: |
  50. cd docs
  51. make black
  52. RESULT=`cat _build/black/output.txt`
  53. if [ "$RESULT" -gt 0 ]; then
  54. echo "💥 📢 Code blocks in documentation must be reformatted with blacken-docs 📢 💥"
  55. fi;
  56. exit $RESULT