diff --git a/.github/workflows/rust-compile.yml b/.github/workflows/rust-compile.yml index 953f99f..2ea0118 100644 --- a/.github/workflows/rust-compile.yml +++ b/.github/workflows/rust-compile.yml @@ -23,9 +23,28 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions-rust-lang/setup-rust-toolchain@v1 - - run: | - for package in $(cargo metadata --no-deps --format-version=1 | jq -r '.packages[] | .name'); do - cargo rustdoc -p "$package" --all-features -- -D warnings -W unreachable-pub + - run: > + # Check intra-doc links, thanks to ChatGPT + cargo metadata --no-deps --format-version=1 \ + | jq -r '.packages[] | .name as $pname | .targets[] | [$pname, .kind[], .name] | @tsv' \ + | while IFS=$'\t' read -r package kind name; do + case "$kind" in + lib) + cargo rustdoc -p "$package" --lib --all-features -- -D warnings -W unreachable-pub + ;; + bin) + cargo rustdoc -p "$package" --bin "$name" --all-features -- -D warnings -W unreachable-pub + ;; + example) + cargo rustdoc -p "$package" --example "$name" --all-features -- -D warnings -W unreachable-pub + ;; + test) + cargo rustdoc -p "$package" --test "$name" --all-features -- -D warnings -W unreachable-pub + ;; + bench) + cargo rustdoc -p "$package" --bench "$name" --all-features -- -D warnings -W unreachable-pub + ;; + esac done format_and_lint: @@ -54,6 +73,7 @@ jobs: steps: - name: Checkout source code uses: actions/checkout@v4 + - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: