support travis

This commit is contained in:
Dongdong Tian 2016-05-28 14:40:23 +08:00
parent 33e7935191
commit 5b282da1ab
5 changed files with 84 additions and 3 deletions

37
.texlive-minmal-installer.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
#
# Install minimal TeXLive 2015 for GMT_docs
#
#REMOTE=http://mirrors.ustc.edu.cn/CTAN/systems/texlive/tlnet
REMOTE=http://ctan.sharelatex.com/tex-archive/systems/texlive/tlnet/
TEXBIN=/usr/local/texlive/2015/bin/x86_64-linux
PACKAGES="titlesec fandol ctex threeparttable framed wrapfig upquote capt-of needspace multirow eqparbox environ trimspaces zhnumber zapfding latexmk"
# install TeXLive
mkdir -p /tmp/install-texlive
cd /tmp/install-texlive/
curl -sSL $REMOTE/install-tl-unx.tar.gz | tar -xz -C ./ --strip-components=1
cat << EOF > texlive.profile
selected_scheme scheme-minimal
TEXMFHOME ~/.texmf
TEXMFCONFIG ~/.texlive/texmf-config
TEXMFVAR ~/.texlive/texmf-var
collection-basic 1
collection-genericrecommended 1
collection-latex 1
collection-latexextra 0
collection-latexrecommended 1
collection-xetex 1
collection-langchinese 0
option_autobackup 0
option_doc 0
option_src 0
EOF
sudo ./install-tl -profile texlive.profile -repository $REMOTE
sudo $TEXBIN/tlmgr update --self --all --repository $REMOTE
sudo $TEXBIN/tlmgr install $PACKAGES --repository $REMOTE
cd -
echo export PATH=$TEXBIN:'$PATH' > srcfile

19
.travis-deploy.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
name="Dongdong Tian"
mail="seisman.info@gmail.com"
docdir=pdf
pdfname=Makefile.pdf
echo "In master branch, deploying now..."
git config user.name "${name}"
git config user.email "${mail}"
# Deploy Github Pages
ghp-import -b gh-pages -n build/html -m 'Update by travis automatically'
git push "https://${GH_TOKEN}@${GH_REF}" gh-pages:gh-pages --force
# Deploy offline HTML and PDF files
mkdir build/${docdir} && cd build
cp latex/${pdfname} ${docdir}/
ghp-import -b ${docdir} ${docdir} -m 'Update by travis automatically'
git push "https://${GH_TOKEN}@${GH_REF}" ${docdir}:${docdir} --force

22
.travis.yml Normal file
View File

@ -0,0 +1,22 @@
language: python
python:
- "3.5"
sudo: required
dist: trusty
branches:
only:
- dev
install:
- pip install -r requirements.txt
- bash ./.texlive-minmal-installer.sh
- source ./srcfile
script:
- make html
- make xelatexpdf
after_success:
bash ./.travis-deploy.sh

View File

@ -119,9 +119,8 @@ latexpdf:
xelatexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through xelatex..."
sed -i s/pdflatex/xelatex/ $(BUILDDIR)/latex/Makefile
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "Runnning LaTeX files through xelatex..."
cd $(BUILDDIR)/latex; latexmk -xelatex -shell-escape -interaction=nonstopmode
@echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:

4
requirements.txt Normal file
View File

@ -0,0 +1,4 @@
sphinx
sphinx_rtd_theme
pygments
ghp-import