name: Docs

on:
  pull_request:
  merge_group:
  push:
    branches: [main]

env:
  CARGO_TERM_COLOR: always

permissions: {}

jobs:
  docs:
    name: Generate docs (${{ matrix.version }})
    runs-on: ubuntu-latest
    timeout-minutes: 60
    strategy:
      fail-fast: false
      matrix:
        include:
          - version: "Bitcoin Core 29"
            feature: "29_0"
          - version: "Bitcoin Core 30.2"
            feature: "30_2"
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
        with:
          persist-credentials: false
      - name: Set up Rust
        run: |
          rustup toolchain install 1.85.0 --profile minimal
          rustup default 1.85.0

      - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2
        with:
          cache-on-failure: true

      - name: Check docs leaving the dependencies out
        env:
          RUSTDOCFLAGS: -A rustdoc::private-doc-tests -D warnings
        run: cargo doc --no-deps --no-default-features --features ${{ matrix.feature }}
