name: Documentation
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
docs:
name: Generate Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Generate documentation
run: |
cargo doc --no-deps --all-features
echo '<meta http-equiv="refresh" content="0; url=mudssky_utils">' > target/doc/index.html
- name: Deploy to GitHub Pages
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
check-docs:
name: Check Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Check documentation
run: cargo doc --no-deps --all-features --document-private-items
env:
RUSTDOCFLAGS: "-D warnings"
- name: Test documentation examples
run: cargo test --doc --all-features