Skip to content

Commit

Permalink
Merge pull request #387 from k-okada/circleci
Browse files Browse the repository at this point in the history
add config.yml for CircelCI
  • Loading branch information
k-okada authored Jun 15, 2019
2 parents 9582132 + 6ecd6d1 commit cc072cc
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 0 deletions.
163 changes: 163 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
version: 2

references:
setup-tex: &setup-tex
run:
name: Setup TeX
command: sudo apt-get install -qq -y texlive-latex-base ptex-bin latex2html nkf poppler-utils
setup-eus: &setup-eus
run:
name: Setup EusLisp
command: |-
sudo apt-get install -qq -y git make gcc g++ libjpeg-dev libxext-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev libpq-dev libpng-dev xfonts-100dpi xfonts-75dpi
echo 'export EUSDIR=`pwd`' >> $BASH_ENV
echo 'export ARCHDIR=Linux64' >> $BASH_ENV
echo 'export PATH=${PATH}:${EUSDIR}/${ARCHDIR}/bin' >> $BASH_ENV
echo 'export LD_LIBRARY_PATH=${EUSDIR}/${ARCHDIR}/lib' >> $BASH_ENV
cat $BASH_ENV
compile-eus: &compile-eus
run:
name: Compile EusLisp
command: cd lisp; ln -sf Makefile.Linux64 Makefile; make

jobs:
html:
machine: true
steps:
- checkout
- *setup-tex
- run:
name: Cleanup HTML
command: cd doc/html && rm *manual*.html *manual*.png
- run:
name: Compile HTML
command: cd doc/latex && make html
- run:
name: Compile jHTML
command: cd doc/jlatex && make html
- run:
command: |
mkdir -p /tmp/html
cp doc/html/*manual*.html /tmp/html
cp doc/html/*manual*.png /tmp/html
- store_artifacts:
path: /tmp/html
- persist_to_workspace:
root: doc
paths:
- html/manual*.html
- html/jmanual*.html
- html/manual*.png
- html/jmanual*.png

latex:
machine: true
steps:
- checkout
- *setup-tex
- *setup-eus
- *compile-eus
- run:
name: Cleanup LaTeX
command: cd doc/latex && make distclean
- run:
name: Compile LaTeX
command: |
cd doc/latex && make
- store_artifacts:
path: doc/latex/manual.pdf
destination: manual.pdf
- persist_to_workspace:
root: doc/latex
paths: manual.pdf
jlatex:
machine: true
steps:
- checkout
- *setup-tex
- *setup-eus
- *compile-eus
- run:
name: Cleanup jLaTeX
command: cd doc/jlatex && make distclean
- run:
name: Compile jLaTeX
command: |
cd doc/jlatex && make
- store_artifacts:
path: doc/jlatex/jmanual.pdf
destination: jmanual.pdf
- persist_to_workspace:
root: doc/jlatex/
paths: jmanual.pdf
rst:
machine: true
steps:
- checkout
- *setup-tex
- run:
name: Install Python3
command: pyenv global system 3.5.2
- run:
name: Install Pandoc
command: sudo apt-get install -y -qq pandoc
- run:
name: Compile reStructuredText(reST)
command: cd doc/latex && make rst
- run:
command: |
mkdir -p /tmp/rst/fig
cp doc/latex/*.rst /tmp/rst
cp doc/latex/fig/*.png /tmp/rst/fig
cp doc/latex/conf.py /tmp/rst
- run:
name: Install Sphinx
command: |
pip3 install --user sphinx
pip3 install --user sphinx_rtd_theme
- run:
name: Build reStructuredText(reST)
command: cd /tmp/rst && ~/.local/bin/sphinx-build . html
- store_artifacts:
path: /tmp/rst
- persist_to_workspace:
root: /tmp
paths: rst

artifacts:
docker:
- image: circleci/node:8.10.0
steps:
- checkout
- attach_workspace:
at: artifacts
- store_artifacts:
path: artifacts
- run:
command: |
echo "Check is PR commit : CIRCLE_BRANCH = $CIRCLE_BRANCH"
if [ "${CIRCLE_BRANCH}" == master ]; then exit 0; fi
echo "Check if there is commit in doc directory"
git diff origin/master --name-only --relative doc
if [ "`git diff origin/master --name-only --relative doc`" == "" ]; then echo "No update in doc directory found, exitting... "; exit 0 ; fi
echo "Found new commit on doc directory"
- run: cd .circleci/ && git clone https://github.com/themadcreator/circle-github-bot.git
- run: cd .circleci/circle-github-bot && npm install
- run: cd .circleci/circle-github-bot && npm run build
- run: .circleci/github-pr-update.js

workflows:
version: 2
build:
jobs:
- latex
- jlatex
- html
- rst
- artifacts:
requires:
- latex
- jlatex
- html
- rst

14 changes: 14 additions & 0 deletions .circleci/github-pr-update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env node

const bot = require("./circle-github-bot/").create();

bot.comment(process.env.GH_AUTH_TOKEN, `
Thank you for contributing EusLisp documentation<br>
Please check latest documents before merging<br>
PDF version of English manual: <strong>${bot.artifactLink('artifacts/manual.pdf', 'manual.pdf')}</strong>
PDF version of Japanese jmanual: <strong>${bot.artifactLink('artifacts/jmanual.pdf', 'jmanual.pdf')}</strong>
HTML version of English manual: <strong>${bot.artifactLink('artifacts/html/manual.html', 'manual.html')}</strong>
HTML version of Japanese manual: <strong>${bot.artifactLink('artifacts/html/jmanual.html', 'jmanual.html')}</strong>
Sphinx (ReST) version of English manual: <strong>${bot.artifactLink('artifacts/rst/html/manual.html', 'manual.rst')}</strong>
`);
1 change: 1 addition & 0 deletions doc/latex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ manual.rst: latex.py $(RSTFILES) $(PNGFILES)
sed -i 's@\\input{\(.*\)}@..include:: \1\n@g' /tmp/manual.tex # convert \input in tex to bypass pandoc
sed -i 's@\\part{\(.*\)}@.. toctree:: \1@' /tmp/manual.tex # convert \part in tex to bypass pandoc
sed -i ':a;/^[^%].*\\\\$$/{N;s/\\\\\n//;ba}' /tmp/manual.tex # concatinate title/author multi lines
sed -i '/^\\vspace{10mm}$$/d' /tmp/manual.tex # remove vspace{10mm} within title to pass pandoc
pandoc --no-wrap -s /tmp/manual.tex -o manual.rst -V documentclass=ltjarticle --latex-engine=lualatex
sed -i '[email protected]:: \(.*\)@ \1@' manual.rst # restore ..include for rst
sed -i 's@.. toctree:: \(.*\)@.. toctree::\n :maxdepth: 1\n :caption: \1@' manual.rst # restore ..toctree for rst
Expand Down

1 comment on commit cc072cc

@k-okada
Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for contributing EusLisp documentation

Please check latest documents before merging

PDF version of English manual: manual.pdf
PDF version of Japanese jmanual: jmanual.pdf
HTML version of English manual: manual.html
HTML version of Japanese manual: jmanual.html
Sphinx (ReST) version of English manual: manual.rst

Please sign in to comment.