generated from coderefinery/TTT4HPC_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 379831c
Showing
10 changed files
with
528 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
# From: https://github.com/rkdarst/sphinx-actions-test/blob/master/.github/workflows/sphinx-build.yml | ||
|
||
name: sphinx | ||
on: [push, pull_request] | ||
|
||
env: | ||
DEFAULT_BRANCH: "main" | ||
#SPHINXOPTS: "-W --keep-going -T" | ||
# ^-- If these SPHINXOPTS are enabled, then be strict about the builds and fail on any warnings | ||
|
||
jobs: | ||
build-and-deploy: | ||
name: Build and gh-pages | ||
runs-on: ubuntu-latest | ||
steps: | ||
# https://github.com/marketplace/actions/checkout | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
lfs: true | ||
# https://github.com/marketplace/actions/setup-python | ||
# ^-- This gives info on matrix testing. | ||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
# https://docs.github.com/en/actions/guides/building-and-testing-python#caching-dependencies | ||
# ^-- How to set up caching for pip on Ubuntu | ||
- name: Cache pip | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
# https://docs.github.com/en/actions/guides/building-and-testing-python#installing-dependencies | ||
# ^-- This gives info on installing dependencies with pip | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- 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 | ||
- uses: ammaraskar/sphinx-problem-matcher@master | ||
- name: Build Sphinx docs | ||
run: | | ||
make dirhtml | ||
# This fixes broken copy button icons, as explained in | ||
# https://github.com/coderefinery/sphinx-lesson/issues/50 | ||
# https://github.com/executablebooks/sphinx-copybutton/issues/110 | ||
# This can be removed once these PRs are accepted (but the | ||
# fixes also need to propagate to other themes): | ||
# https://github.com/sphinx-doc/sphinx/pull/8524 | ||
# https://github.com/readthedocs/sphinx_rtd_theme/pull/1025 | ||
sed -i 's/url_root="#"/url_root=""/' _build/dirhtml/index.html || true | ||
# 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 | ||
if: ${{ github.event_name == 'push' }} | ||
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.event_name, 'push') && | ||
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 _build/dirhtml/ _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.event_name, 'push') && | ||
!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 | ||
if: ${{ github.event_name == 'push' }} | ||
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 | ||
if: ${{ github.event_name == 'push' }} | ||
run: | | ||
touch _gh-pages/.nojekyll | ||
# Deploy | ||
# https://github.com/peaceiris/actions-gh-pages | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.event_name == 'push' }} | ||
#if: ${{ success() && github.event_name == 'push' && github.ref == 'refs/heads/$defaultBranch' }} | ||
with: | ||
publish_branch: gh-pages | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: _gh-pages/ | ||
force_orphan: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/_build | ||
.ipynb_checkpoints | ||
/venv* | ||
.jupyter_cache | ||
jupyter_execute |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = content | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
# Live reload site documents for local development | ||
livehtml: | ||
sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
# import os | ||
# import sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "Real-life compute cluster workflows" | ||
copyright = "2022-, The contributors" | ||
author = "The contributors" | ||
github_user = "coderefinery" | ||
github_repo_name = "" # auto-detected from dirname if blank | ||
github_version = "main" | ||
conf_py_path = "/content/" # with leading and trailing slash | ||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
# githubpages just adds a .nojekyll file | ||
"sphinx.ext.githubpages", | ||
"sphinx_lesson", | ||
# remove once sphinx_rtd_theme updated for contrast and accessibility: | ||
"sphinx_rtd_theme_ext_color_contrast", | ||
"sphinx_coderefinery_branding", | ||
] | ||
|
||
# Settings for myst_nb: | ||
# https://myst-nb.readthedocs.io/en/latest/use/execute.html#triggering-notebook-execution | ||
# jupyter_execute_notebooks = "off" | ||
# jupyter_execute_notebooks = "auto" # *only* execute if at least one output is missing. | ||
# jupyter_execute_notebooks = "force" | ||
nb_execution_mode = "cache" | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
# templates_path = ['_templates'] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = [ | ||
"README*", | ||
"_build", | ||
"Thumbs.db", | ||
".DS_Store", | ||
"jupyter_execute", | ||
"*venv*", | ||
] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = "sphinx_rtd_theme" | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
# html_static_path = ['_static'] | ||
|
||
|
||
# HTML context: | ||
from os.path import basename, dirname, realpath | ||
|
||
html_context = { | ||
"display_github": True, | ||
"github_user": github_user, | ||
# Auto-detect directory name. This can break, but | ||
# useful as a default. | ||
"github_repo": github_repo_name or basename(dirname(realpath(__file__))), | ||
"github_version": github_version, | ||
"conf_py_path": conf_py_path, | ||
} | ||
|
||
# Intersphinx mapping. For example, with this you can use | ||
# :py:mod:`multiprocessing` to link straight to the Python docs of that module. | ||
# List all available references: | ||
# python -msphinx.ext.intersphinx https://docs.python.org/3/objects.inv | ||
# extensions.append('sphinx.ext.intersphinx') | ||
# intersphinx_mapping = { | ||
# #'python': ('https://docs.python.org/3', None), | ||
# #'sphinx': ('https://www.sphinx-doc.org/', None), | ||
# #'numpy': ('https://numpy.org/doc/stable/', None), | ||
# #'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None), | ||
# #'pandas': ('https://pandas.pydata.org/docs/', None), | ||
# #'matplotlib': ('https://matplotlib.org/', None), | ||
# 'seaborn': ('https://seaborn.pydata.org/', None), | ||
# } |
Oops, something went wrong.