chore(ci): use cargo-docs-rs to lint docs (#1318)

This commit is contained in:
Josh McKinney 2024-08-11 20:09:57 -07:00 committed by GitHub
parent d5477b50d5
commit 57d8b742e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,20 +17,15 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true cancel-in-progress: true
env: # lint, clippy and coverage jobs are intentionally early in the workflow to catch simple formatting,
# don't install husky hooks during CI as they are only needed for for pre-push # typos, and missing tests as early as possible. This allows us to fix these and resubmit the PR
CARGO_HUSKY_DONT_INSTALL_HOOKS: true # without having to wait for the comprehensive matrix of tests to complete.
# lint, clippy and coveraget jobs are intentionally early in the workflow to catch simple
# formatting, typos, and missing tests as early as possible. This allows us to fix these and
# resubmit the PR without having to wait for the comprehensive matrix of tests to complete.
jobs: jobs:
rustfmt: rustfmt:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust nightly - uses: dtolnay/rust-toolchain@nightly
uses: dtolnay/rust-toolchain@nightly
with: with:
components: rustfmt components: rustfmt
- run: cargo +nightly fmt --all --check - run: cargo +nightly fmt --all --check
@ -51,12 +46,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust stable - uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@stable
with: with:
components: clippy components: clippy
- name: Install cargo-make - uses: taiki-e/install-action@cargo-make
uses: taiki-e/install-action@cargo-make
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo make clippy - run: cargo make clippy
@ -64,8 +57,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Lint markdown - uses: DavidAnson/markdownlint-cli2-action@v16
uses: DavidAnson/markdownlint-cli2-action@v16
with: with:
globs: | globs: |
'**/*.md' '**/*.md'
@ -75,19 +67,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust stable - uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@stable
with: with:
components: llvm-tools components: llvm-tools
- name: Install cargo-llvm-cov and cargo-make - uses: taiki-e/install-action@v2
uses: taiki-e/install-action@v2
with: with:
tool: cargo-llvm-cov,cargo-make tool: cargo-llvm-cov,cargo-make
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Generate coverage - run: cargo make coverage
run: cargo make coverage - uses: codecov/codecov-action@v4
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true fail_ci_if_error: true
@ -101,12 +89,10 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust {{ matrix.toolchain }} - uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{ matrix.toolchain }} toolchain: ${{ matrix.toolchain }}
- name: Install cargo-make - uses: taiki-e/install-action@cargo-make
uses: taiki-e/install-action@cargo-make
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo make check - run: cargo make check
env: env:
@ -114,14 +100,17 @@ jobs:
lint-docs: lint-docs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust nightly - uses: dtolnay/rust-toolchain@nightly
uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/install@cargo-docs-rs
- name: Install cargo-make
uses: taiki-e/install-action@cargo-make
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo make lint-docs # Run cargo rustdoc with the same options that would be used by docs.rs, taking into account
# the package.metadata.docs.rs configured in Cargo.toml.
# https://github.com/dtolnay/cargo-docs-rs
- run: cargo +nightly docs-rs
test-doc: test-doc:
strategy: strategy:
@ -131,13 +120,10 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust stable - uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@stable - uses: taiki-e/install-action@cargo-make
- name: Install cargo-make
uses: taiki-e/install-action@cargo-make
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: Test docs - run: cargo make test-doc
run: cargo make test-doc
env: env:
RUST_BACKTRACE: full RUST_BACKTRACE: full
@ -155,14 +141,12 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust ${{ matrix.toolchain }}} - uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{ matrix.toolchain }} toolchain: ${{ matrix.toolchain }}
- name: Install cargo-make - uses: taiki-e/install-action@v2
uses: taiki-e/install-action@cargo-make with:
- name: Install cargo-nextest tool: cargo-make,nextest
uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo make test-backend ${{ matrix.backend }} - run: cargo make test-backend ${{ matrix.backend }}
env: env: