Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to GitHubPages #35

Merged
merged 8 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy Sphinx documentation to Pages

on:
push:
branches: ["main"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(optional) we could start having a release branch that points to current release on pip / conda. that way docs match the thing people download instead of dev version in the repo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point 👍, could be done together with the JOSS-paper release/ as soon as the changes from #31 are merged


env:
GITHUB_PAGES_BUILD: True

jobs:
pages:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- id: dependencies
run: |
sudo apt-get update
sudo apt-get install -y doxygen
- id: deployment
uses: sphinx-notes/pages@v3
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# polyhedral-gravity-model

![Build and Test](https://github.com/schuhmaj/polyhedral-gravity-model-cpp/actions/workflows/ctest.yml/badge.svg)
[![Documentation Status](https://readthedocs.org/projects/polyhedral-gravity-model-cpp/badge/?version=stable)](https://polyhedral-gravity-model-cpp.readthedocs.io/en/stable/?badge=stable)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/esa/polyhedral-gravity-model/.github%2Fworkflows%2Fbuild-and-test.yml?label=Build%20and%20Test)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/esa/polyhedral-gravity-model/.github%2Fworkflows%2Fdocs.yml?logo=GitBook&label=Documentation)
![GitHub](https://img.shields.io/github/license/esa/polyhedral-gravity-model)

![PyPI](https://img.shields.io/pypi/v/polyhedral-gravity)
Expand Down
76 changes: 54 additions & 22 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,62 +20,94 @@


def configure_doxyfile(input_dir, output_dir):
with open('Doxyfile.in', 'r') as file:
with open("Doxyfile.in", "r") as file:
filedata = file.read()

filedata = filedata.replace('@DOXYGEN_INPUT_DIR@', input_dir)
filedata = filedata.replace('@DOXYGEN_OUTPUT_DIR@', output_dir)
filedata = filedata.replace("@DOXYGEN_INPUT_DIR@", input_dir)
filedata = filedata.replace("@DOXYGEN_OUTPUT_DIR@", output_dir)

with open('Doxyfile', 'w') as file:
with open("Doxyfile", "w") as file:
file.write(filedata)


# Check if we're running on Read the Docs' servers
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'

# Check if we're running on Read the Docs' servers or in the GitHub Actions Workflow
breathe_projects = {}
if read_the_docs_build:
input_dir = '../src'
output_dir = 'build'
if os.environ.get("READTHEDOCS", None) is not None or os.environ.get("GITHUB_PAGES_BUILD", None) is not None:
input_dir = "../src"
output_dir = "build"
configure_doxyfile(input_dir, output_dir)
subprocess.call('doxygen', shell=True)
breathe_projects['polyhedral-gravity-model'] = output_dir + '/xml'
subprocess.call("doxygen", shell=True)
breathe_projects["polyhedral-gravity-model"] = output_dir + "/xml"

# -- Project information -----------------------------------------------------

project = 'Polyhedral Gravity Model'
copyright = '2022, Jonas Schuhmacher'
author = 'Jonas Schuhmacher'
project = "Polyhedral Gravity Model"
copyright = "2024, Jonas Schuhmacher"
author = "Jonas Schuhmacher"

# -- 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 = [
"breathe"
]
extensions = ["breathe"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
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 = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- 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'
html_theme = "sphinx_book_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_static_path = ["_static"]

# Breathe Configuration
breathe_default_project = "polyhedral-gravity-model"
breathe_default_members = ("members", "undoc-members")

# -- Options for Theme 'sphinx_book_theme' -----------------------------------
# https://sphinx-book-theme.readthedocs.io/en/latest/tutorials/get-started.html
html_theme_options = {
"use_edit_page_button": True,
"use_source_button": True,
"use_issues_button": True,
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/esa/polyhedral-gravity-model",
"icon": "fa-brands fa-square-github",
"type": "fontawesome",
},
{
"name": "Conda Forge",
"url": "https://anaconda.org/conda-forge/polyhedral-gravity-model",
"icon": "https://img.shields.io/conda/v/conda-forge/polyhedral-gravity-model",
"type": "url",
},
{
"name": "PyPi",
"url": "https://pypi.org/project/polyhedral-gravity/",
"icon": "https://img.shields.io/pypi/v/polyhedral-gravity",
"type": "url",
},
],
}

html_context = {
"github_url": "https://github.com",
"github_user": "esa",
"github_repo": "polyhedral-gravity-model",
"github_version": "main",
"doc_path": "docs",
}
3 changes: 2 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
breathe
breathe
sphinx-book-theme
Loading