Skip to content

Commit fd3dee3

Browse files
committed
ci: Just emit sym graph on Windows (docc broken), install Swift on Linux (default docc broken), fix iOS
The Windows job was broken cause DocC doesn't work on Windows yet. We work around this by just uploading a symbol graph and assembling the documentation archive in the update-docs job. The Linux job was broken cause DocC doesn't handle being installed as root (it tries to copy across file attributes from its root-installed resource files and fails). The iOS job was broken because it was looking in the wrong place for the archive. The actual location changes per platform so I've updated it to just use 'find' to locate the archive somewhere in the derived data path.
1 parent 2e6f3cf commit fd3dee3

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

.github/actions/compile-docs/action.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@ runs:
2323
run: |
2424
set -ex
2525
mkdir "$TARGET.doccarchive" && \
26-
# We use --disable-sandbox instead of --allow-writing-to-directory because
27-
# Linux and Windows throw tantrums about not being able to write to tmp (even
28-
# though when I try locally I face no issues...)
2926
swift package \
30-
--disable-sandbox \
27+
--allow-writing-to-directory . \
3128
generate-documentation \
3229
--target "$TARGET" \
3330
--disable-indexing \
@@ -55,11 +52,7 @@ runs:
5552
echo "$DEVICE_TYPE"
5653
echo "Building documentation for destination '$destination'"
5754
xcodebuild -skipMacroValidation -scheme "$TARGET" -destination "$destination" -derivedDataPath /tmp/data docbuild | xcbeautify --renderer github-actions
58-
ls /tmp/data
59-
ls /tmp/data/Build
60-
ls /tmp/data/Build/Products
61-
ls /tmp/data/Build/Products/Debug
62-
cp -R "/tmp/data/Build/Products/Debug/$TARGET.doccarchive" "$TARGET.doccarchive"
55+
cp -R $(find /tmp/data -name "$TARGET.doccarchive") "$TARGET.doccarchive"
6356
shell: bash
6457
env:
6558
TARGET: ${{ inputs.target }}

.github/workflows/build-test-and-docs.yml

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,20 @@ jobs:
176176
PKG_CONFIG_PATH: ${{ github.workspace }}/vcpkg_installed/${{ steps.triplet.outputs.lowercase }}/lib/pkgconfig
177177
run: swift build --target SwiftCrossUI -v
178178

179+
# DocC doesn't work on Windows yet, so we just emit the symbol graphs and construct
180+
# the final WinUIBackend documentation archive in the update-docs job.
181+
# Related issue: https://github.com/swiftlang/swift-docc/pull/668
179182
- name: Build WinUIBackend
180-
run: swift build --target WinUIBackend
183+
run: |
184+
swift build --target WinUIBackend -v \
185+
-Xswiftc -emit-symbol-graph \
186+
-Xswiftc -emit-symbol-graph-dir -Xswiftc symbol-graphs
181187
182-
- name: Compile WinUIBackend docs
183-
uses: ./.github/actions/compile-docs
188+
- name: Upload WinUIBackend symbol graph
189+
uses: actions/upload-artifact@v4
184190
with:
185-
target: WinUIBackend
186-
upload: true
191+
name: WinUIBackend.symbols.json
192+
path: symbol-graphs/WinUIBackend.symbols.json
187193

188194
linux:
189195
strategy:
@@ -192,6 +198,11 @@ jobs:
192198
runs-on: ${{ matrix.os }}
193199

194200
steps:
201+
- name: Install Swift
202+
uses: SwiftyLab/setup-swift@latest
203+
with:
204+
swift-version: "6.1.0"
205+
195206
- name: Swift version
196207
run: swift --version
197208

@@ -224,9 +235,6 @@ jobs:
224235
- name: Test
225236
run: swift test --test-product swift-cross-uiPackageTests
226237

227-
- name: Probe
228-
run: ls /usr/share/swift/usr/share/docc/render/
229-
230238
- name: Compile GtkBackend docs
231239
if: ${{ matrix.os == 'ubuntu-24.04' }}
232240
uses: ./.github/actions/compile-docs
@@ -281,11 +289,6 @@ jobs:
281289
with:
282290
name: Gtk3Backend.doccarchive.tar.gz
283291

284-
- name: Download WinUIBackend.doccarchive
285-
uses: actions/download-artifact@v4
286-
with:
287-
name: WinUIBackend.doccarchive.tar.gz
288-
289292
- name: Extract AppKitBackend.doccarchive.tar.gz
290293
uses: a7ul/tar-action@v1.1.0
291294
with:
@@ -310,11 +313,24 @@ jobs:
310313
command: x
311314
files: ./Gtk3Backend.doccarchive.tar.gz
312315

313-
- name: Extract WinUIBackend.doccarchive.tar.gz
314-
uses: a7ul/tar-action@v1.1.0
316+
- name: Download WinUIBackend.symbols.json
317+
uses: actions/download-artifact@v4
315318
with:
316-
command: x
317-
files: ./WinUIBackend.doccarchive.tar.gz
319+
name: WinUIBackend.symbols.json
320+
321+
- name: Compile WinUIBackend documentation
322+
run: |
323+
mkdir WinUIBackend.docc
324+
mkdir winui-symbol-graphs
325+
mv WinUIBackend.symbols.json winui-symbol-graphs/
326+
xcrun docc convert WinUIBackend.docc \
327+
--additional-symbol-graph-dir winui-symbol-graphs \
328+
--transform-for-static-hosting \
329+
--hosting-base-path swift-cross-ui \
330+
--output-path "WinUIBackend.doccarchive" \
331+
--source-service github \
332+
--source-service-base-url https://github.com/stackotter/swift-cross-ui/blob/main \
333+
--checkout-path $(pwd)
318334
319335
- name: Merge DocC archives
320336
run: |

0 commit comments

Comments
 (0)