feat(cargo): Set rustc-check-cfg for all config options #256
Workflow file for this run
This file contains hidden or 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
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-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: zephyr-lang-rust | |
fetch-depth: 0 # Ensure full history is available | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Setup Zephyr project | |
uses: zephyrproject-rtos/action-zephyr-setup@v1 | |
with: | |
app-path: zephyr-lang-rust | |
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-lang-rust | |
run: | | |
# Note that the above build doesn't set Zephyrbase, so we'll need to do that here. | |
west build -t rustdoc -b qemu_cortex_m3 docgen | |
mkdir rustdocs | |
mv build/rust/target/thumbv7m-none-eabi/doc rustdocs/nostd | |
- name: Build build documentation | |
working-directory: zephyr-lang-rust | |
run: | | |
cd zephyr-build | |
cargo doc | |
mv target/doc ../rustdocs/std | |
- name: Inject commit details into top-level commit. | |
working-directory: zephyr-lang-rust | |
env: | |
COMMIT_SHA: "${{ github.event.pull_request.head.sha || github.sha }}" | |
run: python3 etc/add-hash.py | |
- name: Upload docs artifact | |
if: github.event_name == 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rustdocs | |
path: zephyr-lang-rust/rustdocs | |
- name: Upload pages artifact | |
if: github.event_name == 'push' | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: zephyr-lang-rust/rustdocs | |
doc-publish: | |
name: Publish Rust Documentation | |
needs: generate-docs | |
runs-on: ubuntu-24.04 | |
if: | | |
github.event_name == 'pull_request' && | |
github.repository == 'zephyrproject-rtos/zephyr-lang-rust' | |
steps: | |
- name: Download documentation artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: rustdocs | |
- name: Publish to S3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ vars.AWS_BUILDS_ZEPHYR_LANG_RUST_PR_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_BUILDS_ZEPHYR_LANG_RUST_PR_SECRET_ACCESS_KEY }} | |
AWS_REGION: us-east-1 | |
run: | | |
PR_NUM=${{ github.event.number || 'not-a-pr' }} | |
aws s3 sync --only-show-errors . s3://builds.zephyrproject.org/zephyr-lang-rust/pr/$PR_NUM/ | |
gh-publish: | |
name: Publish main to gh-pages | |
needs: generate-docs | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-24.04 | |
if: | | |
github.event_name == 'push' && | |
github.repository == 'zephyrproject-rtos/zephyr-lang-rust' | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |