From 1a984a636e6db37241f4762680cdec8c3cf9a9e4 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Fri, 15 Nov 2024 01:15:14 +0100 Subject: [PATCH] Add docs build --- .github/ci/doc.sh | 22 ++++++++++++++++++++++ .github/workflows/doc.yaml | 27 --------------------------- Cargo.toml | 12 ++++++++++++ 3 files changed, 34 insertions(+), 27 deletions(-) create mode 100755 .github/ci/doc.sh delete mode 100644 .github/workflows/doc.yaml diff --git a/.github/ci/doc.sh b/.github/ci/doc.sh new file mode 100755 index 0000000..ec68c30 --- /dev/null +++ b/.github/ci/doc.sh @@ -0,0 +1,22 @@ +#!/bin/bash +## on push branch=main + +set -euxo pipefail + +export RUSTUP_HOME=/ci/cache/rustup +export CARGO_HOME=/ci/cache/cargo +export CARGO_TARGET_DIR=/ci/cache/target +export BUILDER_THREADS=4 +export BUILDER_COMPRESS=true + +# force rustup to download the toolchain before starting building. +# Otherwise, the docs builder is running multiple instances of cargo rustdoc concurrently. +# They all see the toolchain is not installed and try to install it in parallel +# which makes rustup very sad +rustc --version > /dev/null + +docserver-builder -i . -o webroot/crates/nrf-pac/git.zup + +export KUBECONFIG=/ci/secrets/kubeconfig.yml +POD=$(kubectl -n embassy get po -l app=docserver -o jsonpath={.items[0].metadata.name}) +kubectl cp webroot/crates $POD:/data diff --git a/.github/workflows/doc.yaml b/.github/workflows/doc.yaml deleted file mode 100644 index 49e3b6c..0000000 --- a/.github/workflows/doc.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: build gh-pages -on: - push: - branches: - - main - -jobs: - build_html: - name: Build docs - runs-on: ubuntu-20.04 - steps: - - name: Checkout master - uses: actions/checkout@v2 - with: - persist-credentials: false - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - - name: Build docs - run: cargo doc - - name: Publish to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./target/doc - force_orphan: true diff --git a/Cargo.toml b/Cargo.toml index 0cb140a..66e7091 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,3 +24,15 @@ nrf54l15-app = [] nrf54l15-flpr = [] nrf9120 = [] nrf9160 = [] + +[package.metadata.embassy_docs] +src_base = "https://github.com/embassy-rs/nrf-pac/blob/v$VERSION/src/" +src_base_git = "https://github.com/embassy-rs/nrf-pac/blob/$COMMIT/src/" +features = ["rt"] +flavors = [ + { regex_feature = "nrf51", target = "thumbv6m-none-eabi" }, + { regex_feature = "nrf52.*", target = "thumbv7em-none-eabihf" }, + { regex_feature = "nrf53.*", target = "thumbv8m.main-none-eabihf" }, + { regex_feature = "nrf54.*", target = "thumbv8m.main-none-eabihf" }, + { regex_feature = "nrf91.*", target = "thumbv8m.main-none-eabihf" }, +]