Skip to content

Commit

Permalink
Merge pull request #161 from ReactionMechanismGenerator/doc_deploy
Browse files Browse the repository at this point in the history
Auto documentation deployment
  • Loading branch information
alongd committed Aug 3, 2019
2 parents 9fe3f5c + 5043241 commit 13ad2f2
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 26 deletions.
75 changes: 54 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ language: python
python:
- "2.7"

stages:
- test
- name: documentation
if: branch = master AND type = push

before_install:
- cd ..
# Install miniconda
Expand All @@ -17,25 +22,53 @@ before_install:
- git config --global user.email "alongd@mit.edu"

cache: pip
install:
- cd ARC
- conda env create -q -f environment.yml
- source activate arc_env
- cd ..
- git clone https://github.com/ReactionMechanismGenerator/RMG-Py
- cd RMG-Py
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- make
- cd ..
- git clone https://github.com/ReactionMechanismGenerator/RMG-database
- git clone https://github.com/alongd/AutoTST
- cd AutoTST
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- cd ..
- conda install -y -c conda-forge codecov
- conda list
- cd ARC

script:
- make test
- codecov --token=f259713a-7f1d-4e9c-b140-bb3bb371d3ef
jobs:
include:
- stage: test
install:
- cd ARC
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- conda env create -q -f environment.yml
- source activate arc_env
- cd ..
- git clone https://github.com/ReactionMechanismGenerator/RMG-Py
- cd RMG-Py
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- make
- cd ..
- git clone https://github.com/ReactionMechanismGenerator/RMG-database
- git clone https://github.com/alongd/AutoTST
- cd AutoTST
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- cd ..
- conda install -y -c conda-forge codecov
- conda list
- cd ARC
script:
- make test
- codecov --token=f259713a-7f1d-4e9c-b140-bb3bb371d3ef
- stage: documentation
install:
- cd ARC
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- conda env create -q -f environment.yml
- source activate arc_env
- cd ..
- git clone https://github.com/ReactionMechanismGenerator/RMG-Py
- cd RMG-Py
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- make
- cd ..
- git clone https://github.com/ReactionMechanismGenerator/RMG-database
- git clone https://github.com/alongd/AutoTST
- cd AutoTST
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- cd ../ARC/docs
# Install sphinx for building the documentation
- conda install -y sphinx
- conda install -y -c anaconda sphinx_rtd_theme
- conda list
- export COMMITMESSAGE="Automatic documentation rebuild"
script:
- make travis_setup clean html publish
40 changes: 35 additions & 5 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,45 @@
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = source
PAPER =
BUILDDIR = build

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
#ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) source

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile
.PHONY: clean html publish travis_setup

travis_setup:
# This target is intended to be used when automatically compiling documentation with Travis
@rm -rf $(BUILDDIR)/html
@git clone --single-branch --branch gh-pages --origin official https://${GH_TOKEN}@github.com/ReactionMechanismGenerator/ARC.git $(BUILDDIR)/html

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

clean:
# set aside the git repository info used to push pages to github
mkdir build_temp
mv $(BUILDDIR)/html/.git build_temp/.git
-rm -rf $(BUILDDIR)/*
mkdir $(BUILDDIR)/html
mv build_temp/.git $(BUILDDIR)/html/
rm -rf build_temp

# 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)
publish: $(BUILDDIR)/html/.git
# Commit changes to gh-pages and push to github, to publish the results!
touch $(BUILDDIR)/html/.nojekyll
ifdef COMMITMESSAGE # Use the provided COMMITMESSAGE variable for noninteractive use.
cd $(BUILDDIR)/html; git add -A .; git commit -m "$(COMMITMESSAGE)"; git push official gh-pages
else # Prompt for a commit message
cd $(BUILDDIR)/html; git add -A .; git commit; git push official gh-pages
endif

0 comments on commit 13ad2f2

Please sign in to comment.