Skip to content

Commit

Permalink
Merge pull request #7820 from tenkoma/3.x-update-dockerfile-and-build
Browse files Browse the repository at this point in the history
3.x fix build and deploy
  • Loading branch information
markstory authored Mar 17, 2024
2 parents ae4c887 + f025f2b commit fcf8cfc
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 143 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
push:
branches:
- '3.x'
- '3.next'
pull_request:
branches:
- '*'

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -17,11 +19,11 @@ jobs:
doc-type: ['HTML', 'EPUB', 'PDF']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Install dependencies
run: |
Expand All @@ -30,6 +32,7 @@ jobs:
- name: Install packages
run: |
sudo apt update
sudo apt install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-lang-all
- name: Build Docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_docs_3x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cloning repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
FROM debian:bullseye
FROM debian:bookworm

ENV DEBIAN_FRONTEND noninteractive

LABEL Description="This image is used to create an environment to contribute to the cakephp/docs"

RUN apt-get update && apt-get install -y \
build-essential \
latexmk \
openjdk-8-jdk \
php \
python3-pip \
python3-full \
texlive-fonts-recommended \
texlive-lang-all \
texlive-latex-extra \
texlive-latex-recommended \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt /tmp/
RUN pip3 install -r /tmp/requirements.txt
RUN python3 -m venv /tmp/venv
ENV PATH="/tmp/venv/bin:$PATH"

ADD https://github.com/w3c/epubcheck/releases/download/v4.2.2/epubcheck-4.2.2.zip /epubcheck/epubcheck.zip
RUN unzip /epubcheck/epubcheck.zip -d /epubcheck \
&& mv /epubcheck/epubcheck-4.2.2/* /epubcheck
COPY requirements.txt /tmp/
RUN pip install -r /tmp/requirements.txt

WORKDIR /data
VOLUME "/data"
Expand Down
11 changes: 2 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ PDF_LANGS = en es fr pt
DEST = website

EPUB_ARGS =
SPHINXOPTS =

# Get path to theme directory to build static assets.
THEME_DIR = $(shell python3 -c 'import os, cakephpsphinx; print(os.path.abspath(os.path.dirname(cakephpsphinx.__file__)))')
Expand All @@ -32,14 +33,13 @@ epub: $(foreach lang, $(LANGS), epub-$(lang))
latex: $(foreach lang, $(PDF_LANGS), latex-$(lang))
pdf: $(foreach lang, $(PDF_LANGS), pdf-$(lang))
htmlhelp: $(foreach lang, $(LANGS), htmlhelp-$(lang))
populate-index: $(foreach lang, $(LANGS), populate-index-$(lang))
server: $(foreach lang, $(LANGS), server-$(lang))
rebuild-index: $(foreach lang, $(LANGS), rebuild-index-$(lang))


# Make the HTML version of the documentation with correctly nested language folders.
html-%:
cd $* && make html
cd $* && make html SPHINXOPTS="$(SPHINXOPTS)"
make build/html/$*/_static/css/dist.css
make build/html/$*/_static/js/dist.js

Expand All @@ -58,13 +58,6 @@ pdf-%:
server-%:
cd build/html/$* && python3 -m SimpleHTTPServer

populate-index-%:
php scripts/populate_search_index.php --lang="$*" --host="$(ES_HOST_V2)"

rebuild-index-%:
curl -XDELETE $(ES_HOST)/documentation/3-0-$*
php scripts/populate_search_index.php $* $(ES_HOST)

epub-check-%: build/epub/$*
java -jar /epubcheck/epubcheck.jar build/epub/$*/CakePHP.epub $(EPUB_ARGS)

Expand Down
25 changes: 12 additions & 13 deletions en/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ PAPER =
BUILDDIR = ../build
CONFDIR = ../config
PYTHON = python3
LANG = en
SPHINX_LANG = en

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(SPHINX_LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

Expand All @@ -41,9 +40,9 @@ clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(LANG)
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(SPHINX_LANG)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(LANG)."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(SPHINX_LANG)."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand All @@ -66,10 +65,10 @@ json:
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(LANG)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp/$(LANG)."
".hhp project file in $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
Expand All @@ -90,22 +89,22 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(SPHINX_LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(SPHINX_LANG)."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(LANG)."
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex/$(LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(LANG)."
make -C $(BUILDDIR)/latex/$(SPHINX_LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
Expand Down
25 changes: 12 additions & 13 deletions es/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ PAPER =
BUILDDIR = ../build
CONFDIR = ../config
PYTHON = python3
LANG = es
SPHINX_LANG = es

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(SPHINX_LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

Expand All @@ -41,9 +40,9 @@ clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(LANG)
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(SPHINX_LANG)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(LANG)."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(SPHINX_LANG)."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand All @@ -66,10 +65,10 @@ json:
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(LANG)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp/$(LANG)."
".hhp project file in $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
Expand All @@ -90,22 +89,22 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(SPHINX_LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(SPHINX_LANG)."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(LANG)."
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex/$(LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(LANG)."
make -C $(BUILDDIR)/latex/$(SPHINX_LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
Expand Down
25 changes: 12 additions & 13 deletions fr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ PAPER =
BUILDDIR = ../build
CONFDIR = ../config
PYTHON = python3
LANG = fr
SPHINX_LANG = fr

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(SPHINX_LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

Expand All @@ -41,9 +40,9 @@ clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(LANG)
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(SPHINX_LANG)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(LANG)."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(SPHINX_LANG)."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand All @@ -66,10 +65,10 @@ json:
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(LANG)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp/$(LANG)."
".hhp project file in $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
Expand All @@ -90,22 +89,22 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(SPHINX_LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(SPHINX_LANG)."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(LANG)."
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex/$(LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(LANG)."
make -C $(BUILDDIR)/latex/$(SPHINX_LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
Expand Down
25 changes: 12 additions & 13 deletions ja/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ PAPER =
BUILDDIR = ../build
CONFDIR = ../config
PYTHON = python3
LANG = ja
SPHINX_LANG = ja

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(SPHINX_LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

Expand All @@ -41,9 +40,9 @@ clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(LANG)
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(SPHINX_LANG)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(LANG)."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(SPHINX_LANG)."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand All @@ -66,10 +65,10 @@ json:
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(LANG)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp/$(LANG)."
".hhp project file in $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
Expand All @@ -90,22 +89,22 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(SPHINX_LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(SPHINX_LANG)."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(LANG)."
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex/$(LANG) all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(LANG)."
make -C $(BUILDDIR)/latex/$(SPHINX_LANG) all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
Expand Down
Loading

0 comments on commit fcf8cfc

Please sign in to comment.