Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: pdf generation with docker #133

Merged
merged 7 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions .github/workflows/push-doc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build on master and dev only"
name: "Push RTD on gh-pages"

on:
push:
Expand All @@ -10,24 +10,29 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "setup python"
uses: actions/setup-python@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build docker image
uses: docker/build-push-action@v3
with:
python-version: 3.9
- name: "install dependencies"
context: .
load: true
push: false
cache-to: type=gha
cache-from: type=gha
tags: spinaldoc-pdf
file: pdf.Dockerfile
- name: Check links
run: docker run --rm -v $PWD:/docs spinaldoc-pdf make linkcheck
- name: Build multiversioned doc
run: docker run --rm -v $PWD:/docs spinaldoc-pdf sphinx-multiversion source docs/html
- name: Add .nojekill
run: sudo touch docs/html/.nojekyll
- name: Add redirection to master
run: |
apt-get update -y && apt-get install -y git
pip install -r requirements.txt
- name: "check links"
run: make linkcheck
- name: "Build multiversioned doc"
run: sphinx-multiversion source docs/html
- name: "add .nojekill and redirect to master"
run: |
sudo touch docs/html/.nojekyll
sudo tee docs/html/index.html << EOF
<!DOCTYPE html>
<html>
Expand All @@ -39,8 +44,8 @@ jobs:
</head>
</html>
EOF
- name: Deploy to Pages
uses: JamesIves/github-pages-deploy-action@4.1.4
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/html
4 changes: 2 additions & 2 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "setup python"
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: "install dependencies"
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
FROM sphinxdoc/sphinx

WORKDIR /docs

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
git \
&& apt-get autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apb/lists/*

ADD requirements.txt /docs
RUN pip3 install -r requirements.txt
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ You can still run custom commands in the docker, for instance to clean:

docker run -it --rm -v $PWD:/docs spinaldoc-rtd make clean

It is also possible to create the custom docker image to build a pdf (heavier):

.. code:: shell

docker build -f pdf.Dockerfile -t spinaldoc-pdf .

And to run it:

.. code:: shell

docker run -it --rm -v $PWD:/docs spinaldoc-pdf


Native
------
Expand Down
19 changes: 19 additions & 0 deletions pdf.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM sphinxdoc/sphinx-latexpdf

WORKDIR /docs

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
git \
librsvg2-bin \
npm \
&& apt-get autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apb/lists/*

RUN npm i wavedrom-cli -g

ADD requirements.txt /docs
RUN pip3 install -r requirements.txt
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx==5.2.0
sphinx==5.3.0
sphinx-rtd-theme==0.5.2
sphinxcontrib-wavedrom==3.0.2
sphinx-multiversion==0.2.4
sphinxcontrib-wavedrom==3.0.4
sphinx-multiversion @ git+https://github.com/samuel-emrys/sphinx-multiversion.git@cd723351f687c98d32834226ae7b3ec9e63bcba5
8 changes: 8 additions & 0 deletions source/_templates/versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
{%- endfor %}
</dl>
{%- endif %}
{%- if current_version.artefacts %}
<dl>
<dt>Downloads</dt>
{%- for artefact in current_version.artefacts %}
<dd><a href="{{ artefact.url }}">{{ artefact.name }}</a></dd>
{%- endfor %}
</dl>
{%- endif %}
</div>
</div>
{%- endif %}
47 changes: 43 additions & 4 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

project = 'SpinalHDL'
copyright = '2022, SpinalHDL'
author = 'Spinal'
author = 'SpinalHDL contributors'

# The short X.Y version
version = ''
Expand Down Expand Up @@ -135,7 +135,7 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'SpinalHDL.tex', 'SpinalHDL Documentation',
'penis', 'manual'),
author, 'manual'),
]


Expand Down Expand Up @@ -207,7 +207,46 @@
#Option for linkcheck
linkcheck_anchors=False

smv_branch_whitelist = r'^(master|dev).*$'
smv_remote_whitelist = r'^.*$'
# Whitelist pattern for tags (set to None to ignore all tags)
smv_tag_whitelist = r'^.*$'

# Whitelist pattern for branches (set to None to ignore all branches)
smv_branch_whitelist = r'^(master|dev)$'

# Whitelist pattern for remotes (set to None to use local branches only)
smv_remote_whitelist = r'^.*$'

# Pattern for released versions
smv_released_pattern = r'^tags/.*$'

# Format for versioned output directories inside the build directory
smv_outputdir_format = '{ref.name}'

# Determines whether remote or local git branches/tags are preferred if their output dirs conflict
smv_prefer_remote_refs = True

# Run a command before invoking sphinx-build
#smv_prebuild_command = ''

# Regular expression of files and directories to export to outputdir after running smv_prebuild_command
#smv_prebuild_export_pattern = ''

# Export files and directories matching smv_prebuild_export_pattern to this subdirectory of outputdir
#smv_prebuild_export_destination = ''

# Specify build targets and whether the resulting artefacts should be downloadable
smv_build_targets = {
"HTML" : {
"builder": "html",
"downloadable": False,
"download_format": "",
},
"PDF" : {
"builder": "latexpdf",
"downloadable": True,
"download_format": "pdf",
}
}

# Flag indicating whether the intermediate build directories should be removed after artefacts are produced
smv_clean_intermediate_files = True