1010
1111substitutions :
1212 # Update when a new Prince version is released: https://www.princexml.com/latest/
13- # python:3.12 is based on Debian Trixie (13), so use the debian13 package.
14- _PRINCE_PACKAGE : ' prince_16.1-1_debian13_amd64 .deb'
13+ # ubuntu:24.04 is Ubuntu Noble (24.04 LTS); use the ubuntu24.04 package.
14+ _PRINCE_PACKAGE : ' prince_16.2-1_ubuntu24.04_amd64 .deb'
1515
1616steps :
1717 # ─────────────────────────────────────────────────────────────────────────
18- # Step 1: Install dependencies, generate all chapters, run full test suite.
19- # Uses python:3.12 (Debian Trixie) and installs Node 20 at runtime.
20- # node_modules persist in /workspace and are reused by later steps;
21- # Python packages are re-installed per step.
18+ # Step 1: Install dependencies, generate chapters, run tests, build ebooks.
19+ # Prince fetches pages from a running localhost server.
2220 # ─────────────────────────────────────────────────────────────────────────
23- - name : ' python:3.12'
24- id : ' build-and-test'
25- entrypoint : ' bash'
26- dir : ' src'
27- args :
28- - ' -c'
29- - |
30- set -e
31- # Install Node.js 20 (nodesource setup script also runs apt-get update)
32- curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
33- apt-get install -y nodejs
34-
35- # Install Python dependencies
36- pip install --quiet -r requirements.txt
37-
38- # Install Node dependencies (uses package-lock.json for reproducibility)
39- npm ci
40-
41- # Start the web server in the background (required for URL tests)
42- python main.py background &
43- sleep 3
44-
45- # Generate all chapters
46- npm run generate
47-
48- # Run Python unit tests
49- npm run pytest
50-
51- # Run full URL test suite against the running server
52- npm run test
53-
54- # ─────────────────────────────────────────────────────────────────────────
55- # Step 2: Update timestamps then generate PDF ebooks.
56- # Prince fetches pages from a running localhost server, so the Python server
57- # is re-started here. Chapters written to /workspace/src in step 1 are
58- # served directly; npm install is skipped (node_modules already present).
59- # ─────────────────────────────────────────────────────────────────────────
60- - name : ' python:3.12'
61- id : ' generate-ebooks'
21+ - name : ' ubuntu:24.04'
22+ id : ' build-test-and-ebooks'
6223 entrypoint : ' bash'
6324 dir : ' src'
6425 args :
6526 - ' -c'
6627 - |
6728 set -e
6829 apt-get update -qq
30+ apt-get install -y python3 python3-pip python-is-python3 curl
6931
70- # Install Node.js 20 (matches step 1 so node_modules are reused correctly)
32+ # Install Node.js 20
7133 curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
7234 apt-get install -y nodejs
7335
74- # Re-generate chapters (idempotent; guards against workspace persistence issues )
75- npm run generate
36+ # Generate chapters, run tests (installs Python/Node deps, starts server )
37+ ../tools/scripts/run_and_test_website.sh
7638
77- # Update static-asset cache-busting hashes before deploying
78- npm run timestamps
39+ # Enable Ubuntu universe repository (required for fonts and pdftk)
40+ apt-get install -y software-properties-common
41+ add-apt-repository -y universe
42+ apt-get update -qq
7943
8044 # Install CJK fonts for multilingual ebooks
8145 apt-get install -y fonts-ipafont-gothic fonts-arphic-uming fonts-unfonts-core wget
@@ -87,19 +51,15 @@ steps:
8751 wget -q "https://www.princexml.com/download/${_PRINCE_PACKAGE}" -P /tmp
8852 gdebi --non-interactive "/tmp/${_PRINCE_PACKAGE}"
8953
90- # Install Python dependencies (needed to run the web server)
91- pip install --quiet -r requirements.txt
92-
93- # Re-start the web server so Prince can fetch pages from localhost
94- python main.py background &
95- sleep 3
96-
9754 # Generate PDF ebooks
9855 mkdir -p static/pdfs
9956 npm run ebooks
10057
58+ # Update static-asset cache-busting hashes (run after all files are generated)
59+ npm run timestamps
60+
10161 # ─────────────────────────────────────────────────────────────────────────
102- # Step 3 : Deploy to Google App Engine.
62+ # Step 2 : Deploy to Google App Engine.
10363 # app.yaml is read from /workspace/src (dir: src).
10464 # App Engine version is a timestamp, e.g. 20211111t105151.
10565 # ─────────────────────────────────────────────────────────────────────────
0 commit comments