Skip to content

Commit cc072cc

Browse files
authored
Merge pull request #387 from k-okada/circleci
add config.yml for CircelCI
2 parents 9582132 + 6ecd6d1 commit cc072cc

File tree

3 files changed

+178
-0
lines changed

3 files changed

+178
-0
lines changed

.circleci/config.yml

+163
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
version: 2
2+
3+
references:
4+
setup-tex: &setup-tex
5+
run:
6+
name: Setup TeX
7+
command: sudo apt-get install -qq -y texlive-latex-base ptex-bin latex2html nkf poppler-utils
8+
setup-eus: &setup-eus
9+
run:
10+
name: Setup EusLisp
11+
command: |-
12+
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
13+
echo 'export EUSDIR=`pwd`' >> $BASH_ENV
14+
echo 'export ARCHDIR=Linux64' >> $BASH_ENV
15+
echo 'export PATH=${PATH}:${EUSDIR}/${ARCHDIR}/bin' >> $BASH_ENV
16+
echo 'export LD_LIBRARY_PATH=${EUSDIR}/${ARCHDIR}/lib' >> $BASH_ENV
17+
cat $BASH_ENV
18+
compile-eus: &compile-eus
19+
run:
20+
name: Compile EusLisp
21+
command: cd lisp; ln -sf Makefile.Linux64 Makefile; make
22+
23+
jobs:
24+
html:
25+
machine: true
26+
steps:
27+
- checkout
28+
- *setup-tex
29+
- run:
30+
name: Cleanup HTML
31+
command: cd doc/html && rm *manual*.html *manual*.png
32+
- run:
33+
name: Compile HTML
34+
command: cd doc/latex && make html
35+
- run:
36+
name: Compile jHTML
37+
command: cd doc/jlatex && make html
38+
- run:
39+
command: |
40+
mkdir -p /tmp/html
41+
cp doc/html/*manual*.html /tmp/html
42+
cp doc/html/*manual*.png /tmp/html
43+
- store_artifacts:
44+
path: /tmp/html
45+
- persist_to_workspace:
46+
root: doc
47+
paths:
48+
- html/manual*.html
49+
- html/jmanual*.html
50+
- html/manual*.png
51+
- html/jmanual*.png
52+
53+
latex:
54+
machine: true
55+
steps:
56+
- checkout
57+
- *setup-tex
58+
- *setup-eus
59+
- *compile-eus
60+
- run:
61+
name: Cleanup LaTeX
62+
command: cd doc/latex && make distclean
63+
- run:
64+
name: Compile LaTeX
65+
command: |
66+
cd doc/latex && make
67+
- store_artifacts:
68+
path: doc/latex/manual.pdf
69+
destination: manual.pdf
70+
- persist_to_workspace:
71+
root: doc/latex
72+
paths: manual.pdf
73+
jlatex:
74+
machine: true
75+
steps:
76+
- checkout
77+
- *setup-tex
78+
- *setup-eus
79+
- *compile-eus
80+
- run:
81+
name: Cleanup jLaTeX
82+
command: cd doc/jlatex && make distclean
83+
- run:
84+
name: Compile jLaTeX
85+
command: |
86+
cd doc/jlatex && make
87+
- store_artifacts:
88+
path: doc/jlatex/jmanual.pdf
89+
destination: jmanual.pdf
90+
- persist_to_workspace:
91+
root: doc/jlatex/
92+
paths: jmanual.pdf
93+
rst:
94+
machine: true
95+
steps:
96+
- checkout
97+
- *setup-tex
98+
- run:
99+
name: Install Python3
100+
command: pyenv global system 3.5.2
101+
- run:
102+
name: Install Pandoc
103+
command: sudo apt-get install -y -qq pandoc
104+
- run:
105+
name: Compile reStructuredText(reST)
106+
command: cd doc/latex && make rst
107+
- run:
108+
command: |
109+
mkdir -p /tmp/rst/fig
110+
cp doc/latex/*.rst /tmp/rst
111+
cp doc/latex/fig/*.png /tmp/rst/fig
112+
cp doc/latex/conf.py /tmp/rst
113+
- run:
114+
name: Install Sphinx
115+
command: |
116+
pip3 install --user sphinx
117+
pip3 install --user sphinx_rtd_theme
118+
- run:
119+
name: Build reStructuredText(reST)
120+
command: cd /tmp/rst && ~/.local/bin/sphinx-build . html
121+
- store_artifacts:
122+
path: /tmp/rst
123+
- persist_to_workspace:
124+
root: /tmp
125+
paths: rst
126+
127+
artifacts:
128+
docker:
129+
- image: circleci/node:8.10.0
130+
steps:
131+
- checkout
132+
- attach_workspace:
133+
at: artifacts
134+
- store_artifacts:
135+
path: artifacts
136+
- run:
137+
command: |
138+
echo "Check is PR commit : CIRCLE_BRANCH = $CIRCLE_BRANCH"
139+
if [ "${CIRCLE_BRANCH}" == master ]; then exit 0; fi
140+
echo "Check if there is commit in doc directory"
141+
git diff origin/master --name-only --relative doc
142+
if [ "`git diff origin/master --name-only --relative doc`" == "" ]; then echo "No update in doc directory found, exitting... "; exit 0 ; fi
143+
echo "Found new commit on doc directory"
144+
- run: cd .circleci/ && git clone https://github.com/themadcreator/circle-github-bot.git
145+
- run: cd .circleci/circle-github-bot && npm install
146+
- run: cd .circleci/circle-github-bot && npm run build
147+
- run: .circleci/github-pr-update.js
148+
149+
workflows:
150+
version: 2
151+
build:
152+
jobs:
153+
- latex
154+
- jlatex
155+
- html
156+
- rst
157+
- artifacts:
158+
requires:
159+
- latex
160+
- jlatex
161+
- html
162+
- rst
163+

.circleci/github-pr-update.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env node
2+
3+
const bot = require("./circle-github-bot/").create();
4+
5+
bot.comment(process.env.GH_AUTH_TOKEN, `
6+
Thank you for contributing EusLisp documentation<br>
7+
Please check latest documents before merging<br>
8+
9+
PDF version of English manual: <strong>${bot.artifactLink('artifacts/manual.pdf', 'manual.pdf')}</strong>
10+
PDF version of Japanese jmanual: <strong>${bot.artifactLink('artifacts/jmanual.pdf', 'jmanual.pdf')}</strong>
11+
HTML version of English manual: <strong>${bot.artifactLink('artifacts/html/manual.html', 'manual.html')}</strong>
12+
HTML version of Japanese manual: <strong>${bot.artifactLink('artifacts/html/jmanual.html', 'jmanual.html')}</strong>
13+
Sphinx (ReST) version of English manual: <strong>${bot.artifactLink('artifacts/rst/html/manual.html', 'manual.rst')}</strong>
14+
`);

doc/latex/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ manual.rst: latex.py $(RSTFILES) $(PNGFILES)
5252
sed -i 's@\\input{\(.*\)}@..include:: \1\n@g' /tmp/manual.tex # convert \input in tex to bypass pandoc
5353
sed -i 's@\\part{\(.*\)}@.. toctree:: \1@' /tmp/manual.tex # convert \part in tex to bypass pandoc
5454
sed -i ':a;/^[^%].*\\\\$$/{N;s/\\\\\n//;ba}' /tmp/manual.tex # concatinate title/author multi lines
55+
sed -i '/^\\vspace{10mm}$$/d' /tmp/manual.tex # remove vspace{10mm} within title to pass pandoc
5556
pandoc --no-wrap -s /tmp/manual.tex -o manual.rst -V documentclass=ltjarticle --latex-engine=lualatex
5657
sed -i '[email protected]:: \(.*\)@ \1@' manual.rst # restore ..include for rst
5758
sed -i 's@.. toctree:: \(.*\)@.. toctree::\n :maxdepth: 1\n :caption: \1@' manual.rst # restore ..toctree for rst

0 commit comments

Comments
 (0)