diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..722e575c8 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,37 @@ +name: Docs + +on: + push: + branches: [main] + +jobs: + docs: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + + - name: Install build dependencies + run: > + sudo apt-get update -y -qq && + sudo apt-get install -y -qq llvm libc6-dev-i386 libclang-dev + + - uses: fiam/arm-none-eabi-gcc@v1 + with: + release: "9-2020-q2" + + - name: Build Documentation + run: cargo doc && scripts/make-toplevel-index.sh + + - name: Deploy Docs + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./target/doc diff --git a/scripts/make-toplevel-index.sh b/scripts/make-toplevel-index.sh new file mode 100755 index 000000000..334708ab9 --- /dev/null +++ b/scripts/make-toplevel-index.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash + +# Copyright Materialize, Inc. All rights reserved. +# +# Use of this software is governed by the Business Source License +# included in the LICENSE file at the root of this repository. +# +# As of the Change Date specified in that file, in accordance with +# the Business Source License, use of this software will be governed +# by the Apache License, Version 2.0. +# +# doc — renders API documentation. + +set -euo pipefail + +crate=$(basename $(pwd)) + +# Create a nice homepage for the docs. It's awful that we have to copy the +# HTML template like this, but the upstream issue [0] that would resolve this is +# now five years old and doesn't look close to resolution. +# [0]: https://github.com/rust-lang/cargo/issues/739 +cat > target/doc/index.html < + + + + + $crate + + + + + + + + + + + + + +
+ +
+
+ + +
+

+ $crate documentation +

+

This is the home of $crate's internal API documentation.

+
+ + + + + + + + + +EOF + +# Make the logo link to the nice homepage we just created. Otherwise it just +# links to the root of whatever crate you happen to be looking at. +cat >> target/doc/main.js <