Skip to content

Commit baf85ae

Browse files
committed
CI: Attempt to simplify docs generation
In each C++/Rust/etc. docs step, attempt to generate an artifact that has the directory structure suitable for the website right away, so docs/$lang. That way, eliminate the combine-deploy step and move the 404.html and index.html generation to the publish_artifacts step, eliminating the need to clone the website repo and running the generator for each build in the master branch.
1 parent 20403cd commit baf85ae

File tree

2 files changed

+57
-177
lines changed

2 files changed

+57
-177
lines changed

.github/workflows/build_docs.yaml

Lines changed: 30 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,20 @@
77
# ┌──────────────────────────────────────────────────────────────┐
88
# │ Jobs 1, 2, 3 run in parallel (no dependencies) │
99
# └──────────┬────────────────────┬──────────────────────────────┘
10-
# │ │
11-
# ┌────▼────┐ │
12-
# │ Job 1 │ │
13-
# └────┬────┘ │
14-
# │ │
15-
# ┌────▼─────────┐ │
16-
# │ Job 4 │ │
17-
# │ (Check warns)│ │
18-
# └──────────────┘ │
19-
#
20-
#
21-
#
22-
# ┌────▼──────────────┐
23-
# │ Job 5 │
24-
# │ (Combine & Deploy)│
25-
# └───────────────────┘
10+
#
11+
# ┌────▼────┐
12+
# │ Job 1 │
13+
# └────┬────┘
14+
#
15+
# ┌────▼─────────┐
16+
# │ Job 4 │
17+
# │ (Check warns)│
18+
# └──────────────┘
2619
#
2720
# Job 1 (rust-cpp-docs): Build Rust and C++ documentation
2821
# Job 2 (astro-docs-tests): Generate screenshots, build Astro docs and run tests
2922
# Job 3 (node-python-docs): Build Node and Python documentation
3023
# Job 4 (check-warnings): Validate docs for warnings (needs Job 1)
31-
# Job 5 (combine-deploy): Combine all artifacts and deploy (needs Jobs 1-3)
3224

3325
name: Build docs
3426

@@ -94,13 +86,16 @@ jobs:
9486
cp -r target/aarch64-linux-android/doc/i_slint_backend_android_activity/ target/doc/
9587
cp -r target/aarch64-linux-android/doc/i_slint_backend_winit/ target/doc/
9688
cp -r target/aarch64-linux-android/doc/i_slint_backend_testing/ target/doc/
89+
- name: "Prepare Rust and C++ docs for website directory structure"
90+
run: |
91+
mkdir -p artifact/docs
92+
mv target/doc artifact/docs/rust
93+
mv target/cppdocs/html artifact/docs/cpp
9794
- name: "Upload Rust/C++ Docs Artifacts"
9895
uses: actions/upload-artifact@v5
9996
with:
100-
name: rust-cpp-docs
101-
path: |
102-
target/doc
103-
target/cppdocs/html
97+
name: docs-rust-cpp
98+
path: artifact
10499

105100
# Job 2: Build Astro docs and run tests
106101
astro-docs-tests:
@@ -187,12 +182,15 @@ jobs:
187182
echo "File count in dist: $(find docs/astro/dist -type f 2>/dev/null | wc -l)"
188183
echo "First 10 files:"
189184
find docs/astro/dist -type f 2>/dev/null | head -10
185+
- name: "Prepare docs for website structure"
186+
run: |
187+
mkdir -p artifact/docs
188+
mv docs/astro/dist artifact/docs/slint
190189
- name: "Upload Astro Docs Artifacts"
191190
uses: actions/upload-artifact@v5
192191
with:
193-
name: astro-docs
194-
path: |
195-
docs/astro/dist
192+
name: docs-astro
193+
path: artifact
196194

197195
# Job 3: Build Node and Python documentation
198196
node-python-docs:
@@ -230,13 +228,16 @@ jobs:
230228
- name: "Python docs"
231229
run: uv run build_docs.py
232230
working-directory: api/python/slint
233-
- name: "Upload Node/Python Docs Artifacts"
231+
- name: "Prepare docs for website structure"
232+
run: |
233+
mkdir -p artifact/docs
234+
mv api/node/docs artifact/docs/node
235+
mv api/python/slint/docs artifact/docs/python
236+
- name: "Upload Python/Node Docs Artifacts"
234237
uses: actions/upload-artifact@v5
235238
with:
236-
name: node-python-docs
237-
path: |
238-
api/node/docs
239-
api/python/slint/docs
239+
name: docs-node-python
240+
path: artifact
240241

