Skip to content

remove old print statement #285

remove old print statement

remove old print statement #285

Workflow file for this run

name: sphinx
on:
push:
branches:
- main
workflow_dispatch:
env:
DEFAULT_BRANCH: "main"
jobs:
build-and-deploy:
name: Build and gh-pages
runs-on: ubuntu-24.04
steps:
# https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
# - name: Install CUDA
# uses: Jimver/[email protected]
# id: cuda-toolkit
# with:
# cuda: '11.2.2'
# Set up Python
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
# Install Pandoc and xelatex engine
- name: Install Pandoc and xelatex
run: |
sudo apt-get update
sudo apt-get install -y pandoc texlive-xetex texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra librsvg2-bin
- name: Set up uv
# Install latest uv version using the installer
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install the project
run: uv sync --extra docs
- name: Debugging information
run: |
echo "github.ref:" ${{github.ref}}
echo "github.event_name:" ${{github.event_name}}
echo "github.head_ref:" ${{github.head_ref}}
echo "github.base_ref:" ${{github.base_ref}}
set -x
git rev-parse --abbrev-ref HEAD
git branch
git branch -a
git remote -v
python -V
pip list --not-required
pip list
# Build Sphinx documentation
- uses: ammaraskar/sphinx-problem-matcher@master
- name: Build Sphinx docs
run: |
cd docs
mkdir -p _build
uv run make html
- uses: actions/upload-artifact@v4
if: failure()
with:
name: run_logs
path: /tmp/sphinx-err-*.log
# The following supports building all branches and combining on
# gh-pages
# Clone and set up the old gh-pages branch
- name: Clone old gh-pages
run: |
set -x
git fetch
( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages
rm -rf _gh-pages/.git/
mkdir -p _gh-pages/branch/
# If a push and default branch, copy build to _gh-pages/ as the "main"
# deployment.
- name: Copy new build (default branch)
if: |
contains(github.ref, env.DEFAULT_BRANCH)
run: |
set -x
# Delete everything under _gh-pages/ that is from the
# primary branch deployment. Eicludes the other branches
# _gh-pages/branch-* paths, and not including
# _gh-pages itself.
find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' -delete
rsync -a docs/_build/html/ _gh-pages/
# If a push and not on default branch, then copy the build to
# _gh-pages/branch/$brname (transforming '/' into '--')
- name: Copy new build (branch)
if: |
!contains(github.ref, env.DEFAULT_BRANCH)
run: |
set -x
#brname=$(git rev-parse --abbrev-ref HEAD)
brname="${{github.ref}}"
brname="${brname##refs/heads/}"
brdir=${brname//\//--} # replace '/' with '--'
rm -rf _gh-pages/branch/${brdir}
rsync -a _build/dirhtml/ _gh-pages/branch/${brdir}
# Go through each branch in _gh-pages/branch/, if it's not a
# ref, then delete it.
- name: Delete old feature branches
run: |
set -x
for brdir in `ls _gh-pages/branch/` ; do
brname=${brdir//--/\/} # replace '--' with '/'
if ! git show-ref remotes/origin/$brname ; then
echo "Removing $brdir"
rm -r _gh-pages/branch/$brdir/
fi
done
# Add the .nojekyll file
- name: nojekyll
run: |
touch _gh-pages/.nojekyll
# Deploy
# https://github.com/peaceiris/actions-gh-pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _gh-pages/
force_orphan: true