From b22793f57e6adc2a5537ee7cb06d936800848660 Mon Sep 17 00:00:00 2001 From: Ced Date: Fri, 27 Oct 2023 21:05:21 +0100 Subject: [PATCH 1/9] Simplify verify target Little value in building the sans-serif pdf... can only fails if a font is missing. --- makefile | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/makefile b/makefile index a52e6e3a..b67496aa 100644 --- a/makefile +++ b/makefile @@ -1,45 +1,38 @@ DOCKER_IMAGE := ghcr.io/hendricius/the-sourdough-framework +DOCKER_CMD := docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c -.PHONY: build_pdf -build_pdf: mrproper - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make" +.PHONY: bake build_pdf build_docker_image push_docker_image validate website +.PHONY: print_os_version start_shell printvars show_tools_version mrproper -.PHONY: bake -bake: mrproper - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make bake" +build_pdf: + "cd /opt/repo/book && make" + +bake: + $(DOCKER_CMD) "cd /opt/repo/book && make bake" -.PHONY: build_docker_image build_docker_image: docker build -t $(DOCKER_IMAGE) -f Dockerfile --progress=plain . -.PHONY: push_docker_image -push_docker_image: +push_docker_image: build_docker_image docker push $(DOCKER_IMAGE):latest -.PHONY: website -website: mrproper - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make website" +website: + $(DOCKER_CMD) "cd /opt/repo/book && make website" -.PHONY: validate -validate: mrproper - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make -j build_pdf build_ebook" +validate: + $(DOCKER_CMD) "cd /opt/repo/book && make -j build_serif_pdf build_ebook" -.PHONY: mrproper mrproper: - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make mrproper" + $(DOCKER_CMD) "cd /opt/repo/book && make mrproper" -.PHONY: show_tools_version show_tools_version: - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make show_tools_version" + $(DOCKER_CMD) "cd /opt/repo/book && make show_tools_version" -.PHONY: printvars printvars: - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make printvars" + $(DOCKER_CMD) "cd /opt/repo/book && make printvars" -.PHONY: print_os_version print_os_version: - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cat /etc/*release" + $(DOCKER_CMD) "cat /etc/*release" -.PHONY: start_shell start_shell: docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash From 9adcca73ebe839c6185b95fb986286d53bd9c2cf Mon Sep 17 00:00:00 2001 From: Ced Date: Fri, 27 Oct 2023 21:14:50 +0100 Subject: [PATCH 2/9] Remove unused targets in main makefile Reorder logically and comment --- makefile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/makefile b/makefile index b67496aa..6badc0e6 100644 --- a/makefile +++ b/makefile @@ -2,29 +2,28 @@ DOCKER_IMAGE := ghcr.io/hendricius/the-sourdough-framework DOCKER_CMD := docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c .PHONY: bake build_pdf build_docker_image push_docker_image validate website -.PHONY: print_os_version start_shell printvars show_tools_version mrproper - -build_pdf: - "cd /opt/repo/book && make" - -bake: - $(DOCKER_CMD) "cd /opt/repo/book && make bake" +.PHONY: print_os_version start_shell printvars show_tools_version +# Dockers targets build_docker_image: docker build -t $(DOCKER_IMAGE) -f Dockerfile --progress=plain . push_docker_image: build_docker_image docker push $(DOCKER_IMAGE):latest -website: - $(DOCKER_CMD) "cd /opt/repo/book && make website" +# Books/website +# Quicker run for each commit, shall catch most problems validate: $(DOCKER_CMD) "cd /opt/repo/book && make -j build_serif_pdf build_ebook" -mrproper: - $(DOCKER_CMD) "cd /opt/repo/book && make mrproper" +bake: + $(DOCKER_CMD) "cd /opt/repo/book && make bake" + +website: + $(DOCKER_CMD) "cd /opt/repo/book && make website" +# Debug helpers show_tools_version: $(DOCKER_CMD) "cd /opt/repo/book && make show_tools_version" From a8e98595c7d29ec1fa04178658621d14180d5837 Mon Sep 17 00:00:00 2001 From: Ced Date: Fri, 27 Oct 2023 21:16:22 +0100 Subject: [PATCH 3/9] Use parallel build on github release action --- .github/workflows/release-book.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-book.yml b/.github/workflows/release-book.yml index f10092b8..65738eaf 100644 --- a/.github/workflows/release-book.yml +++ b/.github/workflows/release-book.yml @@ -32,7 +32,7 @@ jobs: options: -v ${{ github.workspace }}:/app run: | cd /app/book - make bake + make -j bake - name: Release baked book to S3 uses: shallwefootball/s3-upload-action@master with: From 500f5e7dce2c7ef65517cbdccf2506e45b90d41b Mon Sep 17 00:00:00 2001 From: Ced Date: Fri, 27 Oct 2023 21:17:51 +0100 Subject: [PATCH 4/9] Limit validate CI to serif pdf target and ebook --- .github/workflows/validate-book-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-book-build.yml b/.github/workflows/validate-book-build.yml index 35aafa58..adf48e27 100644 --- a/.github/workflows/validate-book-build.yml +++ b/.github/workflows/validate-book-build.yml @@ -29,4 +29,4 @@ jobs: options: -v ${{ github.workspace }}:/app run: | cd /app/book - make -j build_pdf build_ebook + make -j build_serif_pdf build_ebook From 8ab6cad1fb0ac0f224193da34061e50a73da7a39 Mon Sep 17 00:00:00 2001 From: Ced Date: Fri, 27 Oct 2023 21:44:35 +0100 Subject: [PATCH 5/9] Add some targets back in docker makefile I now understand how they can be useful... --- makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index 6badc0e6..8691e4b3 100644 --- a/makefile +++ b/makefile @@ -2,7 +2,7 @@ DOCKER_IMAGE := ghcr.io/hendricius/the-sourdough-framework DOCKER_CMD := docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c .PHONY: bake build_pdf build_docker_image push_docker_image validate website -.PHONY: print_os_version start_shell printvars show_tools_version +.PHONY: print_os_version start_shell printvars show_tools_version mrproper # Dockers targets build_docker_image: @@ -17,12 +17,18 @@ push_docker_image: build_docker_image validate: $(DOCKER_CMD) "cd /opt/repo/book && make -j build_serif_pdf build_ebook" +build_pdf: + $(DOCKER_CMD) "cd /opt/repo/book && make" + bake: - $(DOCKER_CMD) "cd /opt/repo/book && make bake" + $(DOCKER_CMD) "cd /opt/repo/book && make -j bake" website: $(DOCKER_CMD) "cd /opt/repo/book && make website" +mrproper: + $(DOCKER_CMD) "cd /opt/repo/book && make mrproper" + # Debug helpers show_tools_version: $(DOCKER_CMD) "cd /opt/repo/book && make show_tools_version" From 9d76ea1cf9fc520293621460e09032628902a346 Mon Sep 17 00:00:00 2001 From: Hendrik Kleinwaechter Date: Mon, 30 Oct 2023 23:41:04 +1300 Subject: [PATCH 6/9] Add default target --- makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/makefile b/makefile index 8691e4b3..2756c5b0 100644 --- a/makefile +++ b/makefile @@ -1,3 +1,5 @@ +.DEFAULT_GOAL := build_pdf + DOCKER_IMAGE := ghcr.io/hendricius/the-sourdough-framework DOCKER_CMD := docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c From 7537d4c36f658df9b6844509b8cb65d880553a1a Mon Sep 17 00:00:00 2001 From: cedounet <134267244+cedounet@users.noreply.github.com> Date: Mon, 30 Oct 2023 10:48:00 +0000 Subject: [PATCH 7/9] Update README wording for clarity (#267) * Update README wording for clarity * Add parallel builds to the README They are now safe and runs much faster. --- README.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3a4c0dd0..e3b7963f 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ make Then you can check out the file `book/book.pdf` If you want to 🍞 bake all the versions including ebook variants (.pdf, .epub -in colour or size optimized Black&White), run: +in colour and size optimized Black&White), run: ```console make bake @@ -43,8 +43,9 @@ You can check the files in the folder `book/release/` ## 🍞 Baking the book locally (LaTeX) -Make sure you have `biber` and `latexmk` installed. Refer to your system's -installation instructions for LaTeX. To create the serif .pdf format, run: +Make sure you have `biber`, `latexmk` and ``ImageMagick`` installed. Refer to +your system's installation instructions for LaTeX. To create the serif .pdf +format, run: ```console cd book/ @@ -52,11 +53,11 @@ make ``` If you want to 🍞 bake all the versions including ebook variants (.pdf, .epub -in colour or size optimized Black&White), run: +in colour and size optimized Black&White), run: ```console cd book/ -make bake +make -j bake ``` You can check the files in the folder `book/release/` @@ -74,16 +75,16 @@ The below versions are automatically built on every push to the `main` branch. * [Download compiled .pdf version](https://www.the-bread-code.io/book.pdf) * [Download compiled .epub version](https://www.the-bread-code.io/book.epub) -There's an additional enhanced accessibility version using a sans serif font: +There's an additional enhanced accessibility version using a sans-serif font: -* [Download compiled .pdf version](https://www.the-bread-code.io/book-sans-serif.pdf) +* [Download compiled sans-serif .pdf version](https://www.the-bread-code.io/book-sans-serif.pdf) -An additional black and white ebook is provided with a greatly reduced file size. This -shrinks the book from more than 50MB down to ~5MB: +An additional black and white ebook is provided with a greatly reduced file +size. This shrinks the book from more than 50MB down to ~5MB: -* [Download compiled .epub version](https://www.the-bread-code.io/bw-book.epub) +* [Download compiled B&W .epub version](https://www.the-bread-code.io/bw-book.epub) -## Online HTML version (WIP) +## Online HTML version Head over to [https://www.the-sourdough-framework.com](https://www.the-sourdough-framework.com) From 6532f8d5f7e15eb6c07d15a6b4ff55dada12ff7f Mon Sep 17 00:00:00 2001 From: Ced Date: Mon, 30 Oct 2023 14:40:58 +0000 Subject: [PATCH 8/9] Ensure dir is created before image BW conversion Now that parallel build is enabled --- book/makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/book/makefile b/book/makefile index b08b1fee..ae96d6b8 100644 --- a/book/makefile +++ b/book/makefile @@ -95,15 +95,18 @@ epub/%.epub: %.tex $(src_all) cover/cover-page.xbb bw-book-epub: mkdir -p bw-book-epub +bw-book-epub/OEBPS: bw-book-epub + mkdir -p bw-book-epub/OEBPS + copy_ebook_files: build_ebook | bw-book-epub $(RSYNC) book-epub/ bw-book-epub/ # We not convert SVG to B&W or lower res for now as they are super small # anyway -bw-book-epub/OEBPS/%.jpg: %.jpg +bw-book-epub/OEBPS/%.jpg: %.jpg | bw-book-epub/OEBPS $(CONVERT_PIC) $< $(REDUCE_PIC) $@ -bw-book-epub/OEBPS/%.png: %.png +bw-book-epub/OEBPS/%.png: %.png | bw-book-epub/OEBPS $(CONVERT_PIC) $< $(REDUCE_PIC) $@ epub/bw_book.epub: copy_ebook_files $(bw_images) From 14abcdcbf0f9e25c704ca042187a073665eabc61 Mon Sep 17 00:00:00 2001 From: Ced Date: Mon, 30 Oct 2023 15:23:59 +0000 Subject: [PATCH 9/9] Ensure copy happened before BW conversion as we have subdirs... --- book/makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/makefile b/book/makefile index ae96d6b8..7a71ac4a 100644 --- a/book/makefile +++ b/book/makefile @@ -103,10 +103,10 @@ copy_ebook_files: build_ebook | bw-book-epub # We not convert SVG to B&W or lower res for now as they are super small # anyway -bw-book-epub/OEBPS/%.jpg: %.jpg | bw-book-epub/OEBPS +bw-book-epub/OEBPS/%.jpg: %.jpg copy_ebook_files $(CONVERT_PIC) $< $(REDUCE_PIC) $@ -bw-book-epub/OEBPS/%.png: %.png | bw-book-epub/OEBPS +bw-book-epub/OEBPS/%.png: %.png copy_ebook_files $(CONVERT_PIC) $< $(REDUCE_PIC) $@ epub/bw_book.epub: copy_ebook_files $(bw_images)