Skip to content

Commit 0086bc6

Browse files
committed
workflow: Add a docs workflow
This workflow will build the docs for the zephyr crates for a single particular build, and publish them to GH pages. Signed-off-by: David Brown <[email protected]>
1 parent 83d0bdc commit 0086bc6

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/docs.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Generate and Preview Rust Docs
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main # Only generate docs for PRs targeting main
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
generate-docs:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
path: zephyr-rust-lang
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: 3.11
26+
27+
- name: Setup Zephyr project
28+
uses: zephyrproject-rtos/action-zephyr-setup@v1
29+
with:
30+
app-path: zephyr-rust-lang
31+
manifest-file-name: ci-manifest.yml
32+
toolchains: arm-zephyr-eabi:riscv64-zephyr-elf
33+
34+
- name: Install Rust Targets
35+
shell: bash
36+
run: |
37+
rustup target add thumbv7em-none-eabi
38+
rustup target add thumbv7m-none-eabi
39+
40+
- name: Setup cargo build
41+
working-directory: zephyr-rust-lang
42+
run: |
43+
# Must do a full build to generate the headers that bindgen will use.
44+
west build -b nrf52840dk/nrf52840 docgen
45+
find . -type d -ls
46+
47+
- name: Build Rust documentation
48+
working-directory: zephyr-rust-lang/docgen
49+
run: |
50+
rm -rf .cargo
51+
mkdir .cargo
52+
cd .cargo
53+
ln -s ../../build/rust/sample-cargo-config.toml config.toml
54+
cd ..
55+
cargo doc
56+
57+
# - name: Deploy docs to GitHub Pages for pull requests
58+
# if: github.event_name == 'pull_request'
59+
# uses: peaceiris/actions-gh-pages@v3
60+
# with:
61+
# github_token: ${{ secrets.GITHUB_TOKEN }}
62+
# publish_dir: ./target/doc
63+
# publish_branch: gh-pages
64+
# publish_dir: ./target/doc
65+
# destination_dir: pr-${{ github.event.number }}
66+
#
67+
# - name: Deploy docs to GitHub Pages for push to main
68+
# if: github.event_name == 'push'
69+
# uses: peaceiris/actions-gh-pages@v3
70+
# with:
71+
# github_token: ${{ secrets.GITHUB_TOKEN }}
72+
# publish_dir: ./target/doc
73+
# publish_branch: gh-pages

0 commit comments

Comments
 (0)