Skip to content

Commit fe29755

Browse files
authored
🤖 Cache cargo binaries for docs workflow (#50)
Speeds up docs workflow by caching mdbook plugin binaries. Reduces CI time from ~2-3 minutes to ~30 seconds on cache hit. _Generated with `cmux`_
1 parent 0df8ed1 commit fe29755

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/workflows/docs.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,34 @@ jobs:
2626
- name: Checkout
2727
uses: actions/checkout@v4
2828

29+
- name: Setup Rust toolchain
30+
uses: dtolnay/rust-toolchain@stable
31+
32+
- name: Cache cargo binaries
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.cargo/bin
36+
key: ${{ runner.os }}-cargo-bins-mdbook-mermaid-0.16.0-linkcheck-0.7.7
37+
restore-keys: |
38+
${{ runner.os }}-cargo-bins-
39+
2940
- name: Setup mdBook
3041
uses: peaceiris/actions-mdbook@v2
3142
with:
3243
mdbook-version: "0.4.52"
3344

3445
- name: Install mdbook-mermaid
3546
run: |
36-
cargo install mdbook-mermaid --version 0.16.0
47+
if ! command -v mdbook-mermaid &> /dev/null; then
48+
cargo install mdbook-mermaid --version 0.16.0
49+
fi
3750
mdbook-mermaid install docs
3851
3952
- name: Install mdbook-linkcheck
40-
run: cargo install mdbook-linkcheck --version 0.7.7
53+
run: |
54+
if ! command -v mdbook-linkcheck &> /dev/null; then
55+
cargo install mdbook-linkcheck --version 0.7.7
56+
fi
4157
4258
- name: Build docs
4359
run: cd docs && mdbook build

0 commit comments

Comments
 (0)