zvidlib 0.4.1

Frame-accurate video and audio I/O for native and WebAssembly applications
Documentation
name: Docs

on:
  push:
    branches: [main]
  pull_request:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: pages-${{ github.ref }}
  cancel-in-progress: false

jobs:
  build:
    name: Build rustdoc
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust toolchain
        run: rustup show
      # This job rebuilt every dependency from a cold `target/` on every run
      # before this step existed (#352). The cache is keyed on the job, the
      # runner, the toolchain and the manifest, so the `[profile.bench]`
      # fat-LTO artifacts and the `[profile.dev]` ones never share an entry;
      # `cache-on-failure` keeps a failed run's dependency build, since the
      # dependencies are not what failed.
      - name: Cache cargo registry and build artifacts
        uses: Swatinem/rust-cache@v2
        with:
          cache-on-failure: true
      - name: Install native audio dependencies
        timeout-minutes: 15
        run: python3 .github/scripts/apt_install.py libasound2-dev
      # Every workspace crate, not only `zvidlib`: its pages inline the
      # subcrates' items, and `-D warnings` is what keeps their intra-doc links
      # from rotting in the crates docs.rs documents on their own (#604).
      - name: Build API documentation
        run: cargo doc --workspace --no-deps --features native
        env:
          RUSTDOCFLAGS: -D warnings
      - name: Add redirect index
        run: echo '<meta http-equiv="refresh" content="0; url=zvidlib/index.html">' > target/doc/index.html
      - uses: actions/upload-pages-artifact@v3
        with:
          path: target/doc

  deploy:
    name: Deploy to GitHub Pages
    needs: build
    if: github.event_name == 'push'
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4