Skip to content

Commit

Permalink
ci: Workflow to build rust docs
Browse files Browse the repository at this point in the history
Based on the beginnings of the twister build, but just then builds rust
docs.

Signed-off-by: David Brown <[email protected]>
  • Loading branch information
d3zd3z committed Jan 9, 2025
1 parent aeac237 commit 36691b2
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/rustdoc-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Copyright (c) 2025 Linaro Limited
# SPDX-License-Identifier: Apache-2.0

name: Rust Documentation Build

on:
schedule:
- cron: '0 */3 * * *'
push:
tags:
- v*
pull_request:

permissions:
contents: read

jobs:
generate-rust-docs:
runs-on:
group: zephyr-runner-v2-linux-x64-4xlarge
container:
image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026
options: '--entrypoint /bin/bash'
if: >
github.repository_owner == 'zephyrproject-rtos'
env:
BASE_REF: ${{ github.base_ref }}
CCACHE_DIR: /node-cache/ccache-zephyr
CCACHE_REMOTE_STORAGE: "redis://cache-*.keydb-cache.svc.cluster.local|shards=1,2,3"
CCACHE_REMOTE_ONLY: "true"
# `--specs` is ignored because ccache is unable to resolve the toolchain specs file path.
CCACHE_IGNOREOPTIONS: '-specs=* --specs=*'
LLVM_TOOLCHAIN_PATH: /usr/lib/llvm-16
steps:
- name: Apply container owner mismatch workaround
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Clone cached Zephyr repository
continue-on-error: true
run: |
git clone --shared /repo-cache/zephyrproject/zephyr .
git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false

- name: Environment Setup
run: |
git config --global user.email "[email protected]"
git config --global user.name "Zephyr Bot"
rm -fr ".git/rebase-apply"
rm -fr ".git/rebase-merge"
git rebase origin/${BASE_REF}
git clean -f -d
git log --pretty=oneline | head -n 10
west init -l . || true
west config manifest.group-filter -- +ci,+optional
west config --global update.narrow true
west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.update.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject)
west forall -c 'git reset --hard HEAD'
echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV
- name: Set up ccache
run: |
mkdir -p ${CCACHE_DIR}
ccache -M 10G
ccache -p
ccache -z -s -vv
- name: Run rustdoc build
run: |
export ZEPHYR_BASE=${PWD}
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
# The || true is so this doesn't fail and we can try to figure out what is happening.
# todo: it should not be necessary to build first.
west build -b nrf52840dk/nrf52840 ../modules/lang/rust/docgen \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
|| true
# west build -t rustdoc
# west build -t rustdoc -b nrf52840dk/nrf52840 ../modules/lang/rust/docgen
pwd
ls -l
ls -l build
ls -l build/rust
echo 'sample'
cat build/rust/sample-cargo-config.toml
# Fail to look at what happened
exit 1

0 comments on commit 36691b2

Please sign in to comment.