Skip to content

Commit

Permalink
Moves documentation to GH pages (#13)
Browse files Browse the repository at this point in the history
* Added doc workflow

* Updated README.md

* Changed Doc workflow

* Remove RTD hook

* Fix Doc workflow

* Install dependencies

* Bug fix
  • Loading branch information
craabreu committed Dec 11, 2023
1 parent 3e0deb6 commit 99c2e63
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 28 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/Doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Doc

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"

jobs:
unix:
runs-on: macos-11
name: Doc (Python ${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.10"

steps:
- name: "Check out"
uses: actions/checkout@v3

- name: "Install SDK on MacOS"
run: source devtools/scripts/install_macos_sdk.sh

- name: "Update the conda enviroment file"
uses: cschleiden/replace-tokens@v1
with:
tokenPrefix: '@'
tokenSuffix: '@'
files: devtools/conda-envs/build-macos-11.yml

- uses: conda-incubator/setup-miniconda@v2
name: "Install dependencies with conda"
with:
activate-environment: build
environment-file: devtools/conda-envs/build-doc.yml
python-version: ${{ matrix.python-version }}

- name: "List conda packages"
shell: bash -l {0}
run: conda list

- name: "Configure"
shell: bash -l {0}
run: |
mkdir build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DPLUGIN_BUILD_CUDA_LIB=OFF
- name: "Build"
shell: bash -l {0}
run: |
cd build
make -j2 install
make -j2 PythonInstall
- name: Build Documentation
shell: bash -l {0}
run: |
sphinx-build ./docs ./html
- name: Deploy documentation
shell: bash -l {0}
run: |
git reset --hard HEAD
set -x
echo "::group::Push page to gh-pages branch"
git config user.name "$(git show --format=%an -s)"
git config user.email "$(git show --format=%ae -s)"
git fetch origin
git switch gh-pages
rsync -va --delete-excluded html/ docs/
touch docs/.nojekyll
git add -f docs/*
git add -f docs/.nojekyll
git commit -m "Docs from $GITHUB_REF $GITHUB_SHA" || echo "Branch is up to date"
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
echo "Deployment is deactivated on pull requests"
else
git push -f origin gh-pages
fi
echo "::endgroup::"
23 changes: 0 additions & 23 deletions .readthedocs.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
OpenMM Nonbonded Slicing Plugin
===============================

[![GH Actions Status](https://github.com/craabreu/openmm-nonbonded-slicing/workflows/Linux/badge.svg)](https://github.com/craabreu/openmm-nonbonded-slicing/actions?query=branch%3Amain+workflow%3ALinux)
[![GH Actions Status](https://github.com/craabreu/openmm-nonbonded-slicing/workflows/MacOS/badge.svg)](https://github.com/craabreu/openmm-nonbonded-slicing/actions?query=branch%3Amain+workflow%3AMacOS)
[![Documentation Status](https://readthedocs.org/projects/openmm-nonbonded-slicing/badge/?version=latest)](https://openmm-nonbonded-slicing.readthedocs.io/en/latest/?badge=latest)
[![Linux](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/Linux.yml/badge.svg)](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/Linux.yml)
[![MacOS](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/MacOS.yml/badge.svg)](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/MacOS.yml)
[![Doc](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/Doc.yml/badge.svg)](https://github.com/craabreu/openmm-nonbonded-slicing/actions/workflows/Doc.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

This [OpenMM] plugin contains the **SlicedNonbondedForce** class, a variant of OpenMM's [NonbondedForce].
Expand All @@ -26,8 +26,8 @@ slice contributions or sums thereof via [getState] with option `getParameterDeri
Documentation
=============

A complete documentation for this plugin, including its Python API and the theory behind energy
slicing is available [here](https://openmm-nonbonded-slicing.readthedocs.io/en/stable).
Documentation for this plugin is available at [Github Pages](https://craabreu.github.io/openmm-nonbonded-slicing/).
It includes the Python API and the theory for slicing lattice-sum energy contributions.

Installing from Source
======================
Expand Down
20 changes: 20 additions & 0 deletions devtools/conda-envs/build-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: build
channels:
- conda-forge
dependencies:
- cmake
- compilers
- khronos-opencl-icd-loader
- make
- openmm >=7.7
- pip >=22.2
- pocl
- pytest
- python
- swig =4.0
- numpy

# Docs depends
- sphinx
- sphinxcontrib-bibtex
- sphinx-copybutton
5 changes: 5 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def create_rst_file(cls):
'sphinx.ext.todo',
'sphinx.ext.mathjax',
'sphinxcontrib.bibtex',
'sphinx_copybutton',
]
if os.getenv('SPELLCHECK'):
extensions += 'sphinxcontrib.spelling',
Expand Down Expand Up @@ -117,3 +118,7 @@ def setup(app):
# External links
extlinks = {'OpenMM': ('http://docs.openmm.org/latest/api-python/generated/openmm.openmm.%s.html',
'openmm.%s')}

# Copy button configuration
copybutton_prompt_text = r">>> |\.\.\. "
copybutton_prompt_is_regexp = True

0 comments on commit 99c2e63

Please sign in to comment.