Skip to content

Commit 68e218f

Browse files
committed
chore(hooks): add check for outdated macro documentation
Refs: #466
1 parent 69f0d89 commit 68e218f

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.github/workflows/macro_docs.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: macro docs
2+
on:
3+
pull_request:
4+
paths:
5+
- "guide/src/macros/*.md"
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
lint-bindings:
13+
name: Lint bindings
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- name: Setup Rust
21+
uses: dtolnay/rust-toolchain@master
22+
with:
23+
components: rustfmt
24+
toolchain: nightly
25+
- name: Cache cargo dependencies
26+
uses: Swatinem/rust-cache@v2
27+
with:
28+
prefix-key: ${{ env.RUST_CACHE_PREFIX }}
29+
- name: Macro docs
30+
run: tools/update_lib_docs.sh && git diff --exit-code crates/macros/src/lib.rs

.lefthook.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ pre-commit:
1111
- name: bindings
1212
run: tools/update_bindings.sh && git diff --exit-code docsrs_bindings.rs
1313
glob: "allowed_bindings.rs"
14+
fail_text: |
15+
The `docsrs_bindings.rs` file seems to be out of date.
16+
Please check the updated bindings in `docsrs_bindings.rs` and commit the changes.
17+
- name: "macro docs"
18+
run: tools/update_lib_docs.sh && git diff --exit-code crates/macros/src/lib.rs
19+
glob: "guide/src/macros/*.md"
20+
fail_text: |
21+
The macro crates documentation seems to be out of date.
22+
Please check the updated documentation in `crates/macros/src/lib.rs` and commit the changes.

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ lefthook install
2828
- When changing the `allowed_bindings.rs`, you need to have `docker` and `buildx` installed. This is required to
2929
build the bindings in a consistent environment. See the [installation guide](https://docs.docker.com/engine/install/)
3030
for instructions on how to install Docker.
31+
- When updating the macro guides (`guide/src/macros`), you need to have the `nightly` toolchain installed. This is required
32+
to have the proper formatting in the documentation.
3133

3234
## Testing
3335

0 commit comments

Comments
 (0)