241242
# Job 4: Check for docs warnings (depends on rust-cpp-docs)
242243
check-warnings:
@@ -257,135 +258,3 @@ jobs:
257258
- name: "Check for docs warnings in internal crates"
258259
run: cargo doc --workspace --no-deps --all-features --exclude slint-node --exclude pyslint --exclude mcu-board-support --exclude mcu-embassy --exclude printerdemo_mcu --exclude carousel --exclude test-* --exclude plotter --exclude uefi-demo --exclude ffmpeg --exclude gstreamer-player --exclude slint-cpp --exclude slint-python
259260

260-
# Job 5: Combine all artifacts and deploy (depends on all doc generation jobs)
261-
combine-deploy:
262-
runs-on: ubuntu-24.04
263-
needs: [rust-cpp-docs, node-python-docs, astro-docs-tests]
264-
steps:
265-
- uses: actions/checkout@v5
266-
- name: Download Rust/C++ docs
267-
uses: actions/download-artifact@v5
268-
with:
269-
name: rust-cpp-docs
270-
path: downloaded-docs
271-
- name: Debug - Show rust-cpp-docs artifact structure
272-
run: |
273-
echo "=== Contents of downloaded-docs ==="
274-
ls -la downloaded-docs/ || echo "downloaded-docs does not exist"
275-
echo "=== Tree of downloaded-docs (max depth 3) ==="
276-
find downloaded-docs -maxdepth 3 -type d 2>/dev/null || echo "find failed"
277-
- name: Reconstruct Rust/C++ docs paths
278-
run: |
279-
mkdir -p target/cppdocs
280-
mv downloaded-docs/doc target/doc
281-
# The artifact contains cppdocs/html, not just cppdocs
282-
if [ -d "downloaded-docs/cppdocs/html" ]; then
283-
mv downloaded-docs/cppdocs/html target/cppdocs/html
284-
elif [ -d "downloaded-docs/cppdocs" ]; then
285-
mv downloaded-docs/cppdocs target/cppdocs
286-
fi
287-
- name: Download Node/Python docs
288-
uses: actions/download-artifact@v5
289-
with:
290-
name: node-python-docs
291-
path: downloaded-docs
292-
- name: Reconstruct Node/Python docs paths
293-
run: |
294-
mkdir -p api/node api/python/slint
295-
mv downloaded-docs/node/docs api/node/docs
296-
mv downloaded-docs/python/slint/docs api/python/slint/docs
297-
- name: Download Astro docs
298-
uses: actions/download-artifact@v5
299-
with:
300-
name: astro-docs
301-
path: docs/astro/dist
302-
- name: Debug - Check astro docs
303-
run: |
304-
echo "=== Looking for docs/astro/dist ==="
305-
ls -la docs/ || echo "docs/ does not exist"
306-
ls -la docs/astro/ || echo "docs/astro/ does not exist"
307-
ls -la docs/astro/dist/ || echo "docs/astro/dist/ does not exist"
308-
- name: Debug - List downloaded files
309-
run: |
310-
echo "=== Workspace root ==="
311-
ls -la
312-
echo "=== target/ ==="
313-
ls -la target/ || echo "target/ does not exist"
314-
echo "=== target/doc ==="
315-
ls -la target/doc/ || echo "target/doc does not exist"
316-
echo "=== target/cppdocs ==="
317-
ls -la target/cppdocs/ || echo "target/cppdocs does not exist"
318-
echo "=== target/cppdocs/html ==="
319-
ls -la target/cppdocs/html/ || echo "target/cppdocs/html does not exist"
320-
echo "=== api/node/docs ==="
321-
ls -la api/node/docs/ || echo "api/node/docs does not exist"
322-
echo "=== api/python/slint/docs ==="
323-
ls -la api/python/slint/docs/ || echo "api/python/slint/docs does not exist"
324-
echo "=== docs/astro/dist ==="
325-
ls -la docs/astro/dist/ || echo "docs/astro/dist does not exist"
326-
echo "=== docs/site ==="
327-
ls -la docs/site/ || echo "docs/site does not exist"
328-
- name: Generate a token
329-
if: ${{ github.ref == 'refs/heads/master' }}
330-
id: app-token
331-
uses: actions/create-github-app-token@v2
332-
with:
333-
app-id: ${{ inputs.app-id }}
334-
private-key: ${{ secrets.READ_WRITE_PRIVATE_KEY }}
335-
repositories: website
336-
- name: Clone website directory
337-
if: ${{ github.ref == 'refs/heads/master' }}
338-
uses: actions/checkout@v5
339-
with:
340-
repository: slint-ui/website
341-
ref: prod
342-
path: website
343-
token: ${{ steps.app-token.outputs.token }}
344-
persist-credentials: false
345-
- name: Generate release-docs.html and 404.html
346-
if: ${{ github.ref == 'refs/heads/master' }}
347-
run: |
348-
mkdir -p website/output
349-
cd website && go run generator/generator.go -skip-agreements
350-
- name: Copy release-docs.html and 404.html
351-
if: ${{ github.ref == 'refs/heads/master' }}
352-
run: |
353-
mkdir -p docs/site
354-
cp website/output/release-docs.html docs/site/index.html
355-
cp website/output/404.html docs/site/404.html
356-
rm -rf website
357-
- name: Debug - Show what will be uploaded
358-
run: |
359-
echo "=== Files to be uploaded in artifact ==="
360-
echo "--- target/doc ---"
361-
find target/doc -type f 2>/dev/null | head -20 || echo "target/doc not found or empty"
362-
echo "--- target/cppdocs/html ---"
363-
find target/cppdocs/html -type f 2>/dev/null | head -20 || echo "target/cppdocs/html not found or empty"
364-
echo "--- docs/astro/dist ---"
365-
find docs/astro/dist -type f 2>/dev/null | head -20 || echo "docs/astro/dist not found or empty"
366-
echo "--- api/node/docs ---"
367-
find api/node/docs -type f 2>/dev/null | head -20 || echo "api/node/docs not found or empty"
368-
echo "--- api/python/slint/docs ---"
369-
find api/python/slint/docs -type f 2>/dev/null | head -20 || echo "api/python/slint/docs not found or empty"
370-
echo "--- docs/site ---"
371-
find docs/site -type f 2>/dev/null | head -20 || echo "docs/site not found or empty"
372-
echo ""
373-
echo "=== Total file counts ==="
374-
echo "target/doc: $(find target/doc -type f 2>/dev/null | wc -l) files"
375-
echo "target/cppdocs/html: $(find target/cppdocs/html -type f 2>/dev/null | wc -l) files"
376-
echo "docs/astro/dist: $(find docs/astro/dist -type f 2>/dev/null | wc -l) files"
377-
echo "api/node/docs: $(find api/node/docs -type f 2>/dev/null | wc -l) files"
378-
echo "api/python/slint/docs: $(find api/python/slint/docs -type f 2>/dev/null | wc -l) files"
379-
echo "docs/site: $(find docs/site -type f 2>/dev/null | wc -l) files"
380-
- name: "Upload Docs Artifacts"
381-
uses: actions/upload-artifact@v5
382-
with:
383-
name: docs
384-
path: |
385-
target/doc
386-
target/cppdocs/html
387-
docs/astro/dist
388-
api/node/docs
389-
api/python/slint/docs
390-
docs/site
391-

