v1.0.8 updates: stronger cache system, more tools, better testing system #59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy ToolUniverse Documentation | |
| on: | |
| push: | |
| branches: [main, master] | |
| paths: | |
| - 'docs/**' | |
| - 'src/**' | |
| - 'pyproject.toml' | |
| - '.github/workflows/deploy-docs.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 # Shallow clone for faster checkout | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Cache Sphinx build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| docs/_build/doctrees | |
| docs/api | |
| key: sphinx-${{ runner.os }}-${{ hashFiles('docs/**/*.rst', 'docs/**/*.py', 'src/**/*.py', 'pyproject.toml') }} | |
| restore-keys: | | |
| sphinx-${{ runner.os }}- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip uv | |
| # Use uv for faster installation | |
| uv pip install --system -e .[docs] | |
| - name: Verify documentation setup | |
| run: | | |
| echo "π Verifying Sphinx and theme installation..." | |
| python -c "import sphinx; print(f'β Sphinx {sphinx.__version__}')" | |
| python -c "import shibuya; print('β Shibuya theme available')" | |
| python -c "import shibuya; print('β Shibuya theme available')" | |
| python -c "from linkify_it import LinkifyIt; print('β Linkify available')" | |
| - name: Prepare assets | |
| run: | | |
| cd docs | |
| mkdir -p _static | |
| if [ -f "../img/tooluniverse_logo.png" ]; then | |
| cp ../img/tooluniverse_logo.png _static/ | |
| echo "β Logo prepared" | |
| fi | |
| - name: Build documentation | |
| run: | | |
| cd docs | |
| # Skip dependency installation in script (already done above) | |
| # Use optimized API doc generation settings | |
| echo "π¨ Building documentation with optimized settings..." | |
| DOC_LANGUAGES="en,zh_CN" \ | |
| DOC_SKIP_SERVER_PROMPT=1 \ | |
| DOC_SKIP_INSTALL=1 \ | |
| DOC_OPTIMIZED=1 \ | |
| ./quick_doc_build.sh | |
| - name: Check build output | |
| run: | | |
| if [ ! -f docs/_build/html/index.html ]; then | |
| echo "β Root index.html not found!" | |
| exit 1 | |
| fi | |
| echo "β Documentation built successfully" | |
| du -sh docs/_build/html | |
| - name: Add .nojekyll file | |
| run: | | |
| touch docs/_build/html/.nojekyll | |
| # Note: Do NOT create a CNAME here. This project is served under | |
| # https://zitniklab.hms.harvard.edu/ToolUniverse/. | |
| # Adding a CNAME would incorrectly claim the root domain. | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './docs/_build/html' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| test-deployment: | |
| runs-on: ubuntu-latest | |
| needs: build-and-deploy | |
| if: always() | |
| steps: | |
| - name: Report deployment status | |
| run: | | |
| if [[ "${{ needs.build-and-deploy.result }}" == "success" ]]; then | |
| echo "β Documentation deployment successful!" | |
| echo "π¨ Modern theme with enhanced styling applied" | |
| echo "π Documentation available at: https://zitniklab.hms.harvard.edu/ToolUniverse/" | |
| echo " β’ Root (auto-redirects to English): https://zitniklab.hms.harvard.edu/ToolUniverse/" | |
| echo " β’ English: https://zitniklab.hms.harvard.edu/ToolUniverse/en/" | |
| echo " β’ Chinese: https://zitniklab.hms.harvard.edu/ToolUniverse/zh-CN/" | |
| echo " β’ English API: https://zitniklab.hms.harvard.edu/ToolUniverse/en/api/modules.html" | |
| echo " β’ Chinese API: https://zitniklab.hms.harvard.edu/ToolUniverse/zh-CN/api/modules.html" | |
| echo "π Features:" | |
| echo " β’ Multi-language support with automatic redirects" | |
| echo " β’ Backward compatibility with old /en/ links" | |
| echo " β’ Language switcher in navigation bar" | |
| echo " β’ Modern responsive design" | |
| echo " β’ Dark/light mode support (if Furo theme)" | |
| echo " β’ Enhanced code highlighting" | |
| echo " β’ Improved navigation" | |
| else | |
| echo "β Documentation deployment failed!" | |
| echo "Build status: ${{ needs.build-and-deploy.result }}" | |
| echo "π Common issues:" | |
| echo " β’ Missing theme dependencies (run: pip install -r docs/requirements_ci.txt)" | |
| echo " β’ Theme compatibility problems (check .. contents:: directives)" | |
| echo " β’ Configuration errors (verify conf*.py files)" | |
| echo "π‘ Check the build logs for specific error messages" | |
| exit 1 | |
| fi |