Skip to content

Commit 3f90b48

Browse files
committed
Add build-pdf-docs and prepare-build-pdf-docs
1 parent 7c35823 commit 3f90b48

6 files changed

Lines changed: 90 additions & 0 deletions

File tree

roles/build-pdf-docs/README.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Build PDFs from sphinx documents
2+
3+
If the tox environment specified in `tox_pdf_envlist`
4+
does not exist, the PDF build will be skipped.
5+
6+
**Role Variables**
7+
8+
.. zuul:rolevar:: tox_pdf_envlist
9+
:default: pdf-docs
10+
11+
The tox environment used for PDF doc build.
12+
13+
.. zuul:rolevar:: zuul_work_dir
14+
:default: {{ zuul.project.src_dir }}
15+
16+
The location of the main working directory of the job.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
zuul_work_dir: "{{ zuul.project.src_dir }}"
2+
tox_pdf_envlist: pdf-docs
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
- name: Check tox env for PDF build in tox.ini
2+
shell: |
3+
grep '^\[testenv:{{ tox_pdf_envlist }}\]' {{ zuul_work_dir }}/tox.ini
4+
register: pdfdocs_env
5+
ignore_errors: yes
6+
7+
- name: Run tox with pdf build envlist
8+
include_role:
9+
name: tox
10+
vars:
11+
tox_envlist: "{{ tox_pdf_envlist }}"
12+
# We run tox against the envlist without running tests so that we can
13+
# control how the tox output is handled. PDF generations tends to be
14+
# incredibly verbose and we don't want those logs going to the console.
15+
tox_extra_args: "-vv --notest"
16+
when: pdfdocs_env is success
17+
18+
- name: Run tox with output redirected to a file
19+
args:
20+
chdir: "{{ zuul_work_dir }}"
21+
environment: "{{ tox_environment | combine(tox_constraints_env | default({})) }}"
22+
shell: |
23+
echo "Running {{ tox_executable }} -e {{ tox_pdf_envlist }} -vv > {{ ansible_user_dir }}/zuul-output/logs/sphinx-build-pdf.log 2>&1"
24+
echo "Output is redirected to a file as it tends to be quite verbose."
25+
{{ tox_executable }} -e {{ tox_pdf_envlist }} -vv > {{ ansible_user_dir }}/zuul-output/logs/sphinx-build-pdf.log 2>&1
26+
when: pdfdocs_env is success
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Install Packages for build-pdf-docs
2+
3+
Install binary packages for :zuul:role:`build-pdf-docs`.
4+
5+
This role currently only supports Ubuntu Bionic.
6+
7+
If the tox environment specified in `tox_pdf_envlist`
8+
does not exist, package installation will be skipped.
9+
10+
**Role Variables**
11+
12+
.. zuul:rolevar:: tox_pdf_envlist
13+
:default: pdf-docs
14+
15+
The tox environment used for PDF doc building.
16+
17+
.. zuul:rolevar:: zuul_work_dir
18+
:default: {{ zuul.project.src_dir }}
19+
20+
The location of the main working directory of the job.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
zuul_work_dir: "{{ zuul.project.src_dir }}"
2+
pdf_tox_envlist: pdf-docs
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
- name: Check tox env for PDF build in tox.ini
2+
shell: |
3+
grep '^\[testenv:{{ tox_pdf_envlist }}\]' {{ zuul_work_dir }}/tox.ini
4+
register: pdfdocs_env
5+
ignore_errors: yes
6+
7+
- name: Install PDF prereqs
8+
package:
9+
name:
10+
- latexmk
11+
- texlive-xetex
12+
- texlive-fonts-recommended
13+
# Required for tgtermes.sty style, this is a recommended package
14+
# for texlive-fonts-recommended but it is not installed by default.
15+
- tex-gyre
16+
- cm-super
17+
- fonts-liberation
18+
- inkscape
19+
- xindy
20+
# Required by sphinxcontrib-svg2pdfconverter to handle SVG images
21+
- librsvg2-bin
22+
state: present
23+
become: yes
24+
when: pdfdocs_env is success

0 commit comments

Comments
 (0)