-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Add workflow for documentation generation
This attempts to build the project documentation, for PRs uploading it to a working directory for the PR. Signed-off-by: David Brown <david.brown@linaro.org>
- Loading branch information
Showing
1 changed file
with
79 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,79 @@ | ||
name: Generate and Preview Rust Docs | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main # Only generate docs for PRs targeting main | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
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: Build Rust documentation | ||
working-directory: zephyr-rust-lang | ||
run: | | ||
# Note that the above build doesn't set Zephyrbase, so we'll need to do that here. | ||
west build -t rustdoc -b nrf52840dk/nrf52840 docgen | ||
mkdir docout | ||
mv build/rust/target/thumbv7em-none-eabi/doc docout/nostd | ||
cp docs/top-index.html docout/index.html | ||
- name: Build build documentation | ||
working-directory: zephyr-rust-lang | ||
run: | | ||
cd zephyr-build | ||
cargo doc | ||
mv target/doc ../docout/std | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: zephyr-rust-lang/docout | ||
|
||
deploy: | ||
needs: generate-docs | ||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |