|
| 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 | + west build -b nrf52840dk/nrf52840 --cmake-only docgen |
| 44 | + find . -type d -ls |
| 45 | +
|
| 46 | + - name: Build Rust documentation |
| 47 | + working-directory: zephyr-rust-lang/docgen |
| 48 | + run: cargo doc |
| 49 | + |
| 50 | + # - name: Deploy docs to GitHub Pages for pull requests |
| 51 | + # if: github.event_name == 'pull_request' |
| 52 | + # uses: peaceiris/actions-gh-pages@v3 |
| 53 | + # with: |
| 54 | + # github_token: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + # publish_dir: ./target/doc |
| 56 | + # publish_branch: gh-pages |
| 57 | + # publish_dir: ./target/doc |
| 58 | + # destination_dir: pr-${{ github.event.number }} |
| 59 | + # |
| 60 | + # - name: Deploy docs to GitHub Pages for push to main |
| 61 | + # if: github.event_name == 'push' |
| 62 | + # uses: peaceiris/actions-gh-pages@v3 |
| 63 | + # with: |
| 64 | + # github_token: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + # publish_dir: ./target/doc |
| 66 | + # publish_branch: gh-pages |
0 commit comments