57 lines
1.5 KiB
YAML
57 lines
1.5 KiB
YAML
name: Documentation
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
docs:
|
|
name: Build and Deploy Documentation
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rust-docs
|
|
|
|
- name: Cache cargo dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Generate API documentation
|
|
run: |
|
|
cargo doc --no-deps --workspace --all-features
|
|
|
|
- name: Check for documentation warnings
|
|
run: |
|
|
cargo doc --no-deps --workspace --all-features 2>&1 | tee doc_output.txt
|
|
if grep -q "warning:" doc_output.txt; then
|
|
echo "Documentation warnings found!"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Deploy to GitHub Pages
|
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./target/doc
|
|
destination_dir: ./docs
|
|
|