-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Generate and Preview Rust Docs | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main # Only generate docs for PRs targeting main | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
generate-docs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: zephyr-rust-lang | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Setup Zephyr project | ||
uses: zephyrproject-rtos/action-zephyr-setup@v1 | ||
with: | ||
app-path: zephyr-rust-lang | ||
manifest-file-name: ci-manifest.yml | ||
toolchains: arm-zephyr-eabi:riscv64-zephyr-elf | ||
|
||
- name: Install Rust Targets | ||
shell: bash | ||
run: | | ||
rustup target add thumbv7em-none-eabi | ||
rustup target add thumbv7m-none-eabi | ||
- name: Setup cargo build | ||
working-directory: zephyr-rust-lang | ||
run: | | ||
# Must do full build | ||
west build -b nrf52840dk/nrf52840 docgen | ||
- name: Build Rust documentation | ||
working-directory: zephyr-rust-lang/docgen | ||
run: | | ||
rm -rf .cargo | ||
mkdir .cargo | ||
cd .cargo | ||
ln -s ../../build/rust/sample-cargo-config.toml config.toml | ||
cd .. | ||
cargo doc | ||
- name: Deploy docs to GitHub Pages for pull requests | ||
if: github.event_name == 'pull_request' | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./zephyr-rust-lang/build/rust/target/thumbv7em-none-eabi/doc | ||
publish_branch: gh-pages | ||
destination_dir: pr-${{ github.event.number }} | ||
|
||
# - name: Deploy docs to GitHub Pages for push to main | ||
# if: github.event_name == 'push' | ||
# uses: peaceiris/actions-gh-pages@v3 | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# publish_dir: ./target/doc | ||
# publish_branch: gh-pages |