From b877b98fee9d591113c53fc4dec49a0c3ad5ab59 Mon Sep 17 00:00:00 2001 From: Stefan Seefeld Date: Fri, 5 Aug 2016 12:16:28 -0400 Subject: [PATCH] Automate documentation updates. --- .ci/upload_docs.sh | 39 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 29 ++++++++++++++++++++--------- 2 files changed, 59 insertions(+), 9 deletions(-) create mode 100755 .ci/upload_docs.sh diff --git a/.ci/upload_docs.sh b/.ci/upload_docs.sh new file mode 100755 index 00000000..e277b294 --- /dev/null +++ b/.ci/upload_docs.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -e # Exit with nonzero exit code if anything fails + +SOURCE_BRANCH="master" +TARGET_BRANCH="gh-pages" + +# Pull requests and commits to other branches shouldn't try to deploy, just build to verify +if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ "$TRAVIS_BRANCH" != master -a "$TRAVIS_BRANCH" != develop ]; then + echo "No docs to upload." + exit 0 +fi + +# Save some useful information +REPO=`git config remote.origin.url` +SHA=`git rev-parse --verify HEAD` + +# bin.SCons happens to contain the "doc/html" tree that we want to push +# into the gh-pages branch. So we step into that directory, create a new repo, +# set the remote appropriately, then commit and push. +cd bin.SCons +git init +git config user.name "Travis CI" +git config user.email "$COMMIT_AUTHOR_EMAIL" + +# Make sure 'GH_TOKEN' is set (as 'secure' variable) in .travis.yml +git remote add upstream "https://$GH_TOKEN@github.com/boostorg/python.git" +git fetch upstream +git reset upstream/gh-pages + +# Commit the new version. +cp ../index.html . +cp ../doc/index.html doc/ +git add index.html +git add doc/index.html +git add -A doc/html +git commit -m "Deploy to GitHub Pages: ${SHA}" + +# Now that we're all set up, we can push. +git push -q upstream HEAD:gh-pages diff --git a/.travis.yml b/.travis.yml index 0f528684..190eb043 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -# -*- python -*- # # Copyright (c) 2016 Stefan Seefeld # All rights reserved. @@ -7,18 +6,24 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +sudo: required +dist: trusty + language: cpp env: -- PYTHON=python CCFLAGS=-std=c++98 -- PYTHON=python CCFLAGS=-std=c++11 -- PYTHON=python3 CCFLAGS=-std=c++98 -- PYTHON=python3 CCFLAGS=-std=c++11 + matrix: + - PYTHON=python CCFLAGS=-std=c++98 + - PYTHON=python CCFLAGS=-std=c++11 + - PYTHON=python3 CCFLAGS=-std=c++98 + - PYTHON=python3 CCFLAGS=-std=c++11 + - PYTHON=python DOC=1 + global: + - secure: mqoxglbUN/At/r8O7nLVccGldnB1jvhLHNyYjfCXrdOD0GNX+TY2TS1+kIEv9Deg/P6X/QvrBa/ZzbDNryn3mDXBfOSy400ebSIUHHP3HtGHJShOGDyXedY3hZ/dqmxdV3p9hIxv4lcx1HPyC96s4wpiR0S9F1JBzD6scIabezM= compiler: - gcc - addons: apt: sources: @@ -30,12 +35,18 @@ addons: - python-dev python-pip - python3-dev - libboost-all-dev - + - xsltproc + - python-docutils + before_install: - - sudo pip install future +- sudo pip install future install: - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi -script: scons config --python=$PYTHON && scons && scons test +script: +- scons config --python=$PYTHON +- if [ "$DOC" ]; then scons doc; else scons && scons test; fi +after_success: +- if [ "$DOC" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then .ci/upload_docs.sh; fi