File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 steps :
2222 - name : Checkout
2323 uses : actions/checkout@v6
24-
24+
2525 # Cache Rust toolchain and cargo registry
2626 - name : Cache Rust
2727 uses : actions/cache@v4
@@ -36,24 +36,28 @@ jobs:
3636 key : ${{ runner.os }}-cargo-${{ hashFiles('versions.txt') }}
3737 restore-keys : |
3838 ${{ runner.os }}-cargo-
39-
39+
4040 - name : Install mdBook and plugins (Linux)
4141 if : runner.os != 'Windows'
4242 run : |
4343 chmod +x scripts/install-tools.sh
4444 ./scripts/install-tools.sh
45-
45+
4646 - name : Install mdBook and plugins (Windows)
4747 if : runner.os == 'Windows'
4848 run : .\scripts\install-tools.ps1
49-
49+
50+ # Install Swift for testing Swift code examples in the book (Ubuntu only; setup-swift does not support Windows)
51+ - name : Setup Swift
52+ if : runner.os != 'Windows'
53+ uses : swift-actions/setup-swift@v2
54+
5055 - name : Build with mdBook
5156 run : mdbook build ./better-code
52-
57+
5358 - name : Upload build artifact
5459 uses : actions/upload-artifact@v4
5560 with :
5661 name : mdbook-build-${{ matrix.os }}
5762 path : ./better-code/book
5863 retention-days : 1
59-
Original file line number Diff line number Diff line change @@ -20,5 +20,14 @@ enable = true
2020[output .html .print ]
2121enable = true
2222
23+ [output .html .code .hidelines ]
24+ swift = " #"
25+
2326[preprocessor .katex ]
2427
28+ # Tests all Swift code blocks during `mdbook build`
29+ # supported-platforms: Only run on these platforms (python3 sys.platform values); omitted => run on all
30+ [output .swift-test ]
31+ command = " python3 ../../../scripts/mdbook-swift-test.py"
32+ # Note: setup-swift@v3 does not support Windows
33+ supported-platforms = [" linux" , " darwin" ]
You can’t perform that action at this time.
0 commit comments