name: CI Pipeline on: push: branches: [main] pull_request: branches: [main] jobs: build-ubuntu-no-optional-dependencies: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.10", 3.13] steps: - name: Check out code uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install from source and install pytest run: | python -m pip install --upgrade pip python -m pip install -e . python -m pip install pytest lxml requests - name: Run tests with pytest (no matplotlib, no pandas) run: | pytest tests/test_rendering_markdown.py::test_markdown_styling pytest tests/test_rendering_markdown.py::test_markdown_table - name: Install matplotlib run: | python -m pip install matplotlib - name: Run tests with pytest rendering equations (with matplotlib) run: | pytest tests/test_rendering_markdown.py::test_markdown_equations build-ubuntu: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.10", 3.13] steps: - name: Check out code uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install LaTeX run: sudo apt-get install -y texlive-latex-extra texlive-fonts-recommended lmodern texlive-xetex texlive-science - name: Install Python dependencies run: | python -m pip install --upgrade pip python -m pip install -e .[dev] - name: Lint code with flake8 run: flake8 - name: Type checking with mypy run: mypy - name: Run tests with pytest run: pytest - name: Upload rendered files uses: actions/upload-artifact@v4 if: strategy.job-index == 0 with: name: rendering-results-ubuntu path: tests/out/test_*_render* build-windows: runs-on: windows-latest strategy: matrix: python-version: ["3.10"] steps: - name: Check out code uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip' - name: Cache MiKTeX Portable uses: actions/cache@v4 id: miktex with: path: C:\tmp\cache key: miktex-portable-${{ runner.os }}-24.1-x64 - if: ${{ steps.miktex.outputs.cache-hit != 'true' }} name: Set up MiKTeX Portable run: | $ProgressPreference = 'SilentlyContinue' Invoke-WebRequest https://www.nonan.net/w/files/miktex-portable-Win-x64.zip -OutFile miktex-portable-Win-x64.zip Expand-Archive miktex-portable-Win-x64.zip -DestinationPath C:\tmp\cache\ - name: Copy miktex directory run: | robocopy C:\tmp\cache\miktex-portable C:\tmp\test_miktex\miktex-portable /E /NFL /NDL if ($LASTEXITCODE -eq 1) { exit 0 } - name: Add miktex to PATH run: | echo "PATH=$PATH;C:\tmp\test_miktex\miktex-portable\texmfs\install\miktex\bin\x64;C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_ENV -Append - name: test xelatex run: xelatex --version - name: Install Python dependencies run: | python -m pip install -e .[dev] - name: Run tests with pytest run: pytest - name: Upload rendered files uses: actions/upload-artifact@v4 if: strategy.job-index == 0 with: name: rendering-results-windows path: tests/out/test_*_render*.pdf build-docs: if: github.event_name == 'push' needs: build-ubuntu runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Download rendering outputs uses: actions/download-artifact@v4 with: name: rendering-results-ubuntu path: docs/build/html/files/ - name: Set up Python uses: actions/setup-python@v3 with: python-version: "3.x" - name: Install package and dependencies run: pip install .[doc_build] - name: Generate Class List run: python ./docs/source/generate_class_list.py - name: Build Docs run: | mkdir -p docs/source/media cp media/* docs/source/media/ mkdir -p docs/source/tests cp tests/test_rendering_example*.py docs/source/tests/ cp LICENSE docs/source/LICENSE.md cd docs sphinx-apidoc -o source/ ../src/ -M --no-toc rm ./source/*.rst make html touch ./build/html/.nojekyll mkdir -p ./build/html/_autogenerated cp ./build/html/api/* ./build/html/_autogenerated/ - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: docs/build/html deploy: if: github.event_name == 'push' needs: build-docs runs-on: ubuntu-latest permissions: contents: read pages: write id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4