name: Documentation
on:
push:
pull_request:
permissions:
contents: read
jobs:
book-and-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 - name: Install mdbook (pinned asset, sha256-verified)
env:
MDBOOK_VERSION: "0.5.4"
MDBOOK_SHA256: 3f28de05dafca9d0f2eab99c662116b0e37b89b1d96a08f8f430b9eeae958cd7
run: |
set -euo pipefail
asset="mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
curl -fsSL --retry 3 -o "$RUNNER_TEMP/$asset" \
"https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/$asset"
echo "${MDBOOK_SHA256} $RUNNER_TEMP/$asset" | sha256sum -c -
mkdir -p "$RUNNER_TEMP/mdbook"
tar -xzf "$RUNNER_TEMP/$asset" -C "$RUNNER_TEMP/mdbook"
echo "$RUNNER_TEMP/mdbook" >> "$GITHUB_PATH"
- name: Install lychee
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p "$RUNNER_TEMP/lychee"
cd "$RUNNER_TEMP/lychee"
gh release download lychee-v0.24.2 --repo lycheeverse/lychee \
--pattern lychee-x86_64-unknown-linux-gnu.tar.gz \
--pattern lychee-x86_64-unknown-linux-gnu.tar.gz.sha256
sha256sum -c lychee-x86_64-unknown-linux-gnu.tar.gz.sha256
# The .sha256 file comes from the same release as the asset, so it only
# catches corruption. The pinned digest also catches a replaced asset.
echo "1f4e0ef7f6554a6ed33dd7ac144fb2e1bbed98598e7af973042fc5cd43951c9a lychee-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c -
tar -xzf lychee-x86_64-unknown-linux-gnu.tar.gz
echo "$RUNNER_TEMP/lychee/lychee-x86_64-unknown-linux-gnu" >> "$GITHUB_PATH"
- name: Prove self-repository file and anchor checks
run: python3 scripts/test-doc-links.py
- name: Build book and check links
run: scripts/check-docs.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
readme-first-success:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 - uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: scripts/test-readme.sh