Skip to content

Commit 7cac483

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 7cac483

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/docs.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
permissions:
13+
contents: read
14+
15+
jobs:
16+
generate-docs:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
path: zephyr-rust-lang
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: 3.11
29+
30+
- name: Setup Zephyr project
31+
uses: zephyrproject-rtos/action-zephyr-setup@v1
32+
with:
33+
app-path: zephyr-rust-lang
34+
manifest-file-name: ci-manifest.yml
35+
toolchains: arm-zephyr-eabi:riscv64-zephyr-elf
36+
37+
- name: Install Rust Targets
38+
shell: bash
39+
run: |
40+
rustup target add thumbv7em-none-eabi
41+
rustup target add thumbv7m-none-eabi
42+
43+
- name: Setup cargo build
44+
working-directory: zephyr-rust-lang
45+
run: |
46+
# Must do full build
47+
west build -b nrf52840dk/nrf52840 docgen
48+
49+
- name: Build Rust documentation
50+
working-directory: zephyr-rust-lang/docgen
51+
run: |
52+
rm -rf .cargo
53+
mkdir .cargo
54+
cd .cargo
55+
ln -s ../../build/rust/sample-cargo-config.toml config.toml
56+
cd ..
57+
cargo doc
58+
59+
- name: Upload artifact
60+
uses: actions/upload-pages-artifact@v3
61+
with:
62+
path: zephyr-rust-lang/build/rust/target/thumbv7em-none-eabi/doc
63+
64+
deploy:
65+
needs: generate-docs
66+
permissions:
67+
pages: write
68+
id-token: write
69+
70+
environment:
71+
name: github-pages
72+
url: ${{ steps.deployment.outputs.page_url }}
73+
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Deploy to GitHub Pages
78+
id: deployment
79+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)