.github/workflows/nightly_snapshot.yaml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -317,18 +317,34 @@ jobs:
317317
steps:
318318
- uses: actions/download-artifact@v6
319319
with:
320-
name: docs
320+
pattern: docs-*
321321
path: .
322-
- name: Debug - List downloaded docs structure
322+
323+
- name: Generate a token
324+
id: app-token-website
325+
uses: actions/create-github-app-token@v2
326+
with:
327+
app-id: ${{ inputs.app-id }}
328+
private-key: ${{ secrets.READ_WRITE_PRIVATE_KEY }}
329+
repositories: website
330+
- name: Clone website directory
331+
uses: actions/checkout@v5
332+
with:
333+
repository: slint-ui/website
334+
ref: prod
335+
path: website
336+
token: ${{ steps.app-token-website.outputs.token }}
337+
persist-credentials: false
338+
- name: Generate release-docs.html and 404.html
323339
run: |
324-
echo "=== Workspace root ==="
325-
ls -la
326-
echo "=== target directory ==="
327-
ls -la target/ || echo "target/ does not exist"
328-
echo "=== target/cppdocs ==="
329-
ls -la target/cppdocs/ || echo "target/cppdocs does not exist"
330-
echo "=== target/cppdocs/html ==="
331-
ls -la target/cppdocs/html/ || echo "target/cppdocs/html does not exist"
340+
mkdir -p website/output
341+
cd website && go run generator/generator.go -skip-agreements
342+
- name: Copy release-docs.html and 404.html
343+
run: |
344+
cp website/output/release-docs.html docs/index.html
345+
cp website/output/404.html docs/404.html
346+
rm -rf website
347+
332348
- uses: actions/download-artifact@v6
333349
with:
334350
name: slintpad
@@ -425,12 +441,7 @@ jobs:
425441
sed -i "s/VERSION/$version/g" ../docs/site/index.html
426442
427443
rm -rf $output_path/docs
428-
mkdir -p $output_path/docs
429-
cp -a ../docs/site/* $output_path/docs
430-
mkdir -p $output_path/docs/cpp
431-
cp -a ../target/cppdocs/html/* $output_path/docs/cpp/
432-
mkdir -p $output_path/docs/rust
433-
cp -a ../target/doc/* $output_path/docs/rust/
444+
mv ../docs .
434445
435446
# Fix up link to Slint language documentation
436447
sed -i "s!https://slint.dev/releases/.*/docs/!../../!" $output_path/docs/rust/slint/*.html

0 commit comments

Comments
 (0)