jetstream 16.0.0

Jetstream is a RPC framework for Rust, based on the 9P protocol and QUIC.
Documentation
name: Deploy mdBook site to Pages

on:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]
  workflow_dispatch:

permissions:
  contents: write
  pages: write
  id-token: write
  pull-requests: write

concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      MDBOOK_VERSION: 0.5.2
      CARGO_TERM_COLOR: always
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        run: |
          curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
          rustup toolchain install nightly
          rustup default nightly
          rustup update
          rustup component add llvm-tools-preview

      - name: Install Tools
        run: |
          cargo install --version ${MDBOOK_VERSION} mdbook
          cargo install grcov
          cargo install --path tools/mdbook-changelog

      - name: Run Tests with Coverage
        env:
          LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
          RUSTFLAGS: "-Cinstrument-coverage"
        run: |
          cargo test --all-features

      - name: Generate Coverage Report
        run: |
          grcov . --binary-path ./target/debug/ -s . -t html --branch --ignore-not-existing --ignore "/*" -o coverage/

      - name: Run Cargo Doc
        run: |
          cargo +nightly doc --workspace --no-deps --release --all-features

      - name: Setup Pages
        id: pages
        uses: actions/configure-pages@v5

      - name: Build with mdBook
        run: |
          mdbook build
          # Copy coverage report to the book output
          cp -r coverage/ book/coverage/
          # Copy rustdoc to the book output (includes static files, fonts, etc.)
          mkdir -p book/doc/
          # Copy all jetstream crate docs
          cp -r target/doc/jetstream* book/doc/
          # Copy shared static resources (CSS, JS, fonts)
          cp -r target/doc/static.files book/doc/
          # Copy other shared files needed by rustdoc
          cp target/doc/*.js book/doc/ 2>/dev/null || true
          cp target/doc/*.html book/doc/ 2>/dev/null || true

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ./book

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

  preview:
    runs-on: ubuntu-latest
    needs: build
    if: github.event_name == 'pull_request'
    permissions:
      contents: write
      pull-requests: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Download artifact
        uses: actions/download-artifact@v4
        with:
          name: github-pages
          path: ./artifact

      - name: Extract artifact
        run: |
          cd artifact
          tar -xf artifact.tar
          rm artifact.tar

      - name: Deploy to PR preview
        uses: rossjrw/pr-preview-action@v1
        with:
          source-dir: ./artifact