Update cairosvg and pillow dependencies in pyproject.toml for compati… #140
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: Build and Deploy MkDocs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check initial disk space | |
run: df -h | |
- name: Set up Python | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Disk space after python setup, before apt install | |
run: | | |
echo "Disk space after python setup:" | |
df -h | |
- name: Cache and install system dependencies for social cards | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev | |
version: 1.0 | |
- name: Disk space after apt install | |
run: | | |
echo "Disk space after apt install:" | |
df -h | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: latest | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Free up disk space | |
run: | | |
echo "Disk space before cleanup:" | |
df -h | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /opt/ghc | |
echo "Disk space after cleanup:" | |
df -h | |
- name: Cache Poetry cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry | |
key: poetry-cache-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: | | |
poetry-cache-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}- | |
- name: Install dependencies | |
run: | | |
poetry cache clear . --all -n | |
poetry config installer.parallel true | |
poetry install --only dev --no-root | |
- name: Check disk space and artifact sizes after install | |
run: | | |
echo "Disk space after installing dependencies:" | |
df -h | |
echo "Size of installed packages:" | |
du -sh .venv | |
echo "Size of Poetry cache:" | |
du -sh ~/.cache/pypoetry | |
- name: Optimize images for web | |
run: | | |
poetry run python tools/optimize_images.py --quality 75 --max-width 1600 --max-height 900 --overwrite | |
- name: Build MkDocs site | |
env: | |
JUPYTER_PLATFORM_DIRS: 1 # Suppress Jupyter deprecation warnings | |
run: | | |
poetry run mkdocs build --strict --verbose | |
- name: Check disk space after site build | |
run: | | |
echo "Disk space after building site:" | |
df -h | |
echo "Size of generated site:" | |
du -sh site | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./site | |
cname: pytorchcourse.